I'm in the process of writing taglibs around some existing objects. Before I got to deep into that process, I became curious as to how to best keep state between method calls in an XSP taglib [under mod_perl].
Let's assume we have this simple XSP structure:
<myobj:load filter1="foo"> <filter> <filter2>bar</filter2> </filter>
<myobj:name/> <myobj:description/>
<myobj:list> <myobj:list-name/> </myobj:list> </myobj:load>
Because I love self punishment, I'm trying to do this in SimpleTaglib, and I'm completely lost...
Let's start simple...
<myobj:load name="foo"> <myobj:filter> <myobj:name>bar</myobj:filter> </myobj:filter>
<name><myobj:name/></name> </myobj:load>
The name attribute and the filter/name node are both optional, I want to use the as filters to the load method. So after inspecting %attr and %_, the desired name would be passed into load.
In SimpleTaglib, we'd have
sub load : expr attrib(name) childStruct(filter{name}) : {}; sub name : expr {}
Now, I need to call MyObj's load method passing in the correct name filter. This is easy if I'm only using name via %attr:
sub load__open { return 'my $obj = MyObject->load(' $attr{name} . ');'; }; sub name { return '$obj->name' };
This works as intended. A somewhat global $obj is created and used later my name.
The problem is, I need access to %_ during load__open so I can tweak the filter going into load.
If I wait and create/load $obj = MyObj->load during load() and not load__open(), it's too late and name() doesn't work because it doesn't see $obj in it's scope. [if that makes any sense].
I can't do the create during filter__open because myobj:filter isn't required.
Is this a matter or trolling through $e instead ad the method level, or is this an issue where I just have to restor to creating a raw taglib sans Simple/Helper?
Thanks, -=Chris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]