in reply to Re^2: When is "use module" not the same as require+import?
in thread When is "use module" not the same as require+import?
works just fine for me. It may fairly be argued that this is not much different from putting a require and import inside the BEGIN, though.BEGIN { my @fields = qw/field1 field2/; use fields @fields; } my $self = fields::new; $self->{field1} = 'value1';
UPDATE: ikegami correctly points out that I must not have tested what I thought I tested, because this code doesn't work. Sorry. I think Bloodnok's solution (adapted to use fields) works, though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: When is "use module" not the same as require+import?
by ikegami (Patriarch) on Sep 19, 2008 at 19:20 UTC |