MYDan
view release on metacpan or search on metacpan
dan/agent/argv/dump view on Meta::CPAN
#!# perl: agent/argv/xdump
use strict;
use warnings;
use Cwd;
use Getopt::Long;
use MYDan::Util::FastMD5;
return sub
{
local $/;
my ( $file, %o ) = shift;
return [ %o ] unless $file && -f $file;
%o = ( path => $file =~ /^\// ? $file : Cwd::abs_path( $file ) );
Getopt::Long::GetOptionsFromArray( \@_, \%o, qw( path=s chmod=s chown=s cc ) );
if( delete $o{cc} )
{
my ( $uid, $mode ) = ( stat $file )[ 4, 2 ];
$o{chmod} ||= $mode = sprintf( "%04o", $mode & 07777 );
$o{chown} ||= ( getpwuid($uid) )[0];
}
$o{md5} = MYDan::Util::FastMD5->hexdigest( $file );
$ENV{MYDanExtractFile} = $file;
$ENV{MYDanExtractFileAim} = $o{path};
return \%o;
};
( run in 2.409 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )