|
Re: Profiler: msg#00252web.mason.user
Dave Rolsky wrote: I'd love to see this on CPAN as MasonX::Request::Profiler.Would something like this handle multiple request subclasses? (I'm not to sure how things like the alter_superclass work, and havn't tested this at all, it's just some idea that popped into my mind after too little sleep) The basic idea is maybe a request subclass, could munge the ISA's of other request subclasses to chain them together. (assuming the subclasses all behaved nicely and were sure to call their superclass) my $ah = HTML::Mason::ApacheHandler->new( request_class => 'MasonX::Request::Chained', request_chain => [ 'MasonX::Request::Profiler', 'MasonX::Request::WithApacheSession','HTML::Mason::Request' ] .. etc ); package MasonX::Request::Chained; my $DONE = 0; sub new { my $class = shift; # just a flag so we don't have to go through all this on every request unless ($DONE) { # get request chain from params (not sure how) # loop through each request modules # ISA, looking for HTML::Mason::Request # and change it to the next module in the chain. # so Profiler, will put WithApacheSession in it's ISA # WithApacheSession puts Foo in it's ISA, # foo will have whatever it had to begin with. for ($i = 0; $i < @{ $request_chain }; ++$i) { last unless $request_chain[$i+1]; # last in the chain, don't screw with ISA $cur_mod = $request_chain->[$i] . "::ISA"; $next_mod = $request_chain->[$i+1]; for ($x = 0; $x < eval('@' . $cur_mod ); ++$x) { if ($$cur_mod[$x] eq 'HTML::Mason::Request') { $$cur_mod[$x] = $next_mod; } } $DONE = 1; } } return $self->SUPER::new(@_); } ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: DHandlers and Apache: 00252, Jonathan Swartz |
|---|---|
| Next by Date: | Re: Profiler: 00252, Dave Rolsky |
| Previous by Thread: | Re: Profileri: 00252, Dave Rolsky |
| Next by Thread: | Re: Profiler: 00252, Dave Rolsky |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |