in reply to Accessing the __DATA__ blocks of other packages
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Accessing the __DATA__ blocks of other packages
by caedes (Pilgrim) on Dec 11, 2002 at 22:19 UTC | |
by pfaut (Priest) on Dec 11, 2002 at 22:39 UTC |