Profile/Media.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
get_profile_url
2.0
get_type_from_uri
2.0
get_urn
2.0
CRAP 2.0
1 package Net::PMP::Profile::Media;
2 use Moose;
3 extends 'Net::PMP::Profile';
4 use Net::PMP::Profile::MediaEnclosure;
5 use Media::Type::Simple;
6 use Try::Tiny;
7  
8 our $VERSION = '0.102';
9  
10 has 'enclosure' => (
11 is => 'rw',
12 isa => 'Net::PMP::Type::MediaEnclosures',
13 required => 1,
14 coerce => 1,
15 );
16  
17 sub get_profile_url {'https://api.pmp.io/profiles/media'}
18  
19 sub get_type_from_uri {
20 my $self = shift;
21 my $uri = shift or confess "uri required";
22 $uri =~ s/\?.*//;
23 $uri =~ s/.+\.(\w+)$/$1/;
24 my $type = try {
25 type_from_ext( lc $uri );
26 }
27 catch {
28 confess $_; # re-throw with full stack trace
29 };
30 return $type;
31 }
32  
33 sub get_urn {
34 my $self = shift;
35 ( my $profile_name = $self->get_profile_url ) =~ s,^.+/,,;
36 return 'urn:collectiondoc:' . $profile_name;
37 }
38  
39 __PACKAGE__->meta->make_immutable();
40  
41 1;
42  
43 __END__