Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Passing data around within CGI::Prototype

by cbrandtbuffalo (Deacon)
on Mar 16, 2006 at 17:40 UTC ( [id://537225]=note: print w/replies, xml ) Need Help??


in reply to Passing data around within CGI::Prototype

We do something similar, with a little more structure. We have a parent class that all apps inherit from, and in that class we do something like this:
__PACKAGE__->reflect->addSlot( tt_data => {}, perl_data => {}, );
This creates empty data slots that you can use as a sort of data store. In our code, we can then do things like this:
$self->perl_data->{pass_around} = 'some calculated data'; $self->tt_data->{some_stuff} = $self->get_some_stuff(); if ( $self->perl_data->{pass_around} ){ blah
This is basically a simple way to create object data that can be accessed from anywhere without having to pass it. We use separate structures for perl_data and tt_data as an internal standard. Data for the template goes in tt_data and internal data is in perl_data.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://537225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-25 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found