1#!/usr/bin/env perl 2 3# short example script 4 5use lib 'lib'; 6use Authen::SASL; 7 8# This part is in the user script 9 10my $sasl = Authen::SASL->new( 11 mechanism => 'PLAIN CRAM-MD5 EXTERNAL ANONYMOUS', 12 callback => { 13 user => 'gbarr', 14 pass => 'fred', 15 authname => 'none' 16 }, 17); 18 19# $sasl is then passed to a library (eg Net::LDAP) 20# which will then do 21 22my $conn = $sasl->client_new("ldap","localhost", "noplaintext noanonymous"); 23 24# The library would also set properties on the connection 25#$conn->property( 26# iplocal => $socket->sockname, 27# ipremote => $socket->peername, 28#); 29 30# It would then start things off and send this info to the server 31 32my $initial = $conn->client_start; 33my $mech = $conn ->mechanism; 34 35print "$mech;", unpack("H*",$initial),";\n"; 36 37# When the server want more information, the library would call 38 39print unpack "H*", $conn->client_step("xyz"); 40print "\n"; 41