Mmm, well here's what I did, which I think illustrates some (minor) criticisms 
of BasicSession. I split it into 2 perl modules. 1 is just the functions 
get_attribute(), set_attribute(), remove_attribute() and the handler() entry 
point which sets up the session. This I just install with AxAddPlugin 
GEB::Session. That gives all my code access to the API, regardless of whether 
or not I need to use the taglib, and voids any dependency on XSP. The 'rump' 
of BasicSession just calls GEB::Session::get_attribute() etc and is 
essentially identical to the CPAN version minus the removed code. 

I just thought it provided a little bit nicer separation of things. In 
principle I am now free to build ANY logic behind 'GEB::Session' and not need 
to muck with the taglib (or any other) code that uses those functions, its 
just effectively a very simplistic session management API. 

On Tuesday 06 January 2004 7:03 pm, Michael A Nachbaur wrote:
> On Tuesday 06 January 2004 08:29 am, Martin Oldfield wrote:
> > In part this was because I found both A::X::Session and
> > A::X::BasicSession hard to either make work or understand, but also
> > because I wanted a library I could use from both Perl and XSP (the
> > latter being a thin SimpleTaglib layer thrown round the former).
>
> I don't have the time to do your code justice (I'll look at it this
> evening) but I just wanted to toss in my $0.02 CAD for what it's worth
> (which is about $0.0155 USD).
>
> A::X::BasicSession can actually be used from both XSP and Perl.
> A::X::Plugin::BasicSession creates and manages the actual session object
> itself, and dumps the tied session in the pnotes() table. 
> A::X::BasicSession is simply a convenient wrapper around the pnotes() tied
> object, and uses TaglibHelper to expose that to XSP.
>
> So, for instance, I do the following all the time:
>
> foreach my $field (keys %{$ctxt->{Form}}) {
>     next if ($field =~ /__/);
>     next if ($field =~ /\./);
>     next if ($field eq 'apply');
>     if ($field eq 'preference-search_results_pagesize') {
>         AxKit::XSP::BasicSession::remove_attribute('search-max');
>         AxKit::XSP::BasicSession::remove_attribute('search-skip');
>     }
>     AxKit::XSP::BasicSession::set_attribute($field,
> $ctxt->{Form}->{$field}); }
>
> Now, there may be an easier way to access that, for instance by making a
> constructor.  So, you could do:
>
> my $obj = new AxKit::XSP::BasicSession;
> $obj->remove_attribute("foo");
>
> Would anyone find that useful?  I don't mean to suggest that one person's
> implementation is better than another, but I'd like to prevent any further
> confusion with sessions in AxKit.  Two (or three?) session taglibs is
> already pretty confusing as it is.
>
> Either that, or I'd find having a "Best Of Breed" approach useful,
> deprecating an older taglib in favor of an easier to install and use taglib
> that takes pieces of different taglibs and has a fresh new lemon scent. ;-)

-- 
Tod Harter
Giant Electronic Brain
http://www.giantelectronicbrain.com


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

Reply via email to