| 1 | package Net::Lite::XMPP; | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use 5.006000; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | require Exporter; | |||||||||
| 9 | 1 | ▶ | use AutoLoader qw(AUTOLOAD); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our @ISA = qw(Exporter); | |||||||||
| 12 | # Items to export into callers namespace by default. Note: do not export | ||||||||||
| 13 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||
| 14 | # Do not simply export all your public functions/methods/constants. | ||||||||||
| 15 | |||||||||||
| 16 | # This allows declaration use Net::Lite::XMPP ':all'; | ||||||||||
| 17 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | ||||||||||
| 18 | # will save memory. | ||||||||||
| 19 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 20 | |||||||||||
| 21 | ) ] ); | ||||||||||
| 22 | |||||||||||
| 23 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 24 | |||||||||||
| 25 | 1 | our @EXPORT = qw( | |||||||||
| 26 | |||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | 1 | our $VERSION = '0.02'; | |||||||||
| 30 | # Preloaded methods go here. | ||||||||||
| 31 | # Autoload methods go after =cut, and are processed by the autosplit program. | ||||||||||
| 32 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | }; | ||||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | sub new($$) { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 36 | 1 | my $class=shift; | |||||||||
| 37 | 1 | my $self={}; | |||||||||
| 38 | 1 | bless $self,$class; | |||||||||
| 39 | 1 | return $self; | |||||||||
| 40 | }; | ||||||||||
| 41 | 0 | ▶ | sub open($$$) { | ||||||||
|
Subroutine
open: not called CC=2 SCAR=14.8
Pod
undocumented
| |||||||||||
| 42 | 0 | my ($self,$host,$port)=@_; | |||||||||
| 43 | 0 | my ($data); | |||||||||
| 44 | 0 | ▶ | if (!(defined($port))) {$port=5223}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 1 | ▶ | use IO::Socket::SSL; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | 0 | my $Socket = new IO::Socket::SSL("$host:$port"); | |||||||||
| 47 | 0 | $self->{'Socket'}=$Socket; | |||||||||
| 48 | # Send header handshake: | ||||||||||
| 49 | 0 | print $Socket q|<?xml version='1.0'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" to="grendel.net.lub.pl" xmlns="jabber:client">|; | |||||||||
| 50 | 0 | print "Hello sent...\n"; | |||||||||
| 51 | # we expect sth like : | ||||||||||
| 52 | # <?xml version='1.0'?> | ||||||||||
| 53 | # <stream:stream xmlns='jabber:client' | ||||||||||
| 54 | # xmlns:stream='http://etherx.jabber.org/streams' | ||||||||||
| 55 | # id='3694886828' from='localhost'> | ||||||||||
| 56 | 0 | my $result=$Socket->pending(); | |||||||||
| 57 | 0 | print "Got $result bytes..\n"; | |||||||||
| 58 | 0 | sleep 1; | |||||||||
| 59 | 0 | my $result=$Socket->pending(); | |||||||||
| 60 | 0 | print "Got $result bytes..\n"; | |||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | 0 | return defined($Socket); | |||||||||
| 64 | }; | ||||||||||
| 65 | |||||||||||
| 66 | 0 | ▶ | sub login { | ||||||||
|
Subroutine
login: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 67 | 0 | my ($self,$user,$pass)=@_; | |||||||||
| 68 | 0 | my $Socket=$self->{'Socket'}; | |||||||||
| 69 | 0 | print $Socket q| | |||||||||
| 70 | <iq type='set' id='auth'> | ||||||||||
| 71 | <query xmlns='jabber:iq:auth'> | ||||||||||
| 72 | <username>mremond</username> | ||||||||||
| 73 | <password>azerty</password> | ||||||||||
| 74 | <resource>TelnetClient</resource></query></iq> | ||||||||||
| 75 | |; | ||||||||||
| 76 | # we expect: | ||||||||||
| 77 | # <iq type='result' id='auth'/> | ||||||||||
| 78 | |||||||||||
| 79 | }; | ||||||||||
| 80 | |||||||||||
| 81 | 1 | ▶ | sub trivialm { | ||||||||
|
Subroutine
trivialm: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 82 | 1 | return 1; | |||||||||
| 83 | }; | ||||||||||
| 84 | |||||||||||
| 85 | 1 | 1; | |||||||||
| 86 | __END__ | ||||||||||