in reply to Re^2: How to import names from a dynamically required module
in thread How to import names from a dynamically required module
This is not specific to import; it works with all class method calls...
use Math::BigInt; my $class = "Math::BigInt"; my $six = $class->new(6); my $seven = "Math::BigInt"->new(7); my $eight = join("::", "Math", "BigInt")->new(8);
In fact, string quoting class names is arguably a much better idea than the more conventional Math::BigInt->new(9), because the latter will start behaving surprisingly if there's ever a BigInt sub defined in the Math package.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: How to import names from a dynamically required module
by choroba (Cardinal) on Oct 03, 2012 at 08:05 UTC | |
by tobyink (Canon) on Oct 03, 2012 at 08:59 UTC | |
by Anonymous Monk on Oct 03, 2012 at 08:55 UTC | |
by tobyink (Canon) on Oct 03, 2012 at 09:11 UTC |