File Coverage

blib/lib/MogileFS/Factory/Domain.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 27 59.2


line stmt bran cond sub pod time code
1             package MogileFS::Factory::Domain;
2 21     21   155 use strict;
  21         47  
  21         837  
3 21     21   134 use warnings;
  21         51  
  21         866  
4 21     21   122 use base 'MogileFS::Factory';
  21         45  
  21         12213  
5              
6 21     21   10915 use MogileFS::Domain;
  21         66  
  21         3273  
7              
8             sub set {
9 0     0 0   my ($self, $args) = @_;
10 0           my $classfactory = MogileFS::Factory::Class->get_factory;
11 0           my $dom = $self->SUPER::set(MogileFS::Domain->new_from_args($args, $classfactory));
12              
13             # Stupid awkward classes have a magic "default"
14             # If it exists in the DB, it will be overridden.
15 0           my $cls = $classfactory->get_by_id($dom->id, 0);
16 0 0         unless ($cls) {
17 0           $classfactory->set({ dmid => $dom->id, classid => 0,
18             classname => 'default',
19             mindevcount => MogileFS->config('default_mindevcount')});
20             }
21 0           return $dom;
22             }
23              
24             1;