File Coverage

blib/lib/Net/Azure/EventHubs/Request.pm
Criterion Covered Total %
statement 18 22 81.8
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 25 32 78.1


line stmt bran cond sub pod time code
1             package Net::Azure::EventHubs::Request;
2 5     5   31 use strict;
  5         13  
  5         163  
3 5     5   21 use warnings;
  5         7  
  5         244  
4              
5 5     5   1485 use parent 'HTTP::Request';
  5         1061  
  5         28  
6 5     5   127383 use Net::Azure::EventHubs::Response;
  5         22  
  5         259  
7 5     5   32 use Carp;
  5         10  
  5         376  
8              
9             use Class::Accessor::Lite (
10 5         57 new => 0,
11             rw => [qw[agent]],
12 5     5   2364 );
  5         6090  
13              
14             sub do {
15 0     0 1   my $self = shift;
16 0           my $res = $self->agent->request($self);
17 0 0         croak $res->status_line if !$res->is_success;
18 0           bless $res, 'Net::Azure::EventHubs::Response';
19             }
20              
21             1;
22              
23             =encoding utf-8
24              
25             =head1 NAME
26              
27             Net::Azure::EventHubs::Request - A Request Class for Net::Azure::EventHubs
28              
29             =head1 SYNOPSIS
30              
31             use Net::Azure::EventHubs::Request;
32             use LWP::UserAgent;
33             my $req = Net::Azure::EventHubs::Request->new(GET => 'http://...');
34             $req->agent(LWP::UserAgent->new);
35             my $res = $req->do;
36              
37             =head1 DESCRIPTION
38              
39             Net::Azure::EventHubs::Request is a request class for Net::Azure::EventHubs.
40              
41             It inherits HTTP::Request.
42              
43             =head1 METHODS
44              
45             =head2 new
46              
47             A constructor method.
48              
49             =head2 agent
50              
51             my $agent = LWP::UserAgent->new(...);
52             $req->agent($agent);
53              
54             An accessor for setting/getting a LWP::UserAgent object
55              
56             =head2 do
57              
58             my $res = $req->do;
59              
60             Do itself as http/https request with agent. Then returns a response object.
61              
62             =head1 LICENSE
63              
64             Copyright (C) ytnobody.
65              
66             This library is free software; you can redistribute it and/or modify
67             it under the same terms as Perl itself.
68              
69             =head1 AUTHOR
70              
71             ytnobody Eytnobody@gmail.comE
72              
73             =cut
74