File Coverage

blib/lib/Net/HTTP/Spore/Middleware/BaseUrl.pm
Criterion Covered Total %
statement 3 5 60.0
branch n/a
condition n/a
subroutine 1 2 50.0
pod 0 1 0.0
total 4 8 50.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of Net-HTTP-Spore-Middleware-BaseUrl
3             #
4             # This software is copyright (c) 2013 by Weborama.
5             #
6             # This is free software; you can redistribute it and/or modify it under
7             # the same terms as the Perl 5 programming language system itself.
8             #
9             package Net::HTTP::Spore::Middleware::BaseUrl;
10             {
11             $Net::HTTP::Spore::Middleware::BaseUrl::VERSION = '0.02';
12             }
13              
14             #ABSTRACT: Spore Middleware to change the base_url on the fly
15              
16 1     1   40530 use Moose;
  1         1002492  
  1         10  
17             extends 'Net::HTTP::Spore::Middleware';
18              
19             has base_url => ( is => 'ro', isa => 'Str', required => 1 );
20              
21             sub call {
22 0     0 0   my ( $self, $req ) = @_;
23              
24 0           $req->host( $self->base_url );
25             }
26              
27             1;
28              
29              
30             =pod
31              
32             =head1 NAME
33              
34             Net::HTTP::Spore::Middleware::BaseUrl - Spore Middleware to change the base_url on the fly
35              
36             =head1 VERSION
37              
38             version 0.02
39              
40             =head1 SYNOPSIS
41              
42             my $client = Net::HTTP::Spore->new_from_spec('api.json');
43             $client->enable( 'BaseUrl',
44             base_url => 'www.perl.org',
45             );
46              
47             =head1 NAME
48              
49             Net::HTTP::Spore::Middleware::BaseUrl - Spore Middleware to change the base_url on the fly
50              
51             =head1 AUTHOR
52              
53             Tiago Peczenyj <tiago.peczenyj@gmail.com>
54              
55             =head1 COPYRIGHT AND LICENSE
56              
57             This software is copyright (c) 2013 by Weborama.
58              
59             This is free software; you can redistribute it and/or modify it under
60             the same terms as the Perl 5 programming language system itself.
61              
62             =cut
63              
64              
65             __END__