| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Link.pm | ||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2021/12/22 | ||||||||||||
| 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::Link; | ||||||||||||
| 15 | BEGIN | ||||||||||||
| 16 | 7 | ▶ | { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 7 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 7 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 7 | warnings::register_categories( 'HTML::Object' ); | |||||||||||
| 20 | 7 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 7 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 7 | ▶ | use HTML::Object::DOM::Element::Shared qw( :link ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | # There are a few properties and methods that are common to AnchorElement class, so | ||||||||||||
| 24 | # instead of re-writing them, we re-use those from AnchorElement. | ||||||||||||
| 25 | 7 | require HTML::Object::DOM::Element::Anchor; | |||||||||||
| 26 | 7 | our $VERSION = 'v0.2.0'; | |||||||||||
| 27 | }; | ||||||||||||
| 28 | |||||||||||||
| 29 | 7 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 30 | 7 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 31 | |||||||||||||
| 32 | sub init | ||||||||||||
| 33 | 21 | ▶ | { | ||||||||||
|
Subroutine
init: called CC=3 SCAR=16.2
Pod
documented
| |||||||||||||
| 34 | 21 | my $self = shift( @_ ); | |||||||||||
| 35 | 21 | $self->{_init_strict_use_sub} = 1; | |||||||||||
| 36 | 21 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 21 | ▶ | $self->{tag} = 'link' if( !CORE::length( "$self->{tag}" ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | $self->_set_get_internal_attribute_callback( rel => sub | ||||||||||||
| 39 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 40 | 0 | my( $this, $val ) = @_; | |||||||||||
| 41 | 0 | my $list; | |||||||||||
| 42 | 0 | ▶ | return if( !( $list = $this->{_rel_list} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | # $list->debug( $self->debug ); | ||||||||||||
| 44 | 0 | $list->update( $val ); | |||||||||||
| 45 | 21 | }); | |||||||||||
| 46 | $self->_set_get_internal_attribute_callback( sizes => sub | ||||||||||||
| 47 | 0 | ▶ | { | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 48 | 0 | my( $this, $val ) = @_; | |||||||||||
| 49 | 0 | my $list; | |||||||||||
| 50 | 0 | ▶ | return if( !( $list = $this->{_sizes_list} ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | # $list->debug( $self->debug ); | ||||||||||||
| 52 | 0 | $list->update( $val ); | |||||||||||
| 53 | 21 | }); | |||||||||||
| 54 | 21 | return( $self ); | |||||||||||
| 55 | } | ||||||||||||
| 56 | |||||||||||||
| 57 | # Note: property | ||||||||||||
| 58 | 0 | ▶ | sub as : lvalue { return( shift->_set_get_property( 'as', @_ ) ); } | ||||||||||
|
Subroutine
as: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 59 | |||||||||||||
| 60 | # Note: property crossOrigin inherited | ||||||||||||
| 61 | |||||||||||||
| 62 | # Note: property disabled inherited | ||||||||||||
| 63 | |||||||||||||
| 64 | # Note: property href inherited | ||||||||||||
| 65 | |||||||||||||
| 66 | # Note: property hreflang inherited | ||||||||||||
| 67 | |||||||||||||
| 68 | # Note: property | ||||||||||||
| 69 | 0 | ▶ | sub media : lvalue { return( shift->_set_get_property( 'media', @_ ) ); } | ||||||||||
|
Subroutine
media: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 70 | |||||||||||||
| 71 | # Note: property referrerPolicy inherited | ||||||||||||
| 72 | |||||||||||||
| 73 | # Note: property rel inherited | ||||||||||||
| 74 | |||||||||||||
| 75 | # Note: property relList inherited | ||||||||||||
| 76 | |||||||||||||
| 77 | # Note: property | ||||||||||||
| 78 | sub sizes | ||||||||||||
| 79 | 0 | ▶ | { | ||||||||||
|
Subroutine
sizes: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 80 | 0 | my $self = shift( @_ ); | |||||||||||
| 81 | 0 | ▶ | unless( $self->{_sizes_list} ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 82 | { | ||||||||||||
| 83 | 0 | my $sizes = $self->attr( 'sizes' ); | |||||||||||
| 84 | 0 | require HTML::Object::TokenList; | |||||||||||
| 85 | 0 | ▶ | $self->{_sizes_list} = HTML::Object::TokenList->new( $sizes, element => $self, attribute => 'sizes', debug => $self->debug ) || | ||||||||||
|
Condition0%0/2
'HTML::Object::TokenList'->new($sizes, 'element', $self, 'attribute', 'sizes', 'debug', $self->debug) || (return $self->pass_error('HTML::Object::TokenList'->error))
MC/DC0%0/1
'HTML::Object::TokenList'->new($sizes, 'element', $self, 'attribute', 'sizes', 'debug', $self->debug) || (return $self->pass_error('HTML::Object::TokenList'->error))
'HTML::Object::TokenList'->new($sizes, 'element', $self, 'attribute', 'sizes', 'debug', $self->debug)
Truth table0%0/2
A
A= 'HTML::Object::TokenList'->new($sizes, 'element', $self, 'attribute', 'sizes', 'debug', $self->debug)
| |||||||||||||
| 86 | return( $self->pass_error( HTML::Object::TokenList->error ) ); | ||||||||||||
| 87 | } | ||||||||||||
| 88 | 0 | return( $self->{_sizes_list} ); | |||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | # TODO: make call to this method return a CSS::Object | ||||||||||||
| 92 | # Note: property | ||||||||||||
| 93 | 0 | ▶ | sub sheet { return; } | ||||||||||
|
Subroutine
sheet: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 94 | |||||||||||||
| 95 | # Note: property type inherited | ||||||||||||
| 96 | |||||||||||||
| 97 | 7 | 1; | |||||||||||
| 98 | # NOTE: POD | ||||||||||||
| 99 | __END__ | ||||||||||||