I personally handle cases like this with a singleton object.

see Class::Singleton

It's easily accessable then throughout all the code, including modules
without fussing about namespaces or anything.

my $msg = UI::Msg->instance();


Anthony Ettinger wrote:

>I have an object (contains UI messaging interface) that I want to
>persist throughout all the mason parts/includes in a request.
>
>How should I do this?
>
>autohandler?:
>my $msg = new UI::Msg;
>
>so from within any part, file, or page now has access to $msg object:
>
>An example below:
>
>/parts/foo
>$msg->err("There was an error with FOO");
>
>/parts/bar
>$msg->ok("Bar processed correctly!");
>
>/autohandler:
>print $msg->errors();
>
>
>Similar to the global $m (mason object)...I do not want to have to
>pass $msg object explicitly to all my files.
>
>  
>


-------------------------------------------------------------------------
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

Reply via email to