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

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 2 SCAR 10.6
CC
2
Cov
0%
init
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.9
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 use strict;
18 use warnings;
19 warnings::register_categories( 'HTML::Object' );
20 use parent qw( HTML::Object::DOM::Element::Media );
21 use vars qw( $VERSION );
22 our $VERSION = 'v0.2.0';
23 };
24  
25 use strict;
26 use warnings;
27  
28 sub init
29 {
30 my $self = shift( @_ );
31 $self->{_init_strict_use_sub} = 1;
32 $self->SUPER::init( @_ ) || return( $self->pass_error );
33 $self->{tag} = 'audio' if( !CORE::length( "$self->{tag}" ) );
34 return( $self );
35 }
36  
37 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