ARGV-OrDATA
view release on metacpan or search on metacpan
lib/ARGV/OrDATA.pm view on Meta::CPAN
while (<>) {
print;
}
__DATA__
You'll see this if you don't redirect something to the script's
STDIN or you don't specify a filename on the command line.
=head1 DESCRIPTION
Tell your script it should use the DATA section if there's no input
coming from STDIN and there are no arguments.
You can also specify which package's DATA should be read instead of
the caller's:
use My::Module;
use ARGV::OrDATA 'My::Module';
while (<>) { # This reads from My/Module.pm's DATA section.
print;
}
To restore the old behaviour, you can call the C<unimport> method.
use ARGV::OrDATA;
my $from_data = <>;
@ARGV = 'file1.txt'; # Ignored.
( run in 1.338 second using v1.01-cache-2.11-cpan-39bf76dae61 )