Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Passing data around within CGI::Prototype

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.