App-Standby
view release on metacpan or search on metacpan
lib/App/Standby/Service/HTTP.pm view on Meta::CPAN
package App::Standby::Service::HTTP;
$App::Standby::Service::HTTP::VERSION = '0.04';
BEGIN {
$App::Standby::Service::HTTP::AUTHORITY = 'cpan:TEX';
}
# ABSTRACT: Baseclass for any simple HTTP service
use 5.010_000;
use mro 'c3';
use feature ':5.10';
use Moose;
use namespace::autoclean;
# use IO::Handle;
# use autodie;
# use MooseX::Params::Validate;
# use Carp;
# use English qw( -no_match_vars );
use Try::Tiny;
use JSON;
use LWP::UserAgent;
use URI::Escape;
# extends ...
extends 'App::Standby::Service';
# has ...
has '_ua' => (
'is' => 'rw',
'isa' => 'LWP::UserAgent',
'lazy' => 1,
'builder' => '_init_ua',
);
has '_json' => (
'is' => 'rw',
'isa' => 'JSON',
'lazy' => 1,
'builder' => '_init_json',
);
has 'username' => (
'is' => 'rw',
'isa' => 'Str',
'required' => 0,
);
has 'password' => (
'is' => 'rw',
'isa' => 'Str',
'required' => 0,
);
has 'endpoints' => (
'is' => 'rw',
'isa' => 'ArrayRef',
'lazy' => 1,
'builder' => '_init_endpoints',
);
# with ...
# initializers ...
sub _init_json {
my $self = shift;
my $JSON = JSON::->new->utf8();
return $JSON;
}
sub _init_ua {
my $self = shift;
my $UA = LWP::UserAgent::->new();
$UA->agent('App::Standby::Service::HTTP/0.01');
return $UA;
}
# your code here ...
sub _build_payload {
( run in 0.570 second using v1.01-cache-2.11-cpan-39bf76dae61 )