OpenInteract2/Manage/Website/RemovePackage.pm

filter: Statementstmt 50.0% 15 / 30 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 4 totaltotal 42.5% 20 / 47 CC 5 SCAR 26.6
CC
5
Cov
42%
run_task
30.0
get_brief_description
2.0
BEGIN
1.0
CRAP 14.3
« OpenInteract2/Manage/Website/PackageCheckExportInstall.pm ↑ Summary OpenInteract2/Manage/Website/ListObjects.pm »
1 package OpenInteract2::Manage::Website::RemovePackage;
2  
3 # $Id: RemovePackage.pm,v 1.7 2005/03/17 14:58:04 sjn Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( OpenInteract2::Manage::Website );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use OpenInteract2::Context qw( CTX );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 87 $OpenInteract2::Manage::Website::RemovePackage::VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
10  
11 87 ▶sub get_name {
Subroutine get_name: called CC=1 SCAR=0.0
Pod undocumented
12 87 return 'remove_package'
13 }
14  
15 0 ▶sub get_brief_description {
Subroutine get_brief_description: not called CC=1 SCAR=6.9
Pod undocumented
16 0 return 'Remove a package from a website';
17 }
18  
19 1 ▶sub get_parameters {
Subroutine get_parameters: called CC=1 SCAR=0.0
Pod undocumented
20 1 my ( $self ) = @_;
21 return {
22 1 website_dir => $self->_get_website_dir_param,
23 package => $self->_get_package_param,
24 };
25 }
26  
27 0 ▶sub run_task {
Subroutine run_task: not called CC=5 SCAR=34.0
Pod undocumented
28 0 my ( $self ) = @_;
29 0 my $repository = CTX->repository;
30 0 my $package_param = $self->param( 'package' );
31 my @package_names = ( ref $package_param eq 'ARRAY' )
32 0 ▶ ? @{ $package_param } : ( $package_param );
Branch: 1 branch
BranchTrueFalseTotal
ref $package_param eq 'ARRAY' ? : 0 0 0
33 0 foreach my $name ( @package_names ) {
34 0 ▶ next unless ( $name );
Branch: 1 branch
BranchTrueFalseTotal
unless $name 0 0 0
35 0 my $package = $repository->fetch_package( $name );
36 0 eval { $repository->remove_package( $package ) };
37 0 my $action = "remove package $name";
38 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
39 0 $self->_fail( $action, "Error: $@" );
40 }
41 else {
42 0 $self->_ok( $action, "Package removed" );
43 }
44 }
45 }
46  
47 87 OpenInteract2::Manage->register_factory_type( get_name() => __PACKAGE__ );
48  
49 87 1;
50  
51 __END__
« OpenInteract2/Manage/Website/PackageCheckExportInstall.pm ↑ Summary OpenInteract2/Manage/Website/ListObjects.pm »