File: PerlMods.txt

package info (click to toggle)
znc 0.045-3%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,120 kB
  • ctags: 2,324
  • sloc: cpp: 17,406; sh: 2,380; perl: 448; makefile: 134
file content (41 lines) | stat: -rw-r--r-- 1,794 bytes parent folder | download | duplicates (2)
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
40
41
Requires the global module g_modperl.so

- oopish perl modules (man perlobj, also see Example.pm)
- Has all the same callbacks as c++ code, with the same arguments
- special destructor should be used instead of perl DESTROY
	- OnShutdown, reason for this is during that destructor the user object
	  inside g_modperl is available for use



- Builting Sockets -
- includes builtin sock support (see ExampleWithSocks.pm)
- can be used two methods
	- method one is directly in your module itself, the sock fd is passed
	  around for your reference. The sock fd is ALWAYS the first argument
	- method two is to instantiate in a new perl class (as used in
	  ExampleWithSocks.pm)

- methods receiving callbacks are:
	- OnSockDestroy() -- when this sock is being destroyed
	- OnConnect( iParentFD ) -- called on the inbound/outbound socket, if this 
	  is created from a listening socket, iParentFD will be > -1
	- OnConnectionFrom( sRemoteHost, iRemotePort ) -- called on the listening 
	  socket when an inbound connection is coming in. If you return anything but
	  ZNC::CONTINUE, the connection will be denied.
	- OnError( iErrorNum ) -- called when an error occurs. errno.h contains valid 
	  error codes
	- OnConnectionRefused() -- called when an outbound connection is refused
	- OnTimeout() -- called when a connection times out
	- OnDisconnect() -- called when a connection is closed
	- ReadData( data, len ) -- called when data comes in, len contains the length
	  of the data being sent in
	- ReadLine( line ) -- called when a line (ended by \n) comes down. You must
	  enable readline when the socket is creatd (via connect or listen)
	
	NOTE: all of the socket stuff is a basic wrapper around Csocket, and full
	documentation can be found at http://csocket.net/docs/annotated.html