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