namotco wrote: > $m->comp($path) if -r $base . $path; > > > BTW, there is some way to get $base easily from Mason, but I can't > remember where it is, source_something maybe?
probably not because it is possible to have multiple component roots, which we don't. it is also possible to use custom path resolvers, which we do. and either of these cases will cause this code to fail. > > On Nov 30, 2007, at 11:34 PM, Sherrard Burton wrote: > >> >> >> Xicheng Jia wrote: >>> On 11/30/07, Sherrard Burton <[EMAIL PROTECTED]> wrote: >>>> i may have overlooked this in the documentation, but is there a >>>> $m->comp() equivalent to attr_if_exists()? obviously it's not critical, >>>> but it would be nice to be able to shortcut logic like this: >>>> >>>> % if ( $m->comp_exists( '/path/to/possible/component' ) ) { >>>> % $m->comp( '/path/to/possible/component' ); >>>> % } >>>> >>>> to >>>> >>>> % $m->comp_if_exists( '/path/to/possible/component' ); >>> >>> what if write your own: >>> >>> sub HTML::Mason::Request::comp_if_exists >>> { >>> my ($self, $path, %args) = @_; >>> return $self->fetch_comp($path) ? $self->comp($path, %args) : ''; >>> } >>> >>> and then call it the way you wanted.. >> >> thanks. i thought about that, but then i'd have to remember to make sure >> that method continued to work across mason upgrades. >> >> i was really hoping that it was already there in some form or another >> and i just missed it. i can remember a time before attr_if_exists() >> existed, then eventually stumbling upon it when not necessarily looking. >> >> >> ------------------------------------------------------------------------- >> SF.Net email is sponsored by: The Future of Linux Business White Paper >> from Novell. From the desktop to the data center, Linux is going >> mainstream. Let it simplify your IT future. >> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >> _______________________________________________ >> Mason-users mailing list >> Mason-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mason-users > ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users