| 1 | package Net::AIM::TOC; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $VERSION = '0.97'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Net::AIM::TOC::Config; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | my $self = { | |||||||||||||||||||||||||||||||||||||||||
| 13 | _conn => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 18 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub connect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $conn = Net::AIM::TOC::Connection->new( $args ); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->{_conn} = $conn; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 29 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub sign_on { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sign_on: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $screenname = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if( !defined($screenname) || !defined($password) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $screenname and defined $password
MC/DC0%0/2
defined $screenname and defined $password
defined $screenname
defined $password
Truth table0%0/3
A and B
A= defined $screennameB= defined $password
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | throw Net::AIM::TOC::Error( -text => 'Username/password not defined' ); | |||||||||||||||||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $ret = $self->{_conn}->send_signon( $screenname, $password ); | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return( $ret ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub send_im_to_aol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_im_to_aol: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $user = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $ret = $self->{_conn}->sendIMToAOL( $user, $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return( $ret ); | |||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub send_to_aol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_to_aol: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $ret = $self->{_conn}->sendToAOL( $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return( $ret ); | |||||||||||||||||||||||||||||||||||||||||
| 64 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub recv_from_aol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recv_from_aol: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my( $msgObj ) = $self->{_conn}->recvFromAOL; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return( $msgObj ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $self->{_conn}->disconnect; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 82 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | Net::AIM::TOC - Perl implementation of the AIM TOC protocol | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | The C<Net::AIM::TOC> module implements in AIM TOC protocol in such a way which make it simple for using when writing bots or AIM clients in Perl. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | All of the code regarding the connection is abstracted in order to simplify the AIM connection down to merely sending and receiving instant messages and toc commands. | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | use Error qw( :try ); | ||||||||||||||||||||||||||||||||||||||||||
| 100 | use Net::AIM::TOC; | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | try { | ||||||||||||||||||||||||||||||||||||||||||
| 103 | my $aim = Net::AIM::TOC->new; | ||||||||||||||||||||||||||||||||||||||||||
| 104 | $aim->connect; | ||||||||||||||||||||||||||||||||||||||||||
| 105 | $aim->sign_on( $screenname, $password ); | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | my $msgObj = $aim->recv_from_aol; | ||||||||||||||||||||||||||||||||||||||||||
| 108 | print $msgObj->getMsg, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 109 | $aim->send_im_to_aol( $buddy, $msg ); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | $aim->disconnect; | ||||||||||||||||||||||||||||||||||||||||||
| 112 | exit( 0 ); | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | catch Net::AIM::TOC::Error with { | ||||||||||||||||||||||||||||||||||||||||||
| 116 | my $err = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | print $err->stringify, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | =head1 CLASS INTERFACE | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | =head2 CONSTRUCTORS | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | A C<Net::AIM::TOC> object is created by calling the new constructor without arguments. A reference to the newly created object is returned, however, no connection to AIM has yet been made. One first is required to called C<connect> and C<sign_on> before attempting to send/receive instant messages. | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =item new () | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | Returns C<Net::AIM::TOC> object but does not create a connection or sign on to the AIM service. | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | =head2 OBJECT METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | =item connect ( ARGS ) | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | The connect method can be called without arguments to connect to the AIM service using the default AIM servers. | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | Alternatively, a hash containing any of the following keys can be passed in to connect to another service using the TOC protocol: | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | -tocServer | ||||||||||||||||||||||||||||||||||||||||||
| 147 | -tocPort | ||||||||||||||||||||||||||||||||||||||||||
| 148 | -authServer | ||||||||||||||||||||||||||||||||||||||||||
| 149 | -authPort | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =item sign_on ( ARGS ) | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | C<sign_on> is called to sign on to the AIM service. The arguments to be passed in are the screen name and password to be used to sign on to the service. | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | =item send_im_to_aol ( ARGS ) | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | Sends an instant message. The first argument should be the name of the receipient buddy and the second argument is the message which you are sending. | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | =item send_to_aol ( ARGS ) | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | Sends whatever string is passed in on to the AIM service. Useful for sending toc commands. | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | =item recv_from_aol () | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | Receives any data sent from the AIM service. This includes all TOC protocol messages (including instant messages), however, PAUSE And SIGN_ON messages are handled internally. | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | This method returns a C<Net::AIM::TOC::Messages> object. See the documentation for this object is to be used. | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | =item disconnect () | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | Disconnects from the AIM service. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | =head1 KNOWN BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | None, but that does not mean there are not any. | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | C<Net::AIM::TOC::Messages> | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | Alistair Francis, http://search.cpan.org/~friffin/ | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | # Net::AIM::TOC::Connection package. | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # Nothing to see here, please move along | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | package Net::AIM::TOC::Connection; | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | ▶ | use Net::AIM::TOC::Message; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | _sock => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 207 | _screenName => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 208 | _tocServer => $args->{tocServer} || Net::AIM::TOC::Config::TOC_SERVER, | ||||||||||||||||||||||||||||||||||||||||||
| 209 | _tocPort => $args->{tocPort} || Net::AIM::TOC::Config::TOC_PORT, | ||||||||||||||||||||||||||||||||||||||||||
| 210 | _authServer => $args->{authServer} || Net::AIM::TOC::Config::AUTH_SERVER, | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | _authPort => $args->{authPort} || Net::AIM::TOC::Config::AUTH_PORT, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$args->{'tocServer'} || 'toc.oscar.aol.com'
$args->{'tocPort'} || 9898
$args->{'authServer'} || 'login.oscar.aol.com'
$args->{'authPort'} || 5159
MC/DC0%0/1
$args->{'tocServer'} || 'toc.oscar.aol.com'
$args->{'tocServer'}
MC/DC0%0/1
$args->{'tocPort'} || 9898
$args->{'tocPort'}
MC/DC0%0/1
$args->{'authServer'} || 'login.oscar.aol.com'
$args->{'authServer'}
MC/DC0%0/1
$args->{'authPort'} || 5159
$args->{'authPort'}
Truth table0%0/2
A
A= $args->{'tocServer'}
Truth table0%0/2
A
A= $args->{'tocPort'}
Truth table0%0/2
A
A= $args->{'authServer'}
Truth table0%0/2
A
A= $args->{'authPort'}
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | _outseq => int(rand(100000)), | ||||||||||||||||||||||||||||||||||||||||||
| 213 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | my $sock = IO::Socket::INET->new( | ||||||||||||||||||||||||||||||||||||||||||
| 216 | PeerAddr => $self->{_tocServer}, | ||||||||||||||||||||||||||||||||||||||||||
| 217 | PeerPort => $self->{_tocPort}, | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | Type => SOCK_STREAM, | |||||||||||||||||||||||||||||||||||||||||
| 219 | Proto => 'tcp' | ||||||||||||||||||||||||||||||||||||||||||
| 220 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if( !defined($sock) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $err_msg = 'Unable to connect to '. $self->{_tocServer} .' on port '. $self->{_tocPort}; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | throw Net::AIM::TOC::Error( -text => $err_msg ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->{_sock} = $sock; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 231 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub send_signon { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_signon: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $screen_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $self->{_screenName} = $screen_name; | |||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | Net::AIM::TOC::Utils::printDebug( "send_signon: $screen_name" ); | |||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $data_out = "FLAPON\r\n\r\n"; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $self->{_sock}->send( $data_out ); | |||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my( $msgObj ) = $self->recvFromAOL; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | Net::AIM::TOC::Utils::printDebug( $msgObj->getRawData ); | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $signon_data = pack "Nnna".length($screen_name), 1, 1, length($screen_name) , $screen_name; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $msg = pack "aCnn", '*', 1, $self->{_outseq}, length($signon_data); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $msg .= $signon_data; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $ret = $self->{_sock}->send( $msg, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if( !defined($ret) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | throw Net::AIM::TOC::Error( -text => "syswrite: $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 258 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $login_string = $self->_getLoginString( $screen_name, $password ); | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $ret = $self->sendToAOL( $login_string ); | |||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | # receive SIGNON data from AOL | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $msgObj = $self->recvFromAOL; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | Net::AIM::TOC::Utils::printDebug( $msgObj->getRawData ); | |||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | # Sending of sign on data is performed by 'recvFromAOL' to ensure | ||||||||||||||||||||||||||||||||||||||||||
| 269 | # correct handling of PAUSE messages | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | return( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 272 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub _sendSignOnData { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sendSignOnData: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | # These lines are required in order to sign on | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $ret = $self->sendToAOL( "toc_add_buddy $self->{_screenName}" ); | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $ret = $self->sendToAOL( 'toc_set_config {m 1}' ); | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | # We're done with the signon process | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $ret = $self->sendToAOL( 'toc_init_done' ); | |||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | # remove the buddy we were required to add earlier | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $ret = $self->sendToAOL( "toc_remove_buddy $self->{_screenName}" ); | |||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 289 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub _getLoginString { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getLoginString: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $screen_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $login_string = 'toc_signon '. $self->{_authServer} .' '. $self->{_authPort} .' '. $screen_name .' '. Net::AIM::TOC::Utils::encodePass( $password ) .' english '. Net::AIM::TOC::Utils::encode( Net::AIM::TOC::Config::AGENT ); | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | return( $login_string ); | |||||||||||||||||||||||||||||||||||||||||
| 299 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub recvFromAOL { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recvFromAOL: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | if( !defined($self->{_sock}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | throw Net::AIM::TOC::Error( -text => 'We are not connected' ); | |||||||||||||||||||||||||||||||||||||||||
| 309 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $ret = $self->{_sock}->recv( $buffer, 6 ); | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if( !defined($ret) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | throw Net::AIM::TOC::Error( -text => "sysread: $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 314 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | Net::AIM::TOC::Utils::printDebug( "RAW IN (header): '$buffer'" ); | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my ($marker, $type, $in_seq, $len) = unpack "aCnn", $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | Net::AIM::TOC::Utils::printDebug( "IN (header): '$marker', '$type', '$in_seq', '$len'" ); | |||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $ret = $self->{_sock}->recv( $buffer, $len ); | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if( !defined($ret) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | throw Net::AIM::TOC::Error( -text => "sysread: $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 323 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | Net::AIM::TOC::Utils::printDebug( "RAW IN (data): '$buffer'" ); | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $data = unpack( 'a*', $buffer ); | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | Net::AIM::TOC::Utils::printDebug( "IN (data): '$data'" ); | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my $msgObj = Net::AIM::TOC::Message->new( $type, $data ); | |||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | if( $msgObj->getType eq 'SIGN_ON' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $self->_sendSignOnData; | |||||||||||||||||||||||||||||||||||||||||
| 333 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | return( $msgObj ); | |||||||||||||||||||||||||||||||||||||||||
| 336 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub sendToAOL { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendToAOL: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if( !defined($self->{_sock}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | throw Net::AIM::TOC::Error( -text => 'We are not connected' ); | |||||||||||||||||||||||||||||||||||||||||
| 345 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $msg .= "\0"; | |||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | Net::AIM::TOC::Utils::printDebug( "RAW OUT: $msg" ); | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $data = pack "aCnna*", '*', 2, ++$self->{_outseq}, length($msg), $msg; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | Net::AIM::TOC::Utils::printDebug( "OUT: $data" ); | |||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $ret = $self->{_sock}->send( $data, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | if( !defined($ret) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | throw Net::AIM::TOC::Error( -text => "syswrite: $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 357 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | return( $ret ); | |||||||||||||||||||||||||||||||||||||||||
| 360 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub sendIMToAOL { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendIMToAOL: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $user = shift; | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if( !defined($user) || !defined($msg) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $user and defined $msg
MC/DC0%0/2
defined $user and defined $msg
defined $user
defined $msg
Truth table0%0/3
A and B
A= defined $userB= defined $msg
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | Net::AIM::TOC::Utils::printDebug( "User or msg not defined\n" ); | |||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 371 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $user = Net::AIM::TOC::Utils::normalize( $user ); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $msg = Net::AIM::TOC::Utils::encode( $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $msg = 'toc_send_im '. $user .' '. $msg; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $ret = $self->sendToAOL( $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | return( $ret ); | |||||||||||||||||||||||||||||||||||||||||
| 381 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $self->{_sock}->close; | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 390 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | # Net::AIM::TOC::Error* packages. | ||||||||||||||||||||||||||||||||||||||||||
| 394 | # Nothing to see here, please move along | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | package Net::AIM::TOC::Error; | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 1 | @Net::AIM::TOC::Error::ISA = qw( Error ); | |||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | package Net::AIM::TOC::Error::Message; | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | @Net::AIM::TOC::Error::Message::ISA = qw( Net::AIM::TOC::Error ); | |||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | # Net::AIM::TOC::Utils package. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | # Nothing to see here, please move along | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | package Net::AIM::TOC::Utils; | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub printDebug { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
printDebug: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | if( Net::AIM::TOC::Config::DEBUG ) { | |||||||||||||||||||||||||||||||||||||||||
| 422 | print STDERR $msg, "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 423 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 426 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub encodePass { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encodePass: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my @table = unpack "c*" , 'Tic/Toc'; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my @pass = unpack "c*", $password; | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $encpass = '0x'; | |||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | foreach my $c (0 .. $#pass) { | |||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $encpass.= sprintf "%02x", $pass[$c] ^ $table[ ( $c % 7) ]; | |||||||||||||||||||||||||||||||||||||||||
| 437 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | return( $encpass ); | |||||||||||||||||||||||||||||||||||||||||
| 440 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | sub encode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $str =~ s/([\\\}\{\(\)\[\]\$\"])/\\$1/g; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | return( "\"$str\"" ); | |||||||||||||||||||||||||||||||||||||||||
| 447 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub normalize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $data =~ s/[^A-Za-z0-9]//g; | |||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | $data =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | return( $data ); | |||||||||||||||||||||||||||||||||||||||||
| 456 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | sub removeHtmlTags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
removeHtmlTags: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | my $replacement = shift || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $string =~ s/<.*?>/$replacement/g; | |||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return( $string ); | |||||||||||||||||||||||||||||||||||||||||
| 466 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | sub getCurrentTime { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getCurrentTime: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); | |||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if( $sec < 10 ) { $sec = '0'.$sec }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if( $min < 10 ) { $min = '0'.$min }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return( "$hour:$min:$sec" ); | |||||||||||||||||||||||||||||||||||||||||
| 476 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||