2ch/Setting.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 CC 3 SCAR 19.5
CC
3
Cov
0%
load
12.0
new
2.0
BEGIN
2.0
CRAP 7.0
1 package WWW::2ch::Setting;
2 use strict;
3  
4 use base qw( Class::Accessor::Fast );
5 __PACKAGE__->mk_accessors( qw( c url config title noname image) );
6  
7  
8 sub new {
9 my $class = shift;
10 my $c = shift;
11 my $url = shift;
12  
13 my $self = bless {c => $c, url => $url}, $class;
14  
15 $self;
16 }
17  
18 sub load {
19 my $self = shift;
20  
21 return 0 unless $self->c && $self->url;
22 my $res = $self->c->ua->get($self->url);
23 return 0 unless $res->is_success;
24  
25 my $config = $self->c->worker->parse_setting($res->content);
26 $self->config($config);
27 $self->title($config->{title});
28 $self->noname($config->{noname});
29 $self->image($config->{image});
30
31 return 1;
32 }
33  
34 1;