File Coverage

blib/lib/XUL/App/XPIFile.pm
Criterion Covered Total %
statement 15 27 55.5
branch 0 4 0.0
condition n/a
subroutine 5 7 71.4
pod 1 2 50.0
total 21 40 52.5


line stmt bran cond sub pod time code
1             package XUL::App::XPIFile;
2              
3 1     1   1388 use strict;
  1         2  
  1         37  
4 1     1   7 use warnings;
  1         2  
  1         30  
5 1     1   1581 use XUL::App::View::Install;
  1         4  
  1         114  
6 1     1   1195 use File::Slurp;
  1         18389  
  1         67  
7              
8 1     1   9 use base 'Class::Accessor::Fast';
  1         2  
  1         245  
9             __PACKAGE__->mk_accessors(qw{
10             id name display_name description version targets
11             creator contributors developers
12             homepageURL updateURL iconURL aboutURL
13             });
14              
15             sub new {
16 0     0 1   my $proto = shift;
17 0           my $self = $proto->SUPER::new(@_);
18 0 0         if ($self->id) {
19 0           $XUL::App::ID = $self->id;
20 0 0         if ($self->name =~ /\.xpi$/i) {
21 0           die "You have to define a name for your plugin";
22             }
23 0           $XUL::App::APP_NAME = lc($self->name);
24             }
25 0           return $self;
26             }
27              
28             sub go {
29 0     0 0   my ($self, $file) = @_;
30             # generate tmp/install.rdf here:
31 0           Template::Declare->init( roots => ['XUL::App::View::Install'] );
32 0           my $rdf = Template::Declare->show('main', $self);
33 0           write_file('tmp/install.rdf', $rdf);
34             }
35              
36             1;
37