| 1 | # Net::SDEE::Subscription.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Id: Subscription.pm,v 1.1 2004/12/23 12:02:30 jminieri Exp $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Copyright (c) 2004 Joe Minieri <jminieri@mindspring.com> and OpenService (www.open.com). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # This program is free software; you can redistribute it and/or modify it under the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | package Net::SDEE::Subscription; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use 5.006001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | require Net::SDEE::Common; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our @ISA = qw/Net::SDEE::Common/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ########################################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # Non-generic get/set methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
action: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my ($self, $action) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | unless(defined($action)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # if no parameter, the treat as "get" method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | return $self->{ 'action' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $self->error(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $self->errorString(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $action = lc($action); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if($action eq 'open' or $action eq 'get' or $action eq 'cancel' or $action eq 'close' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$action eq "open" or $action eq "get" or $action eq "cancel" or $action eq "close"
$action eq "open" or $action eq "get" or $action eq "cancel"
$action eq "open" or $action eq "get"
MC/DC0%0/4
$action eq "open" or $action eq "get" or $action eq "cancel" or $action eq "close"
$action eq "open"
$action eq "get"
$action eq "cancel"
$action eq "close"
Truth table0%0/5
A or B or C or D
A= $action eq "open"B= $action eq "get"C= $action eq "cancel"D= $action eq "close"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | return $self->{ 'action' } = $action; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->error(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->errorString("Invalid action value: $action"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub confirm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
confirm: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my ($self, $confirm) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | unless(defined($confirm)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # if no parameter, the treat as "get" method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | return $self->{ 'confirm' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $self->error(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->errorString(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $confirm = lc($confirm); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if($confirm eq 'no' or $confirm eq 'yes') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$confirm eq "no" or $confirm eq "yes"
MC/DC0%0/2
$confirm eq "no" or $confirm eq "yes"
$confirm eq "no"
$confirm eq "yes"
Truth table0%0/3
A or B
A= $confirm eq "no"B= $confirm eq "yes"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return $self->{ 'confirm' } = $confirm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->error(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->errorString("Invalid confirm value: $confirm"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub force { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
force: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my ($self, $force) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | unless(defined($force)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # if no parameter, the treat as "get" method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return $self->{ 'force' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $self->error(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->errorString(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $force = lc($force); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if($force eq 'no' or $force eq 'yes') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$force eq "no" or $force eq "yes"
MC/DC0%0/2
$force eq "no" or $force eq "yes"
$force eq "no"
$force eq "yes"
Truth table0%0/3
A or B
A= $force eq "no"B= $force eq "yes"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return $self->{ 'force' } = $force; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $self->error(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->errorString("Invalid force value: $force"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ########################################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $caller = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my %attr = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $class = (ref($caller) or $caller); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $caller || $caller
MC/DC0%0/2
ref $caller || $caller
ref $caller
$caller
Truth table0%0/3
A || B
A= ref $callerB= $caller
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 'state', 'closed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 'action', 'close', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # subscription parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 'subscriptionId', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # retrieval parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 'sessionId', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 'startTime', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 'events', 'evIdsAlert', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 'idsAlertSeverities', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 'errorSeverities', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'timeout', 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 'maxNbrOfEvents', 20, # set this just so we don't crush the box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 'confirm', 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 'force', 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 'missedEvents', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 'error', undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'errorString', undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | foreach my $attribute ( keys %attr ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $self->$attribute( $attr{ $attribute }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | #if(defined($self->{debug})) { $DEBUG_FLAG = 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $self->state('closed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $self->missedEvents(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $self->error(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->errorString(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | ########################################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||