| 1 | package AnyPAN::Storage::Directory; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Path::Tiny (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 1 | my ($class, %args) = @_; | |||||||||
| 10 | 1 | my $path = delete $args{path}; | |||||||||
| 11 | 1 | bless { | |||||||||
| 12 | path => Path::Tiny->new($path), | ||||||||||
| 13 | } => $class; | ||||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 4 | ▶ | sub copy { | ||||||||
|
Subroutine
copy: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | 4 | my ($self, $from_path, $save_key) = @_; | |||||||||
| 18 | 4 | my $save_path = $self->{path}->child($save_key); | |||||||||
| 19 | 4 | $save_path->parent->mkpath(); | |||||||||
| 20 | 4 | $from_path->copy($save_path); | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 3 | ▶ | sub exists :method { | ||||||||
|
Subroutine
exists: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 24 | 3 | my ($self, $save_key) = @_; | |||||||||
| 25 | 3 | my $save_path = $self->{path}->child($save_key); | |||||||||
| 26 | 3 | return $save_path->exists; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub fetch { | ||||||||
|
Subroutine
fetch: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 30 | 0 | my ($self, $save_key) = @_; | |||||||||
| 31 | 0 | my $save_path = $self->{path}->child($save_key); | |||||||||
| 32 | 0 | ▶ | return unless $save_path->exists; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | return $save_path; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | 1; | |||||||||
| 37 | __END__ | ||||||||||