Re: Defaults in flags()

David Wheeler <[email protected]> Wed, 9 Aug 2006 12:00:31 -0400
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Aug 9, 2006, at 11:54, David Wheeler wrote:

> Uh, but then maybe I could just call parent(), instead? Would it
> return undef when I have the inherit flag set to undef in the  
> component?

Oh, I see what the problem is. I need to know only when the inherit  
flag has been set in a component, and, if it has, what it was set to.  
Otherwise I don't worry about it.

So for my method, it would need to be something like this:

     my $tmpl_path = '/foo/bar';
     my $tmpl_name = 'article.mc';
     local *HTML::Mason::Component::inherit_start_path = sub {
         my $self = shift;

         # Allow template-defined inheritance to work.
         return $self->inherit_start_path if exists $self->{flags} 
{inherit};

         # Use the template path if executing our dhandler.
         return $tmpl_path if $self->name =~ m/\Q$tmpl_name\E$/;

	# Otherwise, just fall back on Mason's default.
         return $self->inherit_start_path;
     };

So I guess that I'm only interested in the existence of a flag.

Best,

David

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642