in reply to Re^6: writing a pragma
in thread writing a pragma
sure its possible, but such a thing shouldn't be a pragma :) see caller and open and import and splice and zentara package/module tutorial....
use NotAPragma; ...
NotAPragma.pm
package NotAPragma; sub import { my ($package, $filename, $line) = caller; open my($infh), '<:raw', $filename or die "Can't open caller $filename : $!"; my @lines = ( 'pad', readline $infh ); close $infh; splice @lines, 0, $line; print "@lines\n"; ## << this is the ... after use NotAPragma; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: writing a pragma
by karthikasasanka (Acolyte) on Apr 28, 2014 at 09:17 UTC | |
by Anonymous Monk on Apr 28, 2014 at 09:53 UTC | |
by karthikasasanka (Acolyte) on May 06, 2014 at 05:01 UTC |