| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Track.pm | ||||||||||||||||||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||
| 6 | ## Created 2021/12/23 | ||||||||||||||||||||||||||||
| 7 | ## Modified 2022/09/18 | ||||||||||||||||||||||||||||
| 8 | ## All rights reserved. | ||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||
| 10 | ## | ||||||||||||||||||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 14 | package HTML::Object::DOM::Element::Track; | ||||||||||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||||||||||
| 16 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | warnings::register_categories( 'HTML::Object' ); | |||||||||||||||||||||||||||
| 20 | 1 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use vars qw( @EXPORT_OK %EXPORT_TAGS $VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use HTML::Object::DOM::Element::Shared qw( :track ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | # Indicates that the text track's cues have not been obtained. | ||||||||||||||||||||||||||||
| 25 | 1 | NONE => 0, | |||||||||||||||||||||||||||
| 26 | # Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track by the parser. | ||||||||||||||||||||||||||||
| 27 | LOADING => 1, | ||||||||||||||||||||||||||||
| 28 | # Indicates that the text track has been loaded with no fatal errors. | ||||||||||||||||||||||||||||
| 29 | LOADED => 2, | ||||||||||||||||||||||||||||
| 30 | # Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way. Some or all of the cues are likely missing and will not be obtained. | ||||||||||||||||||||||||||||
| 31 | ERROR => 3, | ||||||||||||||||||||||||||||
| 32 | 1 | }; | |||||||||||||||||||||||||||
| 33 | 1 | our @EXPORT_OK = qw( NONE LOADING LOADED ERROR ); | |||||||||||||||||||||||||||
| 34 | 1 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||
| 35 | all => [qw( NONE LOADING LOADED ERROR )], | ||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||
| 37 | 1 | our $VERSION = 'v0.2.0'; | |||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub init | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 46 | 0 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $self->{tag} = 'track' if( !CORE::length( "$self->{tag}" ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | return( $self ); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | # Note: property default | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub default : lvalue { return( shift->_set_get_property( { attribute => 'default', is_boolean => 1 }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
default: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | # Note: property kind | ||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub kind : lvalue { return( shift->_set_get_property( 'kind', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
kind: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # Note: property label | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub label : lvalue { return( shift->_set_get_property( 'label', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
label: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub oncuechange : lvalue { return( shift->on( 'cuechange', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
oncuechange: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # Note: property readyState read-only | ||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub readyState : lvalue { return( shift->_set_get_number( 'readystate', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
readyState: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # Note: property src is inherited | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | # Note: property srclang | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub srclang : lvalue { return( shift->_set_get_property( 'srclang', @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
srclang: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | # Note: property track read-only | ||||||||||||||||||||||||||||
| 72 | sub track | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
track: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | return( $self->{track} ) if( defined( $self->{track} ) && ref( $self->{track} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"track"} and ref $self->{"track"}
MC/DC0%0/2
defined $self->{"track"} and ref $self->{"track"}
defined $self->{"track"}
ref $self->{"track"}
Truth table0%0/3
A and B
A= defined $self->{"track"}B= ref $self->{"track"}
| |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $self->_load_class( 'HTML::Object::DOM::TextTrack' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | my $kind = $self->kind; | |||||||||||||||||||||||||||
| 78 | 0 | my $label = $self->label; | |||||||||||||||||||||||||||
| 79 | 0 | my $lang = $self->srclang; | |||||||||||||||||||||||||||
| 80 | 0 | my $track = HTML::Object::DOM::TextTrack->new( $kind, $label, $lang, | |||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | id => $self->id, | ||||||||||||||||||||||||||||
| 83 | debug => $self->debug, | ||||||||||||||||||||||||||||
| 84 | }); | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return( $self->pass_error( HTML::Object::DOM::TextTrack->error ) ) if( !defined( $track ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 0 | $track->parent( $self ); | |||||||||||||||||||||||||||
| 87 | 0 | return( $self->{track} = $track ); | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 1 | 1; | |||||||||||||||||||||||||||
| 91 | # NOTE: POD | ||||||||||||||||||||||||||||
| 92 | __END__ | ||||||||||||||||||||||||||||