Posterous/Media/Local.pm

filter: Statementstmt 50.0% 14 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 2 / 2 totaltotal 46.5% 20 / 43 CC 4 SCAR 16.9
CC
4
Cov
41%
file
12.0
new
6.0
_to_params
2.0
CRAP 5.4
« Posterous/Object.pm ↑ Summary Posterous/Comment.pm »
1 package Net::Posterous::Media::Local;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw(Net::Posterous::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Class::Accessor "antlers";
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use URI::file;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Net::Posterous::Media::Local - represent local media files
11  
12 =head1 METHODS
13  
14 =cut
15  
16 =head2 new
17  
18 Create a new local file
19  
20 =cut
21  
22 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
23 0 my $class = shift;
24 0 my %opts = @_;
25 0 my $file = delete $opts{file};
26 0 my $self = bless \%opts, $class;
27 0 ▶ $self->file($file) if $file;
Branch: 1 branch
BranchTrueFalseTotal
if $file 0 0 0
28 0 return $self;
29 }
30  
31 =head2 url
32  
33 Get or set the url to this local media files
34  
35 =cut
36  
37 2 has url => ( is => "rw", isa => "Str" );
38  
39 =head2 file
40  
41 Get or set the path to this file.
42  
43 =cut
44 0 ▶sub file {
Subroutine file: not called CC=3 SCAR=24.8
Pod documented
45 0 my $self = shift;
46 # keep url() in sync
47 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
48 0 $self->url("".URI::file->new(shift));
49 }
50 0 my $uri = URI->new($self->url);
51 0 ▶ return undef unless 'file' eq $uri->scheme;
Branch: 1 branch
BranchTrueFalseTotal
unless "file" eq $uri->scheme 0 0 0
52 0 return $uri->path;
53 }
54  
55 0 ▶sub _to_params {
Subroutine _to_params: not called CC=1 SCAR=6.9
56 0 my $self = shift;
57 0 return { type => 'local', url => $self->url };
58 }
59 2 1;
« Posterous/Object.pm ↑ Summary Posterous/Comment.pm »