OpenInteract2/App.pm

filter: Statementstmt 55.3% 26 / 47 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 58.3% 7 / 12 Podpod 0.0% 0 / 4 totaltotal 48.5% 33 / 68 CC 2 SCAR 7.3
CC
2
Cov
52%
_must_implement
6.0
list_apps
2.0
init
2.0
CRAP 2.1
« OpenInteract2/Manage/Website/InstallPackageSql.pm ↑ Summary OpenInteract2/Action/TemplateOnly.pm »
1 package OpenInteract2::App;
2  
3 # $Id: App.pm,v 1.3 2005/03/13 18:35:03 lachoy Exp $
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw( Class::Factory Class::Accessor::Fast );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use OpenInteract2::Brick;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use OpenInteract2::Config::Package;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use OpenInteract2::Exception qw( oi_error );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use OpenInteract2::Manage;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use OpenInteract2::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 $OpenInteract2::App::VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
14  
15 1 my @FIELDS = qw(
16 name version module_dependencies
17 author_names author_emails url has_sql_structures
18 );
19 1 __PACKAGE__->mk_accessors( @FIELDS );
20  
21 # CLASS METHODS
22  
23 0 ▶sub list_apps {
Subroutine list_apps: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my ( $class ) = @_;
25 0 return $class->list_registered_types;
26 }
27  
28  
29 # OBJECT METHODS
30  
31 0 ▶sub init {
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my ( $self ) = @_;
33 0 my $brick = OpenInteract2::Brick->new( $self->get_brick_name );
34 0 my $package_ini_info = $brick->load_resource( 'package.ini' );
35 my $package_conf = OpenInteract2::Config::Package->new({
36 content => $package_ini_info->{content},
37 0 });
38 0 $self->name( $package_conf->name );
39 0 $self->version( $package_conf->version );
40 0 $self->module_dependencies( $package_conf->module );
41 0 $self->author_names( [ $package_conf->author_names ] );
42 0 $self->author_emails( [ $package_conf->author_emails ] );
43 0 $self->url( $package_conf->url );
44  
45 0 my $manifest_info = $brick->load_resource( 'MANIFEST' );
46 0 my @struct_files = grep /^struct/, split /\r?\n/, $manifest_info->{content};
47 0 $self->has_sql_structures( scalar @struct_files );
48 0 return $self;
49 }
50  
51  
52 0 ▶sub install { _must_implement( 'install', @_ ) }
Subroutine install: not called CC=1 SCAR=6.9
Pod undocumented
53 0 ▶sub get_brick_name { _must_implement( 'get_brick_name', @_ ) }
Subroutine get_brick_name: not called CC=1 SCAR=6.9
Pod undocumented
54  
55 0 ▶sub _must_implement {
Subroutine _must_implement: not called CC=2 SCAR=17.9
56 0 my ( $method, $item ) = @_;
57 0 ▶ my $class = ref( $item ) || $item;
Condition0%0/3
ref $item || $item
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $item || $item
ref $item $item
Truth table0%0/3
A || B
A= ref $itemB= $item
ABresult
1X1
011
000
58 0 oi_error "Class '$class' must implement method '$method'";
59 }
60  
61 1 OpenInteract2::Util->find_factory_subclasses( 'OpenInteract2::App' );
62  
63 1 1;
64  
65 __END__
« OpenInteract2/Manage/Website/InstallPackageSql.pm ↑ Summary OpenInteract2/Action/TemplateOnly.pm »