in reply to Passing data around within CGI::Prototype
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:__PACKAGE__->reflect->addSlot( tt_data => {}, perl_data => {}, );
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.$self->perl_data->{pass_around} = 'some calculated data'; $self->tt_data->{some_stuff} = $self->get_some_stuff(); if ( $self->perl_data->{pass_around} ){ blah
|
|---|