On Dec 5, 2007 3:41 PM, Perrin Harkins <[EMAIL PROTECTED]> wrote: > On Dec 5, 2007 6:33 PM, Anthony Ettinger <[EMAIL PROTECTED]> wrote: > > In effect, I just want this thing to die off at the end of each http > > request, and not shared between other users of the application. > > Use mod_perl's $r->pnotes(). It will be cleaned out for you at the > end of each request, even if your code dies. > > - Perrin >
Here's an example of what I need: ./pages/autohandler <%init> $m->notes('msg') = new UI::Msg; my $msg = $m->notes('msg'); </%init> Now any where in the request, as far as mason components go, I can use $msg->err("This is an error"); BUT...suppose there is a mason component that uses a DB object: ./parts/form <%once> use DB::Contacts; </%once> <%init> my $customer = DB::Contacts->search_where({ 'email' => $ARGS{'email'} }); #could be "bad email address" ... </%init> Now I would like the module DB::Contacts to have access to the $msg object created in the autohandler. So within it, if it receives an invalid "email", it could return undef, and add an error: package DB::Contacts; .... sub search_where { my $self = shift; my $param = $_[0]->{'email'}; $msg->err("Invalid email.") unless $param m/\@/; #no "@" is invalid (stupid I know) } ... 1; Is this possible to have perl libraries access the $msg object defined inside a mason autohandler? And not be shared or live beyond the current request? -- Anthony Ettinger 408-656-2473 http://anthony.ettinger.name var (bonita, farley) = new Dog; farley.barks("very loud"); bonita.barks("at strangers"); ------------------------------------------------------------------------- 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