Agent-TCLI
view release on metacpan or search on metacpan
lib/Agent/TCLI/Transport/XMPP.pm view on Meta::CPAN
sub _init :Init {
my ($self, $args) = @_;
# Validate deep arguments
# $self->Verbose("Validating arguments \n" ,1);
# my %jabber_connection = validate ($args->{'jabber_connection'}, {
# jabber_package => { regex => qr/^POE::Component::Jabber/,
# type => Params::Validate::SCALAR | Params::Validate::SCALARREF },
# server => { type => Params::Validate::SCALAR | Params::Validate::SCALARREF },
# port => { optional => 1, default => 5222,
# callbacks =>
# { 'is a number' => sub { Scalar::Utils->looks_like_a_number($_[0]) }
# }},
# password => { type => Params::Validate::SCALAR | Params::Validate::SCALARREF },
# });
}
=back
lib/Agent/TCLI/User.pm view on Meta::CPAN
sub not_authorized {
my $self = shift;
# Check if incorrect args are sent and set defaults for optionals
my $args_ref = validate_with ( params => \@_,
spec => {
id => { type => &Params::Validate::SCALAR },
protocol =>
{ optional => 1, default => qr(.*), # default .* means any, simplifies matching if not set
callbacks =>
{ 'is a valid regex' => sub { ref ( $_[0] ) eq 'Regexp' } }
},
auth =>
{ optional => 1, default => qr(.*), # default .* means any, simplifies matching if not set
callbacks =>
{ 'is a valid regex' => sub { ref ( $_[0] ) eq 'Regexp' } }
},
},
# on_fail => sub { $self->_set_err( { 'method' => 'not_authorized',
# 'rebuke' => shift } )
# },
);
# strip off /.* - jabber resource or something like it if there
$args_ref->{'id'} =~ s|/.*||;
( run in 0.953 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )