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

Re: CGI::Application - alternative to using $self->param?

by polettix (Vicar)
on Nov 21, 2007 at 01:12 UTC ( [id://652047]=note: print w/replies, xml ) Need Help??


in reply to CGI::Application - alternative to using $self->param?

The CGI::Application way lets you attach data to the object instead of putting it as a global somewhere. This lets you forget *where* you put the data, i.e. in which particular package, and could minimise interactions with other pieces of software.

Elaborating on friedo's suggestion, why don't you simply set the hash as a parameter:

$self->param(hash => { funky => 'Brown' });
somewhere in the beginning, and then retrieve and use it:
sub some_runmode { my $self = shift; my $hash = $self->param('hash'); print "this funky var: $hash->{funky}"; }
like you did before?

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-06-18 02:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.