lib/Mail/Decency/Core/DatabaseCreate.pm

filter: Statementstmt 38.1% 8 / 21 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 35.4% 11 / 31 CC 5 SCAR 30.8
CC
5
Cov
30%
print_sql
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 21.7
« lib/Mail/Decency/Core/SessionItem.pm ↑ Summary lib/Mail/Decency/Core/Meta/Database.pm »
1 package Mail::Decency::Core::DatabaseCreate;
2  
3 20 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 20 ▶use version 0.74; our $VERSION = qv( "v0.1.4" );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Mail::Decency::Core::Meta::DatabaseCreate
10  
11 =head1 DESCRIPTION
12  
13 Prints SQL CREATE statements for module and server databases. Of course, only for DBD databases..
14  
15 =head1 METHODS
16  
17  
18 =head2 print_sql
19  
20 Print SQL "CREATE *" statements.
21  
22 =cut
23  
24 0 ▶sub print_sql {
Subroutine print_sql: not called CC=5 SCAR=34.0
Pod documented
25 0 my ( $self ) = @_;
26
27 0 print "-- SQL START\n\n";
28
29 0 foreach my $child( @{ $self->childs }, $self ) {
30 0 ▶ next unless $child->can( 'schema_definition' );
Branch: 1 branch
BranchTrueFalseTotal
unless $child->can("schema_definition") 0 0 0
31 0 my $definition_ref = $child->schema_definition;
32 0 print "-- For: $child\n";
33 0 ▶ while( my ( $schema, $tables_ref ) = each %$definition_ref ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$definition_ref) 0 0 0
34 0 ▶ while ( my ( $table, $columns_ref ) = each %$tables_ref ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$tables_ref) 0 0 0
35 0 $child->database->setup( $schema => $table => $columns_ref, 0 );
36 0 print "\n";
37 }
38 }
39 0 print "\n";
40 }
41
42 0 print "\n-- SQL END\n";
43 }
44  
45 =head1 AUTHOR
46  
47 Ulrich Kautz <uk@fortrabbit.de>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2010 the L</AUTHOR> as listed above
52  
53 =head1 LICENCSE
54  
55 This library is free software and may be distributed under the same terms as perl itself.
56  
57 =cut
58  
59  
60 20 1;
« lib/Mail/Decency/Core/SessionItem.pm ↑ Summary lib/Mail/Decency/Core/Meta/Database.pm »