| lib/Perlmazing/Perlmazing/md5_file.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 12 | 12 | 100.0 |
| branch | 2 | 4 | 50.0 |
| condition | n/a | ||
| subroutine | 3 | 3 | 100.0 |
| pod | 0 | 1 | 0.0 |
| total | 17 | 20 | 85.0 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 10 | use Perlmazing; | |||
| 1 | 2 | ||||||
| 1 | 6 | ||||||
| 2 | 1 | 1 | 8 | use Digest::MD5; | |||
| 1 | 12 | ||||||
| 1 | 149 | ||||||
| 3 | |||||||
| 4 | sub main { | ||||||
| 5 | 2 | 2 | 0 | 6 | my $file = shift; | ||
| 6 | 2 | 50 | 5 | croak "This function requires a file name as argument." unless defined $file; | |||
| 7 | 2 | 50 | 40 | croak "File '$file' is not a valid file or cannot be read." unless -f $file; | |||
| 8 | 2 | 16 | my $ctx = Digest::MD5->new; | ||||
| 9 | 2 | 8 | $ctx->add(slurp $file); | ||||
| 10 | 2 | 24 | $ctx->hexdigest; | ||||
| 11 | } | ||||||
| 12 | |||||||
| 13 | 1; |