Why not have the calling code pass a reference to its DATA handle instead?
#Used.pm package Used; use strict; 1; sub called { my $fh = shift; my $data = <$fh>; print "Used::called read: $data\n"; } #User.pl #!/usr/bin/perl -w use strict; use Used; Used::called(\*DATA); __DATA__ This is a test
BTW, is there a better way to pick up the DATA handle reference?
In reply to Re: Accessing the __DATA__ blocks of other packages
by pfaut
in thread Accessing the __DATA__ blocks of other packages
by caedes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |