File: snpp

package info (click to toggle)
libnet-perl 1.0502-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 284 kB
  • ctags: 418
  • sloc: perl: 3,705; makefile: 43; sh: 4
file content (39 lines) | stat: -rwxr-xr-x 696 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/local/bin/perl

use blib;
use Getopt::Long;
use Net::SNPP;

$opt_debug = undef;
$opt_h = undef;
$opt_p = undef;

GetOptions(qw(debug h p));

die "usage: $0 -h <host> -p <pagerid> <message>"
	unless defined $opt_h && defined $opt_p && @ARGV;

Net::SNPP->debug(1)
	if $opt_debug;

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

$snpp->pager_id($opt_p) || die $snpp->message;
$snpp->content(join(" ",@ARGV)) || die $snpp->message;
$snpp->send() || die $snpp->message;

$snpp->quit;

__END__

or you could dp

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

$snpp->send( Pager   => $opt_p,
	     Message => join(" ",@ARGV),
	     Alert   => 1,
	     Hold    => time + 3600
	   ) || die $snpp->message;

$snpp->quit;