Boulder-Util
view release on metacpan or search on metacpan
lib/Boulder/Util.pm view on Meta::CPAN
# Borrowed from CGI so we don't have to load that package if
# we don't need to. Turns a string into a filehandle.
sub to_filehandle {
my $thingy = shift;
return undef unless $thingy;
return $thingy if UNIVERSAL::isa( $thingy, 'GLOB' );
return $thingy if UNIVERSAL::isa( $thingy, 'FileHandle' );
if ( !ref($thingy) ) {
my $caller = 1;
while ( my $package = caller( $caller++ ) ) {
my ($tmp) =
$thingy =~ /[\':]/
? $thingy
: "$package\:\:$thingy";
return $tmp if defined( fileno($tmp) );
}
}
return undef;
}
( run in 0.391 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )