1Net::SNPP(3) User Contributed Perl Documentation Net::SNPP(3)
2
3
4
6 Net::SNPP - Simple Network Pager Protocol Client
7
9 use Net::SNPP;
10
11 # Constructors
12 $snpp = Net::SNPP->new('snpphost');
13 $snpp = Net::SNPP->new('snpphost', Timeout => 60);
14
16 This module is in a maintenance mode, as I no longer have significant
17 access to SNPP servers to test with. However, to the best of the
18 present maintainer's knowledge, the module works just fine and has been
19 used in many a production environment.
20
22 This module implements a client interface to the SNPP protocol,
23 enabling a perl5 application to talk to SNPP servers. This
24 documentation assumes that you are familiar with the SNPP protocol
25 described in RFC1861.
26
27 A new Net::SNPP object must be created with the new method. Once this
28 has been done, all SNPP commands are accessed through this object.
29
31 This example will send a pager message in one hour saying "Your lunch
32 is ready"
33
34 #!/usr/local/bin/perl -w
35
36 use Net::SNPP;
37
38 $snpp = Net::SNPP->new('snpphost');
39
40 $snpp->send( Pager => $some_pager_number,
41 Message => "Your lunch is ready",
42 Alert => 1,
43 Hold => time + 3600, # lunch ready in 1 hour :-)
44 ) || die $snpp->message;
45
46 $snpp->quit;
47
49 new ( [ HOST, ] [ OPTIONS ] )
50 This is the constructor for a new Net::SNPP object. "HOST" is the
51 name of the remote host to which a SNPP connection is required.
52
53 If "HOST" is not given, then the "SNPP_Host" specified in
54 "Net::Config" will be used.
55
56 "OPTIONS" are passed in a hash like fashion, using key and value
57 pairs. Possible options are:
58
59 Timeout - Maximum time, in seconds, to wait for a response from the
60 SNPP server (default: 120)
61
62 Debug - Enable debugging information
63
64 Example:
65
66 $snpp = Net::SNPP->new('snpphost',
67 Debug => 1,
68 );
69
71 Unless otherwise stated all methods return either a true or false
72 value, with true meaning that the operation was a success. When a
73 method states that it returns a value, failure will be returned as
74 undef or an empty list.
75
76 reset ()
77 help ()
78 Request help text from the server. Returns the text or undef upon
79 failure
80
81 quit ()
82 Send the QUIT command to the remote SNPP server and close the
83 socket connection.
84
85 site ( CMD )
86 Send a SITE command to the remote SNPP server. site() take a single
87 argument which is the command string to send to the SNPP server.
88
89 ping ( PAGER_ID )
90 Determine if the remote SNPP server is able to contact a given
91 pager ID. (Level 3 command)
92
93 noqueue ()
94 Instruct the SNPP server not to queue the two-way request. (Level
95 3 command)
96
97 expire_time ( HOURS )
98 Cause the paging request to be canceled if it has not been sent in
99 the specified number of hours. (Level 3 command)
100
101 read_ack ( TRUEFALSE )
102 Enable and disable the read acknowledgement notification sent by
103 the pager. (Level 3 command)
104
105 reply_type ( TYPE_CODE )
106 Change the type of reply that the page will send back. Valid
107 options are: NONE, YESNO, SIMREPLY, MULTICHOICE, and TEXT. (Level 3
108 command)
109
110 message_response ( INT TEXT ) (Level 3)
111 Create message responses to deliver with the message. INT is a
112 2-byte number. The total number of definable responses may be
113 limited by your server. Some server may need you to call
114 reply_type() before specifying responses.
115
116 message_status ( MSGID MSGID ) (Level 3)
117 Get the message status from the remote server. Use the Message_Tag
118 and Pass_Code from send_two_way() as the arguments to this method,
119 and if your server supports it, you should be able to retrieve the
120 status of a 2-way message. An array/arraref is returned with the
121 following 5 elements:
122 [0] Sequence
123 [1] Date&Time
124 [2] +/- GMT (if provided by server)
125 [3] server-specific response text
126 [4] numeric response code from server (i.e. 860 or 960)
127
128 send_two_way () (Level 3)
129 Use this method instead of send() when working in Level 3 of the
130 SNPP protocol. Before using this method, you have to build up your
131 page using the other methods in the module, then use this at the
132 very end to "submit" your page. An array/arrayref will be returned
133 with the following 4 elements:
134 [0] Message_Tag
135 [1] Pass_Code
136 [2] server-specific response text
137 [3] numeric response code from server (i.e. 860 or 960)
138
139 NOTE: This is only the SEND command - you have to build the page
140 using various methods from this module before calling this method.
141
143 use Net::SNPP;
144
145 my $snpp = Net::SNPP->new( "snpp.provider.com" );
146 $snpp->two_way();
147 $snpp->pager_id( 5555555555 );
148 $snpp->data( "The sky is falling!\nThe sky is falling!" );
149 $snpp->message_response( 1, "Don't Panic" );
150 $snpp->message_response( 2, "Panic!" );
151 my @result = $snpp->send_two_way();
152 $snpp->quit();
153 printf "Use these two numbers: \"%s %s\" to check message status.\n",
154 $result[0], $result[1];
155
156 __END__
157
158 use Net::SNPP;
159
160 my $snpp = Net::SNPP->new( "snpp.provider.com" );
161 my @status = $snpp->message_status( $ARGV[0], $ARGV[1] );
162 $snpp->quit;
163
164 printf "User responded with: %s\n", $status[3];
165
167 "Net::SNPP" exports all that "Net::CMD" exports, plus three more
168 subroutines that can bu used to compare against the result of "status".
169 These are :- "CMD_2WAYERROR", "CMD_2WAYOK", and "CMD_2WAYQUEUED".
170
172 Net::Cmd RFC1861
173
175 Derek J. Balling <dredd@megacity.org> ( original version by Graham Barr
176 ) Al Tobey <tobeya@tobert.org> (since Oct 2003)
177
179 Copyright (c) 1995-2001 Graham Barr. (c) 2001-2003 Derek J. Balling.
180 All rights reserved. This program is free software; you can
181 redistribute it and/or modify it under the same terms as Perl itself.
182
183 $Id: SNPP.pm,v 1.9 2004/01/27 22:18:32 tobeya Exp $
184
185
186
187perl v5.30.1 2020-01-30 Net::SNPP(3)