| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Posterous::Media::Local; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use base qw(Net::Posterous::Object); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
65
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Class::Accessor "antlers"; |
|
|
1
|
|
|
|
|
21
|
|
|
|
1
|
|
|
|
|
6
|
|
|
6
|
1
|
|
|
1
|
|
900
|
use URI::file; |
|
|
1
|
|
|
|
|
7592
|
|
|
|
1
|
|
|
|
|
228
|
|
|
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
|
|
|
|
|
|
|
sub new { |
|
23
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
24
|
0
|
|
|
|
|
|
my %opts = @_; |
|
25
|
0
|
|
|
|
|
|
my $file = delete $opts{file}; |
|
26
|
0
|
|
|
|
|
|
my $self = bless \%opts, $class; |
|
27
|
0
|
0
|
|
|
|
|
$self->file($file) if $file; |
|
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
|
|
|
|
|
|
|
has url => ( is => "rw", isa => "Str" ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 file |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Get or set the path to this file. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
sub file { |
|
45
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
# keep url() in sync |
|
47
|
0
|
0
|
|
|
|
|
if (@_) { |
|
48
|
0
|
|
|
|
|
|
$self->url("".URI::file->new(shift)); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
|
|
|
|
|
my $uri = URI->new($self->url); |
|
51
|
0
|
0
|
|
|
|
|
return undef unless 'file' eq $uri->scheme; |
|
52
|
0
|
|
|
|
|
|
return $uri->path; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _to_params { |
|
56
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
57
|
0
|
|
|
|
|
|
return { type => 'local', url => $self->url }; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
1; |