meteorsms.pm untested

filter: Statementstmt 0.0% 0 / 68 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 88 CC 2 SCAR 9.2
CC
2
Cov
0%
_init
6.0
is_meteor
2.0
_format_number
2.0
CRAP 2.5
1 #
2 # $Id: meteorsms.pm 352 2008-11-27 16:16:41Z mackers $
3  
4 package WWW::SMS::IE::meteorsms;
5  
6 =head1 NAME
7  
8 WWW::SMS::IE::meteorsms - A module to send SMS messages using the website of
9 Meteor Ireland
10  
11 =head1 SYNOPSIS
12  
13 require WWW::SMS::IE::iesms;
14 require WWW::SMS::IE::meteorsms;
15  
16 my $carrier = new WWW::SMS::IE::meteorsms;
17  
18 if ($carrier->login('0871234567', 'password'))
19 {
20 my $retval = $carrier->send('+353865551234', 'Hello World!');
21  
22 if (!$retval)
23 {
24 print $carrier->error() . "\n";
25 }
26 }
27  
28 =head1 DESCRIPTION
29  
30 L<WWW::SMS::IE::meteorsms> is a class to send SMS messages via the command line
31 using the website of Meteor Ireland -- http://www.meteor.ie/
32  
33 For more information see L<WWW::SMS::IE::iesms>
34  
35 =cut
36  
37 use strict;
38 use warnings;
39 use vars qw( $VERSION );
40 $VERSION = sprintf("0.%02d", q$Revision: 352 $ =~ /(\d+)/);
41  
42 @WWW::SMS::IE::meteorsms::ISA = qw{WWW::SMS::IE::iesms};
43  
44 use constant LOGIN_START_STEP => 0;
45 use constant LOGIN_END_STEP => 6;
46 use constant SEND_START_STEP => 7;
47 use constant SEND_END_STEP => undef;
48 use constant REMAINING_MESSAGES_MATCH => 1;
49 use constant ACTION_FILE => "meteorsms.action";
50 use constant SIMULATED_DELAY_MIN => 0;
51 use constant SIMULATED_DELAY_MAX => 0;
52 use constant SIMULATED_DELAY_PERCHAR => 0.25;
53  
54 sub _init
55 {
56 my $self = shift;
57  
58 $self->_log_debug("creating new instance of meteorsms carrier");
59  
60 $self->_login_start_step(LOGIN_START_STEP);
61 $self->_login_end_step(LOGIN_END_STEP);
62 $self->_send_start_step(SEND_START_STEP);
63 $self->_send_end_step(SEND_END_STEP);
64 $self->_remaining_messages_match(REMAINING_MESSAGES_MATCH);
65 $self->_action_file(ACTION_FILE);
66 $self->_simulated_delay_max(SIMULATED_DELAY_MAX);
67 $self->_simulated_delay_min(SIMULATED_DELAY_MIN);
68 $self->_simulated_delay_perchar(SIMULATED_DELAY_PERCHAR);
69  
70 $self->full_name("Meteor Ireland");
71 $self->domain_name("meteor.ie");
72  
73 if ($self->is_win32())
74 {
75 $self->config_dir($ENV{TMP});
76 $self->config_file($self->_get_home_dir() . "meteorsms.ini");
77 $self->message_file("meteorsms_lastmsg.txt");
78 $self->history_file("meteorsms_history.txt");
79 $self->cookie_file("meteorsms.cookie");
80 $self->action_state_file("meteorsms.state");
81 }
82 else
83 {
84 $self->config_dir($self->_get_home_dir() . "/.meteorsms/");
85 $self->config_file("config");
86 $self->message_file("lastmsg");
87 $self->history_file("history");
88 $self->cookie_file(".cookie");
89 $self->action_state_file(".state");
90 }
91 }
92  
93 sub is_meteor
94 {
95 return 1;
96 }
97  
98 sub _format_number
99 {
100 my ($self, $number) = @_;
101  
102 $number =~ s/^\+353/0/;
103  
104 return $number;
105 }
106  
107  
108 =head1 DISCLAIMER
109  
110 The author accepts no responsibility nor liability for your use of this
111 software. Please read the terms and conditions of the website of your mobile
112 provider before using the program.
113  
114 =head1 SEE ALSO
115  
116 L<WWW::SMS::IE::iesms>,
117 L<WWW::SMS::IE::meteorsms>,
118 L<WWW::SMS::IE::meteorsms>
119  
120 L<http://www.mackers.com/projects/o2sms/>
121  
122 =head1 AUTHOR
123  
124 David McNamara (me.at.mackers.dot.com)
125  
126 =head1 COPYRIGHT
127  
128 Copyright 2000-2006 David McNamara
129  
130 This program is free software; you can redistribute it and/or modify it under
131 the same terms as Perl itself.
132  
133 =cut
134  
135 1;