view release on metacpan or search on metacpan
server => 'call-manager-server.example.com',
username => 'oliver',
password => 's3krit', # or set in $ENV{AXL_PASS}
});
Then perform simple queries on the Unified Communications server:
my $device = $cucm->get_phone('SEP001122334455');
my $lines = $device->lines;
printf "this device has %s lines.\n", $lines->count;
while ($lines->has_next) {
my $l = $lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
if ($device->has_active_em) {
# extension mobility is active, so the lines are different
my $profile = $device->currentProfile;
my $profile_lines = $profile->lines;
printf "this profile has %s lines.\n", $profile_lines->count;
while ($profile_lines->has_next) {
my $l = $profile_lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
}
DESCRIPTION
This module acts as a client to the Cisco Unified Communications
Administrative XML interface (AXL). From here you can perform simple
queries to retrieve phone device details and in particular the lines
active on a device.
Although the API is presently very limited, it should be possible to add
inc/Module/Install.pm view on Meta::CPAN
return $string;
}
# Done in evals to avoid confusing Perl::MinimumVersion
eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!";
}
END_NEW
sub _write {
local *FH;
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!";
}
END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
sub _version {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
# Normalise multipart versions
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
inc/Module/Install/Can.pm view on Meta::CPAN
return 0;
}
# Write a C file representative of what XS becomes
require File::Temp;
my ( $FH, $tmpfile ) = File::Temp::tempfile(
"compilexs-XXXXX",
SUFFIX => '.c',
);
binmode $FH;
print $FH <<'END_C';
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int main(int argc, char **argv) {
return 0;
}
int boot_sanexs() {
return 1;
inc/Module/Install/Fetch.pm view on Meta::CPAN
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
$args{url} = $args{ftp_url}
or (warn("LWP support unavailable!\n"), return);
($scheme, $host, $path, $file) =
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
}
$|++;
print "Fetching '$file' from $host... ";
unless (eval { require Socket; Socket::inet_aton($host) }) {
warn "'$host' resolve failed!\n";
return;
}
return unless $scheme eq 'ftp' or $scheme eq 'http';
require Cwd;
my $dir = Cwd::getcwd();
inc/Module/Install/Fetch.pm view on Meta::CPAN
}
my @dialog = split(/\n/, <<"END_FTP");
open $host
user anonymous anonymous\@example.com
cd $path
binary
get $file $file
quit
END_FTP
foreach (@dialog) { $fh->print("$_\n") }
$fh->close;
} }
else {
warn "No working 'ftp' program available!\n";
chdir $dir; return;
}
unless (-f $file) {
warn "Fetching failed: $@\n";
chdir $dir; return;
}
return if exists $args{size} and -s $file != $args{size};
system($args{run}) if exists $args{run};
unlink($file) if $args{remove};
print(((!exists $args{check_for} or -e $args{check_for})
? "done!" : "failed! ($!)"), "\n");
chdir $dir; return !$?;
}
1;
inc/Module/Install/Makefile.pm view on Meta::CPAN
#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
$makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;
# XXX - This is currently unused; not sure if it breaks other MM-users
# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
seek MAKEFILE, 0, SEEK_SET;
truncate MAKEFILE, 0;
print MAKEFILE "$preamble$makefile$postamble" or die $!;
close MAKEFILE or die $!;
1;
}
sub preamble {
my ($self, $text) = @_;
$self->{preamble} = $text . $self->{preamble} if defined $text;
$self->{preamble};
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $version = shift @requires;
$self->test_requires( $module => $version );
}
}
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
# Numify
$v = $v + 0;
}
return $v;
}
sub add_metadata {
inc/Module/Install/Metadata.pm view on Meta::CPAN
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
inc/Module/Install/Win32.pm view on Meta::CPAN
$self->load('get_file');
require Config;
return unless (
$^O eq 'MSWin32' and
$Config::Config{make} and
$Config::Config{make} =~ /^nmake\b/i and
! $self->can_run('nmake')
);
print "The required 'nmake' executable not found, fetching it...\n";
require File::Basename;
my $rv = $self->get_file(
url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
local_dir => File::Basename::dirname($^X),
size => 51928,
run => 'Nmake15.exe /o > nul',
check_for => 'Nmake.exe',
remove => 1,
lib/AXL/Client/Simple.pm view on Meta::CPAN
server => 'call-manager-server.example.com',
username => 'oliver',
password => 's3krit', # or set in $ENV{AXL_PASS}
});
Then perform simple queries on the Unified Communications server:
my $device = $cucm->get_phone('SEP001122334455');
my $lines = $device->lines;
printf "this device has %s lines.\n", $lines->count;
while ($lines->has_next) {
my $l = $lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
if ($device->has_active_em) {
# extension mobility is active, so the lines are different
my $profile = $device->currentProfile;
my $profile_lines = $profile->lines;
printf "this profile has %s lines.\n", $profile_lines->count;
while ($profile_lines->has_next) {
my $l = $profile_lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
}
=head1 DESCRIPTION
This module acts as a client to the Cisco Unified Communications
Administrative XML interface (AXL). From here you can perform simple queries
to retrieve phone device details and in particular the lines active on a
device.
lib/AXL/Client/Simple/Phone.pm view on Meta::CPAN
server => 'call-manager-server.example.com',
username => 'oliver',
password => 's3krit', # or set in $ENV{AXL_PASS}
});
Then perform simple queries on the Unified Communications server:
my $device = $cucm->get_phone('SEP001122334455');
my $lines = $device->lines;
printf "this device has %s lines.\n", $lines->count;
while ($lines->has_next) {
my $l = $lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
if ($device->has_active_em) {
# extension mobility is active, so the lines are different
my $profile = $device->currentProfile;
my $profile_lines = $profile->lines;
printf "this profile has %s lines.\n", $profile_lines->count;
while ($profile_lines->has_next) {
my $l = $profile_lines->next;
print $l->alertingName, "\n";
print $l->extn, "\n";
}
}
=head1 DESCRIPTION
This module allows you to retrieve some properties of a device registered with
a Cisco Unified Communications server, including its line numbers and
extension mobility profile lines.
=head1 METHODS
lib/AXL/Client/Simple/Phone.pm view on Meta::CPAN
through the list of lines (see the synposis, above). For example:
my $lines = $device->lines;
=head2 $lines->next
Provides the next item in the collection of lines, or C<undef> if there are no
more items to return. Usually used in a loop along with C<has_next> like so:
while ($lines->has_next) {
print $lines->next->alertingName, "\n"; # the alerting name field from CUCM
print $lines->next->extn, "\n"; # the phone line extension number
}
=head2 $lines->peek
Returns the next item without moving the state of the iterator forward. It
returns C<undef> if it is at the end of the collection and there are no more
items to return.
=head2 $lines->has_next
lib/AXL/Client/Simple/Role/SOAP.pm view on Meta::CPAN
has transporter => (
is => 'ro',
isa => 'XML::Compile::Transport::SOAPHTTP',
lazy_build => 1,
);
sub _build_transporter {
my $self = shift;
return XML::Compile::Transport::SOAPHTTP->new(
address => (sprintf 'https://%s:%s@%s:8443/axl/',
$self->username, $self->password, $self->server),
keep_alive => 0,
);
}
has wsdl => (
is => 'ro',
isa => 'XML::Compile::WSDL11',
lazy_build => 1,
);