script/perl-WebService-Whistle-Pet-Tracker-API-device.pl untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 52 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2 use strict;
3 use warnings;
4 use File::Basename qw{basename};
5 use Getopt::Std qw{getopts};
6 use JSON::XS qw{};
7 use WebService::Whistle::Pet::Tracker::API qw{};
8  
9 my $basename = basename($0);
10 my $syntax = "$basename -e WHISTLE_EMAIL -p WHISTLE_PASSWORD device [device [...]]\n";
11 my $opt = {};
12  
13 getopts('e:p:', $opt);
14  
15 my $email = $opt->{'e'} || $ENV{'WHISTLE_EMAIL'} or die($syntax);
16 my $password = $opt->{'p'} || $ENV{'WHISTLE_PASSWORD'} or die($syntax);
17 die($syntax) unless @ARGV;
18  
19 my $ws = WebService::Whistle::Pet::Tracker::API->new(email=>$email, password=>$password);
20 my $json = JSON::XS->new->pretty;
21  
22 foreach my $argv (@ARGV) {
23 my $device = $ws->device($argv);
24 print $json->encode($device);
25 }
26  
27 __END__