blib/script/fbx-test.pl untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 40 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 WWW::FBX;
5 use Scalar::Util 'blessed';
6  
7 my $res;
8 eval {
9 my $fbx = WWW::FBX->new(
10 app_id => "APP ID",
11 app_name => "APP NAME",
12 app_version => "1.0",
13 device_name => "debian",
14 # Fill in track_id and app_token once they've been given by Freebox
15 # track_id => "48",
16 # app_token => "2/g43EZYD8AO7tbnwwhmMxMuELtTCyQrV1goMgaepHWGrqWlloWmMRszCuiN2ftp",
17 );
18 print "You are now authenticated with track_id ", $fbx->track_id, " and app_token ", $fbx->app_token, "\n";
19 print "App permissions are:\n";
20 while ( my( $key, $value ) = each %{ $fbx->uar->{result}{permissions} } ) {
21 print "\t $key\n" if $value;
22 }
23  
24 $res = $fbx->connection;
25 print "Your ", $res->{media}, " internet connection state is ", $res->{state}, "\n";
26 };
27  
28 if ( my $err = $@ ) {
29 die $@ unless blessed $err && $err->isa('WWW::FBX::Error');
30
31 warn "HTTP Response Code: ", $err->code, "\n",
32 "HTTP Message......: ", $err->message, "\n",
33 "API Error.........: ", $err->error, "\n",
34 "Error Code........: ", $err->fbx_error_code, "\n",
35 }