| 1 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | # Copyright (C) 2015 Christian Garbs <mitch@cgarbs.de> | ||||||||||
| 4 | # Licensed under GNU GPL v2 or later. | ||||||||||
| 5 | |||||||||||
| 6 | package Net::Fritz::Action; | ||||||||||
| 7 | # ABSTRACT: represents a TR064 action | ||||||||||
| 8 | 6 | $Net::Fritz::Action::VERSION = 'v0.0.2'; | |||||||||
| 9 | |||||||||||
| 10 | 6 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 6 | with 'Net::Fritz::IsNoError'; | |||||||||
| 13 | |||||||||||
| 14 | |||||||||||
| 15 | 6 | has xmltree => ( is => 'ro' ); | |||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | 6 | has name => ( is => 'lazy', init_arg => undef ); | |||||||||
| 19 | |||||||||||
| 20 | sub _build_name { | ||||||||||
| 21 | 4 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_name: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 4 | return $self->xmltree->{name}->[0]; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 6 | has args_in => ( is => 'lazy', init_arg => undef ); | |||||||||
| 27 | |||||||||||
| 28 | sub _build_args_in { | ||||||||||
| 29 | 14 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_args_in: called CC=3 SCAR=11.0
| |||||||||||
| 30 | 14 | my @args; | |||||||||
| 31 | |||||||||||
| 32 | # TODO convert to grep | ||||||||||
| 33 | 14 | foreach my $arg (@{$self->xmltree->{argumentList}->[0]->{argument}}) { | |||||||||
| 34 | 31 | ▶ | if ($arg->{direction}->[0] eq 'in') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 17 | push @args, $arg->{name}->[0]; | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 14 | return \@args; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 6 | has args_out => ( is => 'lazy', init_arg => undef ); | |||||||||
| 44 | |||||||||||
| 45 | sub _build_args_out { | ||||||||||
| 46 | 8 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_args_out: called CC=3 SCAR=11.0
| |||||||||||
| 47 | 8 | my @args; | |||||||||
| 48 | |||||||||||
| 49 | # TODO convert to grep | ||||||||||
| 50 | 8 | foreach my $arg (@{$self->xmltree->{argumentList}->[0]->{argument}}) { | |||||||||
| 51 | 19 | ▶ | if ($arg->{direction}->[0] eq 'out') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 8 | push @args, $arg->{name}->[0]; | |||||||||
| 53 | } | ||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 8 | return \@args; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | sub BUILDARGS { | ||||||||||
| 61 | 22 | ▶ | my ( $class, @args ) = @_; | ||||||||
|
Subroutine
BUILDARGS: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | |||||||||||
| 63 | 22 | ▶ | unshift @args, "xmltree" if @args % 2 == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | 22 | return { @args }; | |||||||||
| 66 | }; | ||||||||||
| 67 | |||||||||||
| 68 | |||||||||||
| 69 | sub dump { | ||||||||||
| 70 | 3 | ▶ | my $self = shift; | ||||||||
|
Subroutine
dump: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 71 | |||||||||||
| 72 | 3 | my $indent = shift; | |||||||||
| 73 | 3 | ▶ | $indent = '' unless defined $indent; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | |||||||||||
| 75 | 3 | my $text = "${indent}Net::Fritz::Action:\n"; | |||||||||
| 76 | 3 | $indent .= ' '; | |||||||||
| 77 | 3 | $text .= "${indent}name = " . $self->name . "\n"; | |||||||||
| 78 | 3 | $text .= "${indent}args_in = " . join(', ', @{$self->args_in}) . "\n"; | |||||||||
| 79 | 3 | $text .= "${indent}args_out = " . join(', ', @{$self->args_out}) . "\n"; | |||||||||
| 80 | |||||||||||
| 81 | 3 | return $text; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | |||||||||||
| 85 | 6 | 1; | |||||||||
| 86 | |||||||||||
| 87 | __END__ | ||||||||||