blib/lib/HTML/Object/DOM/Element/Track.pm untested

filter: Statementstmt 0.0% 0 / 52 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 7 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 91 CC 4 SCAR 13.6
CC
4
Cov
0%
track
12.0
init
6.0
BEGIN
2.0
CRAP 3.9
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 {
17 use strict;
18 use warnings;
19 warnings::register_categories( 'HTML::Object' );
20 use parent qw( HTML::Object::DOM::Element );
21 use vars qw( @EXPORT_OK %EXPORT_TAGS $VERSION );
22 use HTML::Object::DOM::Element::Shared qw( :track );
23 use constant {
24 # Indicates that the text track's cues have not been obtained.
25 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 };
33 our @EXPORT_OK = qw( NONE LOADING LOADED ERROR );
34 our %EXPORT_TAGS = (
35 all => [qw( NONE LOADING LOADED ERROR )],
36 );
37 our $VERSION = 'v0.2.0';
38 };
39  
40 use strict;
41 use warnings;
42  
43 sub init
44 {
45 my $self = shift( @_ );
46 $self->{_init_strict_use_sub} = 1;
47 $self->SUPER::init( @_ ) || return( $self->pass_error );
48 $self->{tag} = 'track' if( !CORE::length( "$self->{tag}" ) );
49 return( $self );
50 }
51  
52 # Note: property default
53 sub default : lvalue { return( shift->_set_get_property( { attribute => 'default', is_boolean => 1 }, @_ ) ); }
54  
55 # Note: property kind
56 sub kind : lvalue { return( shift->_set_get_property( 'kind', @_ ) ); }
57  
58 # Note: property label
59 sub label : lvalue { return( shift->_set_get_property( 'label', @_ ) ); }
60  
61 sub oncuechange : lvalue { return( shift->on( 'cuechange', @_ ) ); }
62  
63 # Note: property readyState read-only
64 sub readyState : lvalue { return( shift->_set_get_number( 'readystate', @_ ) ); }
65  
66 # Note: property src is inherited
67  
68 # Note: property srclang
69 sub srclang : lvalue { return( shift->_set_get_property( 'srclang', @_ ) ); }
70  
71 # Note: property track read-only
72 sub track
73 {
74 my $self = shift( @_ );
75 return( $self->{track} ) if( defined( $self->{track} ) && ref( $self->{track} ) );
76 $self->_load_class( 'HTML::Object::DOM::TextTrack' ) || return( $self->pass_error );
77 my $kind = $self->kind;
78 my $label = $self->label;
79 my $lang = $self->srclang;
80 my $track = HTML::Object::DOM::TextTrack->new( $kind, $label, $lang,
81 {
82 id => $self->id,
83 debug => $self->debug,
84 });
85 return( $self->pass_error( HTML::Object::DOM::TextTrack->error ) ) if( !defined( $track ) );
86 $track->parent( $self );
87 return( $self->{track} = $track );
88 }
89  
90 1;
91 # NOTE: POD
92 __END__