in reply to include file "inline"
do works, to a point, as does require. However, neither will let inline code see the surrounding scope. The only way to do this is with a fairly risky eval:
use File::Slurp; #!important! my $blah = new SOME::Module; $blah->start; eval read_file('guts.pl'); $blah->end;
This is not recommended, partly because it's slow. Eval can be risky, too, so read up on it before choosing something.
It's easy to build modules, so I strongly recommend that as an alternative course of action.
|
---|