« blib/lib/auto/share/dist/Perl-Dist/default/perl-5.8.8/lib/ExtUtils/Packlist.pm
↑ Summary
blib/lib/auto/share/dist/Perl-Dist/vanilla/perl-5.10.0/lib/Config.pm »
| 1 | package Perl::Dist::Asset::Website; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Params::Util qw{ _STRING }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars qw{$VERSION}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | $VERSION = '1.16'; | |||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Object::Tiny qw{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | name | ||||||||||||||||||||||||||||
| 14 | url | ||||||||||||||||||||||||||||
| 15 | icon_file | ||||||||||||||||||||||||||||
| 16 | icon_index | ||||||||||||||||||||||||||||
| 17 | 1 | }; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | ##################################################################### | ||||||||||||||||||||||||||||
| 24 | # Constructor | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | my $self = shift->SUPER::new(@_); | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # If we have an icon, default to the first one in it | ||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ( defined $self->icon_file and ! defined $self->icon_index ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->icon_file and not defined $self->icon_index
MC/DC0%0/2
defined $self->icon_file and not defined $self->icon_index
defined $self->icon_file
not defined $self->icon_index
Truth table0%0/3
A and not(B)
A= defined $self->icon_fileB= not defined $self->icon_index
| |||||||||||||||||||||||||||||
| 31 | 0 | $self->{icon_index} = 0; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # Check params | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | unless ( _STRING($self->name) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | croak("Did not provide a name"); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless ( _STRING($self->url) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | croak("Did not provide a URL"); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return $self; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub file { | ||||||||||||||||||||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | $_[0]->name . '.url'; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub content { | ||||||||||||||||||||||||||
|
Subroutine
content: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 51 | 0 | my @content = "[InternetShortcut]\n"; | |||||||||||||||||||||||||||
| 52 | 0 | push @content, "URL=" . $self->url; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ( $self->icon_file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | push @content, "IconFile=" . $self->icon_file; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if ( $self->icon_index ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | push @content, "IconIndex=" . $self->icon_index; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 0 | return join '', map { "$_\n" } @content; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub write { | ||||||||||||||||||||||||||
|
Subroutine
write: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 64 | 0 | my $to = shift; | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | open( WEBSITE, ">$to" ) or die "open($to): $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | print WEBSITE $self->content or die "print($to): $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | close WEBSITE or die "close($to): $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 0 | return 1; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1 | 1; | |||||||||||||||||||||||||||