in reply to Loading Modules At Run-Time With Interpolation
Backslash the first colon within double quotes.
Also, after eval, check for $@, not $!. E.g.:
Update: On closer inspection, the lack of backslash is not a problem (I was thinking of pitfalls like "$foo::$bar"; but do check for $@ after eval!). FWIW, your code works fine for me.
# Foo/Quux.pm package Foo::Quux; print 'Loading ', __PACKAGE__, "\n";
use strict; use warnings; for ( 'Quux' ) { eval "require Foo::$_" || die $@; } __END__ Loading Foo::Quux
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Loading Modules At Run-Time With Interpolation
by Cody Pendant (Prior) on Aug 12, 2005 at 04:09 UTC |