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

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to