App-Easer
view release on metacpan or search on metacpan
lib/App/Easer/V2.pm view on Meta::CPAN
if ($refch eq 'GLOB') {
$fh = $channel;
}
elsif ($refch eq 'SCALAR') {
open $fh, '>', $channel or die "open(): $!\n";
}
elsif ($refch) {
die 'invalid channel';
}
else {
($channel, my $binmode) = split m{:}mxs, $channel, 2;
if ($channel eq '-' || lc($channel) eq '-stdout') {
$fh = \*STDOUT;
}
elsif (lc($channel) eq '-stderr') {
$fh = \*STDERR;
}
else {
open $fh, '>', $channel or die "open('$channel'): $!\n";
}
binmode $fh, $binmode if length($binmode // '');
}
return sub ($cmd, @stuff) {
print {$fh} @stuff;
return $cmd;
}
}
sub printout ($self, @stuff) {
my $pof = $self->_rw;
lib/App/Easer/V2.pod view on Meta::CPAN
=item *
a filehandle, used to print out stuff
=item *
a reference to a scalar, where the output will be placed
=item *
a string of the form C<filename[:binmode]>, where C<filename> can B<NOT>
contain the character C<:>. The file will be opened and if the
C<binmode> part is provided, C<binmode()> will be called on the
resulting filehandle with the provided value.
If the C<filename> part is C<-> or C<-stdout> (case insensitive), then
C<STDOUT> will be used. If C<filename> is C<-stderr> (case insensitive),
then C<STDERR> will be used.
=back
=item C<name>
t/author-pod-version.t view on Meta::CPAN
(my $packfile = "$module.pm") =~ s{::}{/}gmxs;
require $packfile;
(my $filename = $INC{$packfile}) =~ s{pm$}{pod};
my $pod_version;
{
open my $fh, '<', $filename
or BAIL_OUT "can't open '$filename'";
binmode $fh, ':raw';
local $/;
my $module_text = <$fh>;
($pod_version) = $module_text =~ m{
^This\ document\ describes\ $module\ version\ (.*?)\.$
}mxs;
}
my $version;
{
no strict 'refs';
( run in 0.336 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )