Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

crashtest's scratchpad

by crashtest (Curate)
on Feb 10, 2005 at 21:36 UTC ( [id://429922]=scratchpad: print w/replies, xml ) Need Help??

package Something::Config; use strict; use warnings; #use diagnostics; use Carp; use Readonly; use Exporter qw( import ); Readonly::Array my @KNOWN_ENVIRONMENTS => ( { test => \&is_crashtest_workstation, action => \&setup_crashtest_ +workstation }, # (more to be added) ); # this works { no warnings 'redefine'; eval "sub import { SUPER->import(@_); setup_env(@_) }"; } # ... but i was trying to do this: #sub import { # SUPER->import(@_); # setup_env(@_); #} sub setup_env { for my $env (@KNOWN_ENVIRONMENTS) { my $test = $env->{test}; my $action = $env->{action}; if ($test->()) { $action->(@_); return; } } carp "Can't identify this environment; add to Something::Config as + needed!"; } ###################################################################### +########## ### WORKSTATION SETUP sub is_crashtest_workstation { return $^O eq "MSWin32" && $ENV{COMPUTERNAME} eq "ABCDEF123"; } sub setup_crashtest_workstation { if (! exists $ENV{ORACLE_HOME}) { $ENV{ORACLE_HOME} = 'C:\yada\yada'; } } # more to be added... 1;
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-12-06 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (39 votes). Check out past polls.