in reply to Conditional use of 'use'
, you could do something like:BEGIN { require module }
If you are using the form use module LIST you'll need to call import:BEGIN { my $version = (($0 =~ /2(?:\.pl)?$/) ? '2' : ''); require "LayerB${version}.pm"; }
BEGIN { # set $version based on $0 require "LayerB${version}.pm"; "LayerB${version}"->import(qw(A B C)); }
update: added import part, cleaned up $version setting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Conditional use of 'use'
by dvergin (Monsignor) on Jun 12, 2001 at 09:08 UTC | |
by chromatic (Archbishop) on Jun 12, 2001 at 20:05 UTC | |
by tye (Sage) on Jun 12, 2001 at 22:41 UTC |