blib/lib/POE/Filter/Ls.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 1 | 3 | 33.3 |
branch | n/a | ||
condition | n/a | ||
subroutine | 1 | 1 | 100.0 |
pod | n/a | ||
total | 2 | 4 | 50.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package POE::Filter::Ls; | ||||||
2 | |||||||
3 | 1 | 1 | 11183 | use POE::Filter::Line; | |||
0 | |||||||
0 | |||||||
4 | |||||||
5 | $VERSION = 0.01; | ||||||
6 | |||||||
7 | sub new { | ||||||
8 | my $class = shift; | ||||||
9 | |||||||
10 | return bless [ new POE::Filter::Line( Literal => "\015\012" ) ], | ||||||
11 | ref($class)||$class; | ||||||
12 | } | ||||||
13 | |||||||
14 | sub put { | ||||||
15 | my ($self, $lines) = @_; | ||||||
16 | return $self->[0]->put($lines); | ||||||
17 | } | ||||||
18 | |||||||
19 | sub get { | ||||||
20 | my ($self, $lines) = @_; | ||||||
21 | |||||||
22 | return [ map { | ||||||
23 | my %info; | ||||||
24 | if (/^(.|-)(.{9})\s+(\d+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\w{3}\s+\d+\s+\d+:\d+)\s+(.*?)(?:\s+->\s+(.*))?$/) { | ||||||
25 | @info{"type","perms","links","owner","group","size","date","filename","link"} = ($1, $2, $3, $4, $5, $6, $7, $8, $9); | ||||||
26 | } | ||||||
27 | \%info; | ||||||
28 | } @{ $self->[0]->get($lines) } ]; | ||||||
29 | } | ||||||
30 | |||||||
31 | 1; | ||||||
32 | |||||||
33 | __END__ |