lib/HTML/Object/DOM/Element/Audio.pm

filter: Statementstmt 80.7% 21 / 26 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 74.3% 29 / 39 CC 3 SCAR 14.6
CC
3
Cov
70%
init
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
« blib/lib/HTML/Object/DOM/AudioTrack.pm ↑ Summary lib/HTML/Object/DOM/Element/Picture.pm »
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/DOM/Element/Audio.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::Audio;
15 BEGIN
16 {
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' );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶ use parent qw( HTML::Object::DOM::Element::Media );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 our $VERSION = 'v0.2.0';
23 };
24  
25 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub init
29 {
30 0 ▶ my $self = shift( @_ );
Subroutine init: not called CC=3 SCAR=24.8
Pod documented
31 0 $self->{_init_strict_use_sub} = 1;
32 0 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 0 0
33 0 ▶ $self->{tag} = 'audio' if( !CORE::length( "$self->{tag}" ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length qq[$self->{"tag"}] 0 0 0
34 0 return( $self );
35 }
36  
37 1 1;
38 # NOTE: POD
39 __END__
40  
41 =encoding utf-8
42  
43 =head1 NAME
44  
45 HTML::Object::DOM::Element::Audio - HTML Object DOM Audio Class
46  
47 =head1 SYNOPSIS
48  
49 use HTML::Object::DOM::Element::Audio;
50 my $audio = HTML::Object::DOM::Element::Audio->new ||
51 die( HTML::Object::DOM::Element::Audio->error, "\n" );
52  
53 <h2>Audio inserted with JavaScript</h2>
54 <div id="myAudio"></div>
55  
56 my $div = document.getElementById( 'myAudio' );
57 # Create an element <audio>
58 my $audio = document.createElement('audio');
59 # Set the attributes of the video
60 $audio->src = 'https://example.org/some/where/audio/audio.ogg';
61 $audio->controls = 1; # true
62 # Add the aido to <div>
63 $div->appendChild( $audio );
64  
65 Result:
66  
67 <h2>Audio inserted with JavaScript</h2>
68 <div id="myAudio"></div>
69 <audio src="https://example.org/some/where/audio/audio.ogg" controls=""></audio>
70 </div>
71  
72 =head1 VERSION
73  
74 v0.2.0
75  
76 =head1 DESCRIPTION
77  
78 This interface provides access to the properties of <audio> elements, as well as methods to manipulate them.
79  
80 =head1 INHERITANCE
81  
82 +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+ +-----------------------------------+
83 | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Media | --> | HTML::Object::DOM::Element::Audio |
84 +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+ +-----------------------------------+
85  
86 =head1 PROPERTIES
87  
88 Inherits properties from its parent L<HTML::Object::DOM::Element::Media>
89  
90 =head1 METHODS
91  
92 Inherits methods from its parent L<HTML::Object::DOM::Element::Media>
93  
94 =head1 AUTHOR
95  
96 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
97  
98 =head1 SEE ALSO
99  
100 L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement>, L<Mozilla documentation on audio element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio>, L<Wikipedia on audio file formats|https://en.wikipedia.org/wiki/Audio_file_format>
101  
102 =head1 COPYRIGHT & LICENSE
103  
104 Copyright(c) 2021 DEGUEST Pte. Ltd.
105  
106 All rights reserved
107  
108 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
109  
110 =cut
« blib/lib/HTML/Object/DOM/AudioTrack.pm ↑ Summary lib/HTML/Object/DOM/Element/Picture.pm »