IEFavorites/Item.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« IEFavorites/DateTime.pm ↑ Summary
1 package Win32::IEFavorites::Item;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 our $VERSION = '0.06';
7  
8 1 ▶use Config::IniFiles;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 0 ▶use Win32::IEFavorites::DateTime;
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 sub new {
12 my ($class, $path) = @_;
13  
14 bless {
15 path => $path,
16 cached => 0,
17 datetime => undef,
18 }, $class;
19 }
20  
21 sub _value {
22 my ($self, $type) = @_;
23 $self->_load unless $self->{cached};
24  
25 $self->{$type};
26 }
27  
28 sub _load {
29 my $self = shift;
30 my $ini = Config::IniFiles->new( -file => $self->{path} );
31 foreach my $type (qw/URL Modified IconFile IconIndex/) {
32 if (defined $ini) {
33 $self->{lc($type)} = $ini->val('InternetShortcut',$type) || '';
34 } else {
35 $self->{lc($type)} = '';
36 }
37 }
38 $self->{cached} = 1;
39 }
40  
41 sub path { $_[0]->{path}; }
42 sub url { $_[0]->_value('url'); }
43 sub iconfile { $_[0]->_value('iconfile'); }
44 sub iconindex { $_[0]->_value('iconindex'); }
45  
46 sub modified {
47 my $self = shift;
48 unless ($self->{datetime}) {
49 my $modified = $self->_value('modified');
50 $self->{datetime} = Win32::IEFavorites::DateTime->new($modified);
51 }
52 $self->{datetime};
53 }
54  
55 1;
56 __END__
« IEFavorites/DateTime.pm ↑ Summary