Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How to create dynamic global variables

by linuxer (Curate)
on Jul 01, 2010 at 14:44 UTC ( #847531=note: print w/replies, xml ) Need Help??


in reply to How to create dynamic global variables

I have problems to completely understand your request; I hope my guess will be helpful to you.

You could use a global hash which uses the module's name as key and the object as value.

#! /opt/perl/bin/perl # vim: set ts=4 sw=4 sts=4 et nu: use strict; use warnings; use Data::Dumper; my %object; my @modules = qw( CGI ); for my $mod ( @modules ) { eval "use $mod; \$object{$mod} = $mod->new; 1;" or die "eval faile +d: $@\n"; } print Dumper \%object;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://847531]
help
Chatterbox?
[karlgoethebier]: Corion: "...didn't leave business cards" Those guys came from Muränia?
[Corion]: karlgoethebier: Heh - naah, I think they are just very fresh out of university. At least they seem to have hired one person as key accountant who has done enterprise consulting etc. before :)
[Corion]: erix: It wouldn't be nice of me to publically shame and name ;)
[Corion]: I'm interested in how their product actually works. It uses websockets between two non-browser components, so there are some weird technology decisions, or rather, I assume the product started out as something completely different :)
[erix]: fair enough

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2018-04-19 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?