Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Net::SMPP blowing up

by UnderMine (Friar)
on Apr 02, 2007 at 14:30 UTC ( [id://607838]=perlquestion: print w/replies, xml ) Need Help??

UnderMine has asked for the wisdom of the Perl Monks concerning the following question:

Attempted to do the following simple test script :-
#SMPP Test
use strict;

my $host='www.some-smpp-mobile.com';
my $port=1666;

use Net::SMPP;
my $smpp = Net::SMPP->new_transmitter($host, port=>$port,
                               system_id => 'Account',
                               password  => 'XXXXXXXX',
                               ) or die;

my $resp_pdu = $smpp->submit_sm(destination_addr => '4478123456789',
                                short_message    => 'test message')
           or die;
die "Response indicated error: " . $resp_pdu->explain_status()
           if $resp_pdu->status;

The trouble is I get the following error message :-
Not a GLOB reference at /usr/lib/perl5/site_perl/5.8.8/Net/SMPP.pm line 2301.
The code causing the error is :-
sub status {
    my $me = shift;
    return ${*$me}{status};
}
The SMS message appears to be correctly sent/not sent prior to this error occuring so it is not dependant on the outcome of the sending.

Any wisdom as to what could be causing this bizare side effect.


UnderMine

Replies are listed 'Best First'.
Re: Net::SMPP blowing up
by ptum (Priest) on Apr 02, 2007 at 21:30 UTC

    I've never used Net::SMPP so I'm totally punting, but here are two wild guesses:

    1. Your destination_addr parameter doesn't have a plus sign at the beginning as shown in the sample code in Net::SMPP
    2. Using Data::Dumper can often help -- sometimes I see error messages like the one you are encountering when I try to invoke object methods on an object but I haven't correctly created the object, so the methods are invalid. Dump out $smpp and $resp_pdu or test 'em to make sure they are valid objects before you try to invoke their methods.
      Got it working by changing the code to use the more convetional syntax :-
      sub status {
          my $me = shift;
          return $me->{status};
      }
      
      Thanks
      UnderMine
Re: Net::SMPP blowing up
by Anonymous Monk on Apr 03, 2007 at 08:09 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://607838]
Approved by NovMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-18 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found