<commit_before>package Net::PMP::Profile::Media;
use Mouse;
extends 'Net::PMP::Profile';
use Net::PMP::Profile::MediaEnclosure;
use Media::Type::Simple;

our $VERSION = '0.001';

has 'enclosure' => (
    is       => 'rw',
    isa      => 'Net::PMP::Type::MediaEnclosures',
    required => 1,
    coerce   => 1,
);

sub get_profile_url {'https://api.pmp.io/profiles/media'}

sub get_type_from_uri {
    my $self = shift;
    my $uri = shift or confess "uri required";
    $uri =~ s/\?.*//;
    $uri =~ s/.+\.(\w+)$/$1/;
    return type_from_ext($uri);
}

1;

__END__

=head1 NAME

Net::PMP::Profile::Media - Rich Media Profile for PMP CollectionDoc

=head1 SYNOPSIS

 use Net::PMP;
 use Net::PMP::Profile::Media;
 
 my $media = Net::PMP::Profile::Media->new(
     title     => 'I am A Title',
     published => '2013-12-03T12:34:56.789Z',
     valid     => {<commit_msg>catch media simple exceptions and re-throw with full stacktrace<commit_after>package Net::PMP::Profile::Media;
use Mouse;
extends 'Net::PMP::Profile';
use Net::PMP::Profile::MediaEnclosure;
use Media::Type::Simple;

our $VERSION = '0.001';

has 'enclosure' => (
    is       => 'rw',
    isa      => 'Net::PMP::Type::MediaEnclosures',
    required => 1,
    coerce   => 1,
);

sub get_profile_url {'https://api.pmp.io/profiles/media'}

sub get_type_from_uri {
    my $self = shift;
    my $uri = shift or confess "uri required";
    $uri =~ s/\?.*//;
    $uri =~ s/.+\.(\w+)$/$1/;
    my $type;
    eval { $type = type_from_ext($uri); };
    if ( $@ or !$type ) {
        confess $@;    # re-throw with full stack trace
    }
    return $type;
}

1;

__END__

=head1 NAME

Net::PMP::Profile::Media - Rich Media Profile for PMP CollectionDoc

=head1 SYNOPSIS

 use Net::PMP;
 use Net::PMP::Profile::Media;
 
 my $media = Net::PMP::Profile::Media->new(
     title     => 'I am A Title',
     published => '2013-12-03T12:34:56.789Z',
     valid     => {
{'fraction_non_alphanumeric': 0.18603439291297552, 'fraction_numerical': 0.028139656070870246, 'mean_word_length': 3.1201716738197427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3193494', 'n_tokens_mistral': 755, 'n_tokens_neox': 715, 'n_words': 166}