blib/lib/WWW/Wolfram/DataDrop.pm

filter: Statementstmt 41.9% 13 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 3 / 9 Podpod 0.0% 0 / 5 totaltotal 35.5% 16 / 45 SCAR 1.8
CC
1
Cov
42%
Databin
2.0
new
2.0
add
2.0
CRAP 1.2
↑ Summary Build »
1 package WWW::Wolfram::DataDrop;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use 5.008_005;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = '0.02';
6  
7 1 require Exporter;
8 1 our @ISA = 'Exporter';
9 1 our @EXPORT = qw/Databin/;
10  
11 1 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub Databin {
14 0 ▶ my ($id, %opts) = @_;
Subroutine Databin: not called CC=1 SCAR=6.9
Pod undocumented
15 0 my $self = __PACKAGE__->new(bin => $id, %opts);
16 0 return $self;
17 }
18  
19 sub new {
20 0 ▶ my ($class, %opts) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
21 0 my $self = \%opts;
22 0 my $ua_opts = delete $self->{opts};
23 0 $self->{ua} = LWP::UserAgent->new(%$ua_opts);
24 0 return bless $self, $class;
25 }
26  
27 sub add {
28 0 ▶ my ($self, %values) = @_;
Subroutine add: not called CC=1 SCAR=6.9
Pod undocumented
29 0 $values{bin} = $self->{bin};
30 0 return $self->_send(%values);
31 }
32  
33 sub _send {
34 0 ▶ my ($self, %values) = @_;
Subroutine _send: not called CC=1 SCAR=6.9
35 0 my $res = $self->ua->post($self->url, [%values]);
36 0 return $res->is_success;
37 }
38  
39 sub ua {
40 0 ▶ my $self = shift;
Subroutine ua: not called CC=1 SCAR=6.9
Pod undocumented
41 0 return $self->{ua};
42 }
43  
44 sub url {
45 0 ▶ my $self = shift;
Subroutine url: not called CC=1 SCAR=6.9
Pod undocumented
46 0 return 'https://datadrop.wolframcloud.com/api/v1.0/Add';
47 }
48  
49 1 1;
50 __END__
↑ Summary Build »