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   90 use strict;
  21         28  
  21         684  
3 21     21   93 use warnings;
  21         27  
  21         622  
4 21     21   78 use base 'MogileFS::Factory';
  21         25  
  21         7070  
5              
6 21     21   6529 use MogileFS::Domain;
  21         44  
  21         2277  
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;