in reply to if only blocks were avoidable...
According to that documentation, you should be able to do:
inside the block where you want the use bytes to be conditionally set. Of course, if you don't put it in a block, the file in which the source sits, will be your scope.BEGIN { require bytes; bytes->import if $condition }
This seems the right thing according to the docs and seems to work with stricture:
If the import is not done, this runs without any errors:$foo = $a; BEGIN { require strict; strict->import if 1 } $foo = $a; __END__ Variable "$foo" is not imported at x line 3. Global symbol "$foo" requires explicit package name at x line 3. x had compilation errors.
$foo = $a; BEGIN { require strict; strict->import if 0 } $foo = $a; __END__
Hope this made sense and helps.
Liz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: if only blocks were avoidable...
by yosefm (Friar) on Sep 22, 2003 at 11:07 UTC | |
by liz (Monsignor) on Sep 22, 2003 at 13:56 UTC | |
by yosefm (Friar) on Sep 22, 2003 at 15:30 UTC | |
by tye (Sage) on Sep 23, 2003 at 16:52 UTC | |
by yosefm (Friar) on Sep 23, 2003 at 20:36 UTC | |
|
Re: Re: if only blocks were avoidable...
by yosefm (Friar) on Sep 22, 2003 at 09:22 UTC | |
by Anonymous Monk on Sep 22, 2003 at 10:22 UTC |