Re: adding a new bit of component-call syntax

Dave Rolsky <[email protected]> Wed, 10 Aug 2005 14:58:58 -0500 (CDT)
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Mon, 4 Apr 2005, Kwindla Hultman Kramer wrote:

> I need to subclass Request in order to over-ride fetch_comp(), and
> Interp in order to over-ride load(). I'm running into a stumbling
> block, and was hoping for some advice from the experts assembled here.

One thing I wanted to do for 1.30 and didn't get to was revisit what the 
Resolver should do.  It seems like it should be more involved in 
translating a component path to a component.


>  my $ah = HTML::Mason::ApacheHandler->new
>  (
>   resolver_class => 'CommaX::Mason::Gadgets::Resolver',
>   comp_root      => '/web-working',
>   data_dir       => '/usr/local/apache/mason_data',
>   error_mode     => 'output',
>   request_class  => 'CommaX::Mason::Gadgets::ApacheHandler',
>  );
>
> But that causes an error on Apache startup:
>
>  Deep recursion on subroutine "Class::Container::allowed_params" at
>  /usr/local/share/perl/5.8.4/Class/Container.pm line 466.

What does CommaX::Mason::Gadgets::ApacheHandler subclass?  Request or 
ApacheHandler?  It should subclass request or I wouldn't be surprised at 
explosions.

> Here's the class:
>
>  package CommaX::Mason::Gadgets::Interp;
>
>  use HTML::Mason::Interp;
>  use base qw( HTML::Mason::Interp );
>
>  __PACKAGE__->contained_objects
>    (
>     request  =>
>     { class => class => 'CommaX::Mason::Gadgets::Request',
>       delayed => 1,
>       descr => "Objects returned by make_request are members of this class" },
>    );
>
>  sub make_request {
>    my $self = shift;
>    my $obj = $self->create_delayed_object( 'request', interp => $self, @_ );
>    Apache->request->warn ( "---- make_request -- $self creates new $obj ----" );
>    return $obj;
>  }

Hmm, that _should_ work, except for the doubled "class =>"

I wonder if we can add something to resolver like "munge_path" that would 
be called early on and give it a chance to change new syntax to something 
Interp is ok with (starts with "/").  Or maybe we shouldn't even check 
that the path is absolute in Interp.

If we can find a way to do this in 1.3x that is obviously backwards 
compatible and low overhead I think it's something we should look into.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf