Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I send a messge to pager from Perl

Status
Not open for further replies.

Sina

Technical User
Jan 2, 2001
309
CA
Hi everyone,

I know it possible to send a page messge from perl using Net::SNPP;

But I my script simply does not work.

#!/usr/local/bin/perl -w


use Net::SNPP;


$snpp = Net::SNPP->new('snpphost');

$pgr = '4181234567';
$snpp->send( Pager => $pgr,
Message => "Your lunch is ready",
Alert => 1,
Hold => time + 3600, # lunch ready in 1 hour :)
) || die $snpp->message;


$snpp->quit;

I get an error message
Can't call method "send" on an undefined value at page.pl line 13.

Any ideas?
Am I missing something.

OS = Window 2k.

ps. How is this module sending the message if it is not dailing any phone number

Thanks in advance
 
This probably means that your line:

$snpp = Net::SNPP->new('snpphost');

is failing. Try this:

$snpp = Net::SNPP->new('snpphost')
[tab]|| print "SNPP Error: $!\n";

or maybe (this seems to be implied in the, rather sketchy, documentation)

$snpp = Net::SNPP->new('snpphost')
[tab]|| print "SNPP Error: $Net::SNPP::status\n";

SNPP is described in RFC1861 and details can be found at Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Hi Michael,

Thanks for your reply.

I tried what you mentioned and just one thing, for the snpphost I have simply included my own IP address of the box that is running the script. But I get an error, How do I know if my box is a snphost?

I still get this error Can't call method "send" on an undefined value at page.pl line 13.

Have you ever tried to send a pager message using this method?

Thanks
 
Nope, I've never tried it -- but I can guess why your script isn't working.

You need to specify the address of a valid SNPP host -- one that's running SNPP and will accept a connection from you.

If you do that, I would bet your:

$snpp = Net::SNPP->new('snpphost')
|| print "SNPP Error: $!\n";

statement would work fine.

I don't, unfortunately, know of any such hosts; anyone else?

I'll have a quick look around though.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Hi Michael,

Thanks for your reply.

I'll have to do some search to find out how to setup an snpp host server or either use one.

If you come accross something please let me know.

Thanks Michael.

Sina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top