perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Huber <...@tm1.at>
Subject Re: Custom Tags with XMLSubsMatch
Date Sat, 09 Feb 2002 17:46:40 GMT
I understand what you mean, but I do not want to have
dynamic data within XMLSubs, I want to have dynamic generated XMLSubs.
So i try to explain my problem in more detail.

Someone requests for example the document getDynamicdata.asp.
If this is an static XML-document the XMLSubsMatch will work as expected,

but imagine, that within this document I call a subroutine from
global.asp which will receive an XML-document from a server via socket 
connection and I want to have XMLSubsMatch on this data too within getDynamicdata.asp.

I detected that such dynamic data can be put into the document with an embedded
perl call as described below, but the XML tags will not processed.

I hope it is now clear where my problems are. 

Thanks for further help.

Martin


> Martin Huber wrote:
> > 
> > OK, here is my question:
> > I tried to use XMLSubsMatch with dynamic generated data.
> > That means, I put the following in a asp-File
> > 
> > <%print my::getMYDynamicData();%> which gets the xml-data (with
> > custom tags via socket from a server). Unfortunately the custom tags
> > inside will never be interpreted from the ASP-engine.
> > So how can this be done?
> > 
> 
> I am not sure I get this... here is one way to get XMLSubs to work...
> 
>   # httpd.conf / .htacess
>   PerlSetVar XMLSubsMatch my:\w+
> 
>   # some module, say My::Tags, or global.asa
>   sub my::getMyDynamicData { ... }
> 
>   # some Apache::ASP script
>   <my:getMyDynamicData />
> 
> The poorly documented fact is that you can pass dynamic data
> to XMLSubs just like its a perl subroutine (it is) without
> <%= %> ASP tags like this:
> 
>   <my:getMyDynamicData server="$server" type="$type" />
> 
> literally gets translated to:
> 
>   &my::getMyDynamicData({ 'server'=>$server, 'type'=>"$type" }, '');
> 
> So if you really wanted to, you could use the XMLSub as as ASP
> code call like this:
> 
>   <% &my::getMyDynamicData({ 'server'=>$server, 'type'=>"$type" }, '');
%>
> 
> And if you want it to output anything just have it print() as normal.
> But you never want to print and XMLSubs... they are supposed to do
> their own printing.  If you want a return value from an XMLSub, then
> make sure it has access to an object, like $main::Object which you
> create that you can store the return value in, or you could even
> pass the object in as an argument to the sub, but I prefer doing
> something like:
> 
>   # httpd.conf
>   PerlSetVar GlobalPackage My::Package
>   # global.asa
>   sub Script_OnStart { my $Object = bless {}; }
> 
> Then in the XMLSubs, you can just reference $My::Package::Object,
> or if you do this alot, you could do this:
> 
> package my;
> *Object = *My::Package::Object
> 1;
> 
> Then in my::* subs, $Object will just point to the $Object in 
> the global.asa package.
> 
> If this did not help, please clarify your problem.
> 
> --Josh



----------------------------------------------------
 Diese Nachricht wurde über tower media 1 gesendet
Ihre 1. Adresse zum Kommunizieren: http://www.tm1.at

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message