Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 rifling through the Monastery: (3)
As of 2025-06-16 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.