| 1 | # vim: filetype=perl:noexpandtab:ts=3:sw=3 | ||||||||||||
| 2 | # | ||||||||||||
| 3 | # Copyright (C) 2009 NZ Registry Services | ||||||||||||
| 4 | # | ||||||||||||
| 5 | # This program is free software: you can redistribute it and/or modify | ||||||||||||
| 6 | # it under the terms of the Artistic License 2.0 or later. You should | ||||||||||||
| 7 | # have received a copy of the Artistic License the file COPYING.txt. | ||||||||||||
| 8 | # If not, see <http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||
| 9 | |||||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | package SRS::EPP::Response::Greeting; | ||||||||||||
| 14 | 1 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | extends 'SRS::EPP::Response'; | ||||||||||||
| 16 | |||||||||||||
| 17 | 1 | ▶ | use MooseX::TimestampTZ qw(gmtimestamptz); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | |||||||||||||
| 19 | has "+message" => | ||||||||||||
| 20 | lazy => 1, | ||||||||||||
| 21 | default => \&make_greeting, | ||||||||||||
| 22 | ; | ||||||||||||
| 23 | |||||||||||||
| 24 | has "+code" => | ||||||||||||
| 25 | required => 0, | ||||||||||||
| 26 | ; | ||||||||||||
| 27 | |||||||||||||
| 28 | sub make_greeting { | ||||||||||||
| 29 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
make_greeting: not called CC=9 SCAR=45.0
| |||||||||||||
| 30 | 0 | my $proxy = eval { SRS::EPP::Proxy->new }; | |||||||||||
| 31 | |||||||||||||
| 32 | # create the "Data Collection Policy" | ||||||||||||
| 33 | 0 | my $dcp = eval { $proxy->dcp }; | |||||||||||
| 34 | 0 | ▶ | my $access = $dcp ? $dcp->access : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | ▶ | $access ||= "personalAndOther"; | ||||||||||
|
Condition0%0/2
$access ||= "personalAndOther"
MC/DC0%0/1
$access ||= "personalAndOther"
$access
Truth table0%0/2
A
A= $access
| |||||||||||||
| 36 | 0 | ▶ | my $statements = $dcp ? $dcp->statements : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 0 | ▶ | $statements ||= []; | ||||||||||
|
Condition0%0/2
$statements ||= []
MC/DC0%0/1
$statements ||= []
$statements
Truth table0%0/2
A
A= $statements
| |||||||||||||
| 38 | 0 | ▶ | if ( !@$statements) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | # must have something... | ||||||||||||
| 40 | 0 | push @$statements, { | |||||||||||
| 41 | purpose => [ qw(admin prov) ], | ||||||||||||
| 42 | recipient => [ qw(ours) ], | ||||||||||||
| 43 | |||||||||||||
| 44 | retention => "business", | ||||||||||||
| 45 | }; | ||||||||||||
| 46 | } | ||||||||||||
| 47 | 0 | ▶ | my $expiry = $dcp ? $dcp->expiry : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 48 | |||||||||||||
| 49 | # let coerce rules do the magic here... | ||||||||||||
| 50 | 0 | ▶ | my $DCP = XML::EPP::DCP->new( | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | access => $access, | ||||||||||||
| 52 | statement => $statements, | ||||||||||||
| 53 | ( defined $expiry ? (expiry => $expiry) : () ), | ||||||||||||
| 54 | ); | ||||||||||||
| 55 | |||||||||||||
| 56 | return XML::EPP->new( | ||||||||||||
| 57 | message => XML::EPP::Greeting->new( | ||||||||||||
| 58 | 0 | ▶ | server_name => eval { $proxy->server_name } | ||||||||||
|
Condition0%0/2
eval { || 'localhost'
MC/DC0%0/1
eval {
do {
$proxy->server_name
}
} || 'localhost'
eval {
do {
$proxy->server_name
}
}
Truth table0%0/2
A
A= eval {
do {
$proxy->server_name
}
}
| |||||||||||||
| 59 | || "localhost", | ||||||||||||
| 60 | server_time => gmtimestamptz, | ||||||||||||
| 61 | services => "auto", | ||||||||||||
| 62 | dcp => $DCP, | ||||||||||||
| 63 | ), | ||||||||||||
| 64 | ); | ||||||||||||
| 65 | } | ||||||||||||
| 66 | |||||||||||||
| 67 | 1 | ▶ | no Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 68 | __PACKAGE__->meta->make_immutable; | ||||||||||||
| 69 | |||||||||||||
| 70 | 1; | ||||||||||||
| 71 | |||||||||||||
| 72 | __END__ | ||||||||||||
| 73 | |||||||||||||
| 74 | =head1 NAME | ||||||||||||
| 75 | |||||||||||||
| 76 | SRS::EPP::Message::Greeting - EPP XML Greeting message | ||||||||||||
| 77 | |||||||||||||
| 78 | =head1 SYNOPSIS | ||||||||||||
| 79 | |||||||||||||
| 80 | return SRS::EPP::Message::Greeting->new; | ||||||||||||
| 81 | |||||||||||||
| 82 | =head1 DESCRIPTION | ||||||||||||
| 83 | |||||||||||||
| 84 | This module handles generating the EPP XML greeting | ||||||||||||
| 85 | |||||||||||||
| 86 | =head1 SEE ALSO | ||||||||||||
| 87 | |||||||||||||
| 88 | L<SRS::EPP::Message> | ||||||||||||
| 89 | |||||||||||||
| 90 | =cut | ||||||||||||
| 91 | |||||||||||||
| 92 | # Local Variables: | ||||||||||||
| 93 | # mode:cperl | ||||||||||||
| 94 | # indent-tabs-mode: t | ||||||||||||
| 95 | # cperl-continued-statement-offset: 8 | ||||||||||||
| 96 | # cperl-brace-offset: 0 | ||||||||||||
| 97 | # cperl-close-paren-offset: 0 | ||||||||||||
| 98 | # cperl-continued-brace-offset: 0 | ||||||||||||
| 99 | # cperl-continued-statement-offset: 8 | ||||||||||||
| 100 | # cperl-extra-newline-before-brace: nil | ||||||||||||
| 101 | # cperl-indent-level: 8 | ||||||||||||
| 102 | # cperl-indent-parens-as-block: t | ||||||||||||
| 103 | # cperl-indent-wrt-brace: nil | ||||||||||||
| 104 | # cperl-label-offset: -8 | ||||||||||||
| 105 | # cperl-merge-trailing-else: t | ||||||||||||
| 106 | # End: | ||||||||||||