%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/usr/local/share/man/man3/
Upload File :
Create Path :
Current File : //proc/self/root/usr/local/share/man/man3/Digest::MD5::File.3pm

.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "File 3"
.TH File 3 "2012-04-04" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Digest::MD5::File \- Perl extension for getting MD5 sums for files and urls.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use Digest::MD5::File qw(dir_md5_hex file_md5_hex url_md5_hex);
\&
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->addpath(\*(Aq/path/to/file\*(Aq);
\&    my $digest = $md5\->hexdigest;
\&
\&    my $digest = file_md5($file);
\&    my $digest = file_md5_hex($file);
\&    my $digest = file_md5_base64($file);
\&
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->addurl(\*(Aqhttp://www.tmbg.com/tour.html\*(Aq);
\&    my $digest = $md5\->hexdigest;
\&
\&    my $digest = url_md5($url);
\&    my $digest = url_md5_hex($url);
\&    my $digest = url_md5_base64($url);
\&  
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->adddir(\*(Aq/directory\*(Aq);
\&    my $digest = $md5\->hexdigest;
\&
\&    my $dir_hashref = dir_md5($dir);    
\&    my $dir_hashref = dir_md5_hex($dir);    
\&    my $dir_hashref = dir_md5_base64($dir);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.Vb 1
\&  Get MD5 sums for files of a given path or content of a given url.
.Ve
.SH "EXPORT"
.IX Header "EXPORT"
None by default.
You can export any file_* dir_*, or url_* function and anything Digest::MD5 can export.
.PP
.Vb 3
\&   use Digest::MD5::File qw(md5 md5_hex md5_base64); # 3 Digest::MD5 functions
\&   print md5_hex(\*(Aqabc123\*(Aq), "\en";
\&   print md5_base64(\*(Aqabc123\*(Aq), "\en";
.Ve
.SH "OBJECT METHODS"
.IX Header "OBJECT METHODS"
.SS "\fIaddpath()\fP"
.IX Subsection "addpath()"
.Vb 3
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->addpath(\*(Aq/path/to/file.txt\*(Aq) 
\&        or die "file.txt is not where you said: $!";
.Ve
.PP
or you can add multiple files by specifying an array ref of files:
.PP
.Vb 1
\&    $md5\->addpath(\e@files);
.Ve
.SS "\fIadddir()\fP"
.IX Subsection "adddir()"
\&\fIaddpath()\fRs each file in a directory recursively. Follows the same rules as the dir_* functions.
.PP
.Vb 3
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->adddir(\*(Aq/home/tmbg/\*(Aq) 
\&        or die "See warning above to see why I bailed: $!";
.Ve
.SS "\fIaddurl()\fP"
.IX Subsection "addurl()"
.Vb 3
\&    my $md5 = Digest::MD5\->new;
\&    $md5\->addurl(\*(Aqhttp://www.tmbg.com/tour.html\*(Aq)
\&        or die "They Must Be not on tour";
.Ve
.SH "file_* functions"
.IX Header "file_* functions"
Get the digest in variouse formats of \f(CW$file\fR.
If file does not exist or is a directory it croaks (See \s-1NOFATALS\s0 for more info)
.PP
.Vb 3
\&    my $digest = file_md5($file) or warn "$file failed: $!";
\&    my $digest = file_md5_hex($file) or warn "$file failed: $!";
\&    my $digest = file_md5_base64($file) or warn "$file failed: $!";
.Ve
.SH "dir_* functions"
.IX Header "dir_* functions"
Returns a hashref whose keys are files relative to the given path and the values are the \s-1MD5\s0 sum of the file or and empty string if a directory.
It recurses through the entire depth of the directory.
Symlinks to files are just \fIaddpath()\fRd and symlinks to directories are followed.
.PP
.Vb 3
\&    my $dir_hashref = dir_md5($dir) or warn "$dir failed: $!";
\&    my $dir_hashref = dir_md5_hex($dir) or warn "$dir failed: $!";
\&    my $dir_hashref = dir_md5_base64($dir) or warn "$dir failed: $!";
.Ve
.SH "url_* functions"
.IX Header "url_* functions"
Get the digest in various formats of the content at \f(CW$url\fR (Including, if \f(CW$url\fR points to directory, the directory listing content).
Returns undef if url fails (\s-1IE\s0 if LWP::UserAgent's \f(CW$res\fR\->is_success is false)
.PP
.Vb 3
\&    my $digest = url_md5($url) or warn "$url failed"; 
\&    my $digest = url_md5_hex($url) or warn "$url failed";
\&    my $digest = url_md5_base64($url) or warn "$url failed";
.Ve
.SH "SPECIAL SETTINGS"
.IX Header "SPECIAL SETTINGS"
.SS "\s-1BINMODE\s0"
.IX Subsection "BINMODE"
By default files are opened in binmode. If you do not want to do this you can unset it a variety of ways:
.PP
.Vb 1
\&    use Digest::MD5::File qw(\-nobin);
.Ve
.PP
or
.PP
.Vb 1
\&    $Digest::MD5::File::BINMODE = 0;
.Ve
.PP
or at the function/method level by specifying its value as the second argument:
.PP
.Vb 1
\&    $md5\->addpath($file,0);
\&
\&    my $digest = file_md5_hex($file,0);
.Ve
.SS "\s-1UTF8\s0"
.IX Subsection "UTF8"
In some cases you may want to have your data utf8 encoded, you can do this the following ways:
.PP
.Vb 1
\&    use Digest::MD5::File qw(\-utf8);
.Ve
.PP
or
.PP
.Vb 1
\&    $Digest::MD5::File::UTF8 = 1;
.Ve
.PP
or at the function/method level by specifying its value as the third argument for files and second for urls:
.PP
.Vb 1
\&    $md5\->addpath($file,$binmode,1);
\&
\&    my $digest = file_md5_hex($file,$binmode,1);
\&
\&    $md5\->addurl($url,1);
\&
\&    url_md5_hex($url,1);
.Ve
.PP
It use's Encode's \fIencode_utf8()\fR function to do the encoding. So if you do not have Encode (pre 5.7.3) this won't work :)
.SS "\s-1NOFATALS\s0"
.IX Subsection "NOFATALS"
Instead of croaking it will return undef if you set \s-1NOFATALS\s0 to true.
.PP
You can do this two ways:
.PP
.Vb 1
\&    $Digest::MD5::File::NOFATALS = 1;
.Ve
.PP
or the \-nofatals flag:
.PP
.Vb 1
\&    use Digest::MD5::File qw(\-nofatals);
\&
\&    my $digest = file_md5_hex($file) or die "$file failed";
.Ve
.PP
$! is not set so its not really helpful if you \fIdie()\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Digest::MD5, Encode, LWP::UserAgent
.SH "AUTHOR"
.IX Header "AUTHOR"
Daniel Muey, <http://drmuey.com/cpan_contact.pl>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright 2005 by Daniel Muey
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

Zerion Mini Shell 1.0