File Coverage

gen/generate
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 1     1   586 use strict;
  1         1  
  1         36  
4 1     1   860 use PerlBean;
  1         4  
  1         26  
5 1     1   505 use PerlBean::Collection;
  1         2  
  1         22  
6 1     1   5 use PerlBean::Method;
  1         1  
  1         17  
7 1     1   691 use PerlBean::Attribute::Factory;
  1         3  
  1         31  
8 1     1   6 use PerlBean::Style;
  1         3  
  1         46  
9 1     1   7 use PerlBean::Symbol;
  1         2  
  1         22  
10 1     1   519 use PerlBean::Described::ExportTag;
  1         2  
  1         374  
11              
12             # Bean description array
13             @::bean_desc = ();
14              
15             # Add descriptions to bean description array
16             foreach my $fn () {
17             require $fn;
18             }
19              
20             # Make bean collection
21             my $collection = PerlBean::Collection->new( {
22             license => <
23             This file is part of the C module hierarchy for Perl by
24             Vincenzo Zocca.
25              
26             The PerlBean module hierarchy is free software; you can redistribute it
27             and/or modify it under the terms of the GNU General Public License
28             as published by the Free Software Foundation; either version 2 of
29             the License, or (at your option) any later version.
30              
31             The PerlBean module hierarchy is distributed in the hope that it will
32             be useful, but WITHOUT ANY WARRANTY; without even the implied
33             warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34             See the GNU General Public License for more details.
35              
36             You should have received a copy of the GNU General Public License
37             along with the PerlBean module hierarchy; if not, write to
38             the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
39             Boston, MA 02111-1307 USA
40             EOF
41             } );
42              
43             # Make attribute factory
44             my $factory = PerlBean::Attribute::Factory->new();
45              
46             # Add beans to collection
47             foreach my $bean_desc (@::bean_desc) {
48              
49             # Back reference collection
50             $bean_desc->{bean_opt}{collection} = $collection;
51              
52             # Creat bean
53             my $bean = PerlBean->new( $bean_desc->{bean_opt} );
54              
55             # Add bean to collection
56             $collection->add_perl_bean($bean);
57              
58             # Add attributes to bean
59             foreach my $attr_opt ( @{ $bean_desc->{attr_opt} } ) {
60             my $attr = $factory->create_attribute($attr_opt);
61             $bean->add_method_factory($attr);
62             }
63              
64             # Add methods to bean
65             foreach my $meth_opt ( @{ $bean_desc->{meth_opt} } ) {
66             my $meth = PerlBean::Method->new($meth_opt);
67             $bean->add_method($meth);
68             }
69              
70             # Add symbols to bean
71             foreach my $sym_opt ( @{ $bean_desc->{sym_opt} } ) {
72             my $sym = PerlBean::Symbol->new($sym_opt);
73             $bean->add_symbol($sym);
74             }
75              
76             # Add tag descriptions to bean
77             foreach my $tag_opt ( @{ $bean_desc->{tag_opt} } ) {
78             my $tdesc = PerlBean::Described::ExportTag->new($tag_opt);
79             $bean->add_export_tag_description($tdesc);
80             }
81              
82             # Add dependencies to bean
83             foreach my $use_opt ( @{ $bean_desc->{use_opt} } ) {
84             my $dep = PerlBean::Dependency::Use->new($use_opt);
85             $bean->add_dependency($dep);
86             }
87             }
88              
89             # Revove the old tmp directory
90             system('rm -rf tmp');
91              
92             # Revove the old auto directory
93             system('rm -rf auto');
94              
95             # Make a new tmp directory
96             mkdir('tmp');
97              
98             # Make a new auto directory
99             mkdir('auto');
100              
101             # Write the hierarch
102             $collection->write('tmp');
103              
104             # Return a true value
105             1;