Memoir44/Url.pm

filter: Statementstmt 75.0% 24 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod n/a totaltotal 77.5% 31 / 40 CC 1 SCAR 1.2
CC
1
Cov
75%
_build__uri
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Memoir44/App.pm ↑ Summary Memoir44/Utils.pm »
1 #
2 # This file is part of WWW-DaysOfWonder-Memoir44
3 #
4 # This software is copyright (c) 2009 by Jerome Quelin.
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 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 package WWW::DaysOfWonder::Memoir44::Url;
14 # ABSTRACT: encapsulation of days of wonder urls
15 2 $WWW::DaysOfWonder::Memoir44::Url::VERSION = '3.000';
16 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use MooseX::Has::Sugar;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use overload q{""} => 'as_string';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 # -- attributes
24  
25  
26 2 has source => ( ro, isa=>'Str', required );
27 2 has _uri => ( ro, isa=>'URI', lazy_build, handles=>['as_string'] );
28  
29  
30 # -- initializers & builders
31  
32 0 ▶sub _build__uri {
Subroutine _build__uri: not called CC=1 SCAR=6.9
33 0 my $self = shift;
34 0 my $uri = URI->new;
35 0 $uri->scheme( 'http' );
36 0 $uri->host( 'www.daysofwonder.com' );
37 0 $uri->path( '/memoir44/en/scenario_list/' );
38  
39 # canonical url:
40 # http://www.daysofwonder.com/memoir44/en/scenario_list/?&start=0&page_limit=2000
41 # other valid http options:
42 # status game = shipped, approved = official, public = non-dow, classified = restricted
43 # selpack_tp terrain pack
44 # selpack_ef east front
45 # selpack_pt pacific theater
46 # selpack_ap air pack
47 # selpack_mt mediterranean theater
48 # selpack_bm battle map
49 # selpack_cb carnets campagne
50 # with values: 0 = undef, 1 = with, 2 = without
51 # eg: selpack_tp=1&selpack_ef=2
52 0 my %options = (
53 start => 0,
54 page_limit => 5000,
55 status => $self->source,
56 );
57  
58 0 $uri->query_form( \%options );
59 0 return $uri;
60 }
61  
62  
63 # -- public methods
64  
65  
66 # handled by _uri attribute
67  
68  
69 2 1;
70  
71 __END__
« Memoir44/App.pm ↑ Summary Memoir44/Utils.pm »