Skip to content

Commit

Permalink
Merge pull request #21 from CPAN-API/oalders/domain
Browse files Browse the repository at this point in the history
oalders/domain
  • Loading branch information
mickeyn committed Oct 15, 2014
2 parents 6a140f1 + a28c5ec commit a959d4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/MetaCPAN/Client.pm
Expand Up @@ -31,6 +31,8 @@ sub BUILDARGS {

$args{'request'} ||= MetaCPAN::Client::Request->new(
( ua => $args{'ua'} ) x !! $args{'ua'},
$args{domain} ? ( domain => $args{domain} ) : (),
$args{version} ? ( version => $args{version} ) : (),
);

return \%args;
Expand Down Expand Up @@ -296,7 +298,7 @@ __END__
# simple usage
my $mcpan = MetaCPAN::Client->new();
my $author = $mcpan->author('XSAWYERX');
my $dist = $mcpan->distribuion('MetaCPAN-Client');
my $dist = $mcpan->distribution('MetaCPAN-Client');
# advanced usage with cache (contributed by Kent Fredric)
use CHI;
Expand Down
6 changes: 5 additions & 1 deletion t/request.t
Expand Up @@ -3,7 +3,8 @@
use strict;
use warnings;

use Test::More tests => 7;
use Test::More tests => 9;
use MetaCPAN::Client;
use MetaCPAN::Client::Request;

my $req = MetaCPAN::Client::Request->new( domain => 'mydomain', version => 'z' );
Expand All @@ -27,3 +28,6 @@ is_deeply(
'Correct UA args',
);

my $client = MetaCPAN::Client->new( domain => 'foo', version => 'bar' );
is ( $client->request->domain, 'foo', 'domain set in request' );
is ( $client->request->version, 'bar', 'version set in request' );

0 comments on commit a959d4a

Please sign in to comment.