[Mpls-pm] Using Mason's $m from within a perl module

Dave Dash dd at davedash.com
Wed Nov 30 10:50:16 PST 2005


Hey, I appologize in advance also if this isn't a good place to ask
perl/Mason questions.  I prefer it over the higher volume Mason lists, but
if this is the wrong place for it, I'd rather not step on people's toes.

Anyway,  I've got a perl module:

package Foo;


> our $m =  HTML::Mason::Request::instance;
>
sub login_required
> {
>     unless ($m->session->{'userid'}) {
>         $m->comp('login.mhtml');
>         $m->abort;
>     }
> }
>

but this always fails saying that $m isn't instantiated.  Everything works
fine if I define the $m locally within each sub, but that gets annoying.  I
thought our should scope to the entire package.  What's the propper way to
take this on?

Thanks
-d


--
Dave Dash
612.670.0621
3555 Fremont Ave S, Mpls, MN 55408
http://citybikemap.com/
http://davedash.com/
AIM: davesdash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/mpls-pm/attachments/20051130/0b640d8f/attachment.html


More information about the Mpls-pm mailing list