File Coverage

lib/HTML/Object/DOM/Element/Time.pm
Criterion Covered Total %
statement 19 25 76.0
branch 0 4 0.0
condition n/a
subroutine 7 9 77.7
pod 2 2 100.0
total 28 40 70.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/DOM/Element/Time.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2022/01/09
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::Time;
15             BEGIN
16             {
17 1     1   942 use strict;
  1         3  
  1         31  
18 1     1   5 use warnings;
  1         2  
  1         28  
19 1     1   5 use parent qw( HTML::Object::DOM::Element );
  1         2  
  1         5  
20 1     1   72 use vars qw( $VERSION );
  1         2  
  1         54  
21 1     1   19 our $VERSION = 'v0.2.0';
22             };
23              
24 1     1   6 use strict;
  1         2  
  1         29  
25 1     1   8 use warnings;
  1         2  
  1         142  
26              
27             sub init
28             {
29 0     0 1   my $self = shift( @_ );
30 0           $self->{_init_strict_use_sub} = 1;
31 0 0         $self->SUPER::init( @_ ) || return( $self->pass_error );
32 0 0         $self->{tag} = 'time' if( !CORE::length( "$self->{tag}" ) );
33 0           return( $self );
34             }
35              
36             # Note: property dateTime
37 0     0 1   sub dateTime : lvalue { return( shift->_set_get_property( 'datetime', @_ ) ); }
38              
39             1;
40             # NOTE: POD
41             __END__
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             HTML::Object::DOM::Element::Time - HTML Object DOM Time Class
48              
49             =head1 SYNOPSIS
50              
51             use HTML::Object::DOM::Element::Time;
52             my $time = HTML::Object::DOM::Element::Time->new ||
53             die( HTML::Object::DOM::Element::Time->error, "\n" );
54              
55             =head1 VERSION
56              
57             v0.2.0
58              
59             =head1 DESCRIPTION
60              
61             This interface provides special properties (beyond the regular L<HTML::Object::DOM::Element> interface it also has available to it by inheritance) for manipulating <time> elements.
62              
63             =head1 INHERITANCE
64              
65             +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +----------------------------------+
66             | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Time |
67             +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +----------------------------------+
68              
69             =head1 PROPERTIES
70              
71             Inherits properties from its parent L<HTML::Object::DOM::Element>
72              
73             =head2 dateTime
74              
75             Is a string that reflects the datetime HTML attribute, containing a machine-readable form of the element's date and time value.
76              
77             Example:
78              
79             # Assumes there is <time id="t"> element in the HTML
80              
81             my $t = $doc->getElementById( 't' );
82             $t->dateTime = "6w 5h 34m 5s";
83              
84             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime>
85              
86             =head1 METHODS
87              
88             Inherits methods from its parent L<HTML::Object::DOM::Element>
89              
90             =head1 AUTHOR
91              
92             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
93              
94             =head1 SEE ALSO
95              
96             L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement>, L<Mozilla documentation on time element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time>
97              
98             =head1 COPYRIGHT & LICENSE
99              
100             Copyright(c) 2022 DEGUEST Pte. Ltd.
101              
102             All rights reserved
103              
104             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
105              
106             =cut