| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/XPath/Variable.pm | ||||||||||
| 3 | ## Version v0.2.0 | ||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||
| 6 | ## Created 2021/12/05 | ||||||||||
| 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::XPath::Variable; | ||||||||||
| 15 | BEGIN | ||||||||||
| 16 | { | ||||||||||
| 17 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 14 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 14 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 14 | ▶ | use parent qw( Module::Generic ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 14 | ▶ | use vars qw( $DEBUG $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 14 | our $DEBUG = 0; | |||||||||
| 23 | 14 | our $VERSION = 'v0.2.0'; | |||||||||
| 24 | }; | ||||||||||
| 25 | |||||||||||
| 26 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 14 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | sub init | ||||||||||
| 30 | { | ||||||||||
| 31 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
init: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 32 | 0 | $self->{path_parser} = shift( @_ ); | |||||||||
| 33 | 0 | $self->{name} = shift( @_ ); | |||||||||
| 34 | 0 | $self->{_init_strict_use_sub} = 1; | |||||||||
| 35 | 0 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | return( $self ); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub as_string | ||||||||||
| 40 | { | ||||||||||
| 41 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 42 | 0 | return( '\$' . $self->{name} ); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub as_xml | ||||||||||
| 46 | { | ||||||||||
| 47 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
as_xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 0 | return( "<Variable>" . $self->{name} . "</Variable>\n" ); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | sub get_value | ||||||||||
| 52 | { | ||||||||||
| 53 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
get_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 54 | 0 | return( $self->{path_parser}->get_var( $self->{name} ) ); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub set_value | ||||||||||
| 58 | { | ||||||||||
| 59 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
set_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 60 | 0 | my $val = shift( @_ ); | |||||||||
| 61 | 0 | return( $self->{path_parser}->set_var( $self->{name} => $val ) ); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | sub evaluate | ||||||||||
| 65 | { | ||||||||||
| 66 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
evaluate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 67 | 0 | my $val = $self->get_value; | |||||||||
| 68 | 0 | return( $val ); | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 14 | 1; | |||||||||
| 72 | # NOTE: POD | ||||||||||
| 73 | __END__ | ||||||||||