Database.pm

filter: Statementstmt 69.3% 34 / 49 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 72.7% 8 / 11 Podpod 0.0% 0 / 3 totaltotal 47.1% 42 / 89 CC 9 SCAR 27.9
CC
9
Cov
49%
create
30.0
drop
30.0
new
2.0
CRAP 16.3
« Database/Tables.pm ↑ Summary Database/Config.pm »
1 package XML::Database;
2
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 1 require Exporter;
8 #use AutoLoader qw(AUTOLOAD);
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 1 our @ISA = qw(Exporter);
12
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
16
17 # This allows declaration use XML::Database ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
19 # will save memory.
20 1 our %EXPORT_TAGS = ( 'all' => [ qw(
21
22 ) ] );
23
24 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25
26 1 our @EXPORT = qw(
27
28 );
29 1 our $VERSION = '0.01';
30
31
32 # Preloaded methods go here.
33 1 ▶use lib "C:/Documents and Settings/isterin/Desktop";
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶use XML::Database::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 my $xmlconfig = XML::Database::Config->new();
36
37 1 ▶use XML::Database::Tables;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 my $xmltables = XML::Database::Tables->new();
39
40 1 ▶use XML::Database::DTD;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 my $xmldtd = XML::Database::DTD->new();
42
43
44 sub new
45 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
46 0 my $self = shift;
47 0 my %args = (@_);
48 0 return bless \%args, $self;
49 }
50
51 sub create
52 0 ▶{
Subroutine create: not called CC=5 SCAR=34.0
Pod undocumented
53 0 my $self = shift;
54 0 my %args = (@_);
55 0 %$self = (%$self, %args);
56
57 Carp::croak("Usage: ...->create(Name => ..., Directory => ...)")
58 0 ▶ unless(ref $self && $self->{Name} && $self->{Directory});
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self and $self->{"Name"} and $self->{"Directory"} 0 0 0
Condition0%0/6
ref $self and $self->{"Name"} and $self->{"Directory"}
!ll&&!rl&&r
000
ref $self and $self->{"Name"}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $self and $self->{"Name"} and $self->{"Directory"}
ref $self $self->{"Name"} $self->{"Directory"}
Truth table0%0/4
A and B and C
A= ref $selfB= $self->{"Name"}C= $self->{"Directory"}
ABCresult
0XX0
10X0
1100
1111
59
60 0 ▶ mkdir("$self->{Directory}/$self->{Name}") ||
Branch: 1 branch
BranchTrueFalseTotal
mkdir qq[$self->{"Directory"}/$self->{"Name"}] or Carp::croak(qq[Error creating a database in $self->{"Directory"}/$self->{"Name"}: $!]) 0 0 0
61 Carp::croak("Error creating a database in $self->{Directory}/$self->{Name}: $!");
62
63 0 $xmlconfig->writeMain(Database => $self);
64 }
65
66 sub drop
67 0 ▶{
Subroutine drop: not called CC=5 SCAR=34.0
Pod undocumented
68 0 my $self = shift;
69 0 my %args = (@_);
70 0 %$self = (%$self, %args);
71
72 Carp::croak("Usage: ...->create(DB_name, DB_dir)")
73 0 ▶ unless(ref $self && $self->{Name} && $self->{Directory});
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self and $self->{"Name"} and $self->{"Directory"} 0 0 0
Condition0%0/6
ref $self and $self->{"Name"} and $self->{"Directory"}
!ll&&!rl&&r
000
ref $self and $self->{"Name"}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $self and $self->{"Name"} and $self->{"Directory"}
ref $self $self->{"Name"} $self->{"Directory"}
Truth table0%0/4
A and B and C
A= ref $selfB= $self->{"Name"}C= $self->{"Directory"}
ABCresult
0XX0
10X0
1100
1111
74
75 0 require File::Path;
76 0 ▶ File::Path::rmtree("$self->{Directory}/$self->{Name}") ||
Branch: 1 branch
BranchTrueFalseTotal
File::Path::rmtree(qq[$self->{"Directory"}/$self->{"Name"}]) or Carp::croak(qq[Error deleting a database in $self->{"Directory"}/$self->{"Name"}: $!]) 0 0 0
77 Carp::croak("Error deleting a database in $self->{Directory}/$self->{Name}: $!");
78 }
79
80
81 # Autoload methods go after =cut, and are processed by the autosplit program.
82
83 1 1;
84 __END__
« Database/Tables.pm ↑ Summary Database/Config.pm »