| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of App-Magpie | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2011 by Jerome Quelin. | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use 5.012; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | package App::Magpie::App::Command::old; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # ABSTRACT: report installed perl modules with new version available | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | $App::Magpie::App::Command::old::VERSION = '2.010'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Text::Padding; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use App::Magpie::App -command; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | # -- public methods | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub description { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | "Report installed Perl modules with new version available on CPAN." | |||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub opt_spec { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 30 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | [], | |||||||||||||||||||||||||||||||||||||||||
| 32 | $self->verbose_options, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my ($self, $opts, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->log_init($opts); | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | require App::Magpie::Action::Old; | |||||||||||||||||||||||||||||||||||||||||
| 41 | my @oldsets = | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | sort { $a->name cmp $b->name } | |||||||||||||||||||||||||||||||||||||||||
| 43 | App::Magpie::Action::Old->new->run; | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $pad = Text::Padding->new; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my @ignored; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | foreach my $set ( @oldsets ) { | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ( $set->name eq "ignored" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | @ignored = $set->all_modules; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $label = $set->name; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $details; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ( $label eq "core" || $label eq "orphan" || $label eq "strange" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$label eq "core" or $label eq "orphan" or $label eq "strange"
$label eq "core" or $label eq "orphan"
MC/DC0%0/3
$label eq "core" or $label eq "orphan" or $label eq "strange"
$label eq "core"
$label eq "orphan"
$label eq "strange"
Truth table0%0/4
A or B or C
A= $label eq "core"B= $label eq "orphan"C= $label eq "strange"
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $details = $set->nb_modules . " modules"; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $details = $set->nb_packages . " packages (" . $set->nb_modules . " modules)"; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | say "** $label packages: $details"; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | say ''; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 64 | MODULE: | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | foreach my $module ( sort $set->all_modules ) { | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my @pkgs = $module->packages; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ( scalar(@pkgs) == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | say encode( 'utf-8', | |||||||||||||||||||||||||||||||||||||||||
| 69 | $pad->left ( $module->name, 40 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 70 | $pad->right( $module->oldver, 14 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 71 | $pad->right( $module->newver, 14 ) | ||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 73 | } elsif ( scalar(@pkgs) == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $pkg = shift @pkgs; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | next MODULE if $seen{ $pkg->name }++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | say encode( 'utf-8', | |||||||||||||||||||||||||||||||||||||||||
| 77 | $pad->left ( $module->name, 40 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 78 | $pad->right( $module->oldver, 14 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 79 | $pad->right( $module->newver, 14 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 80 | " " x 5 . | ||||||||||||||||||||||||||||||||||||||||||
| 81 | $pad->left ( $pkg->name, 50 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 82 | $pad->right( $pkg->version, 14 ) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 84 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | my @details = | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | map { $_->name . "(" . $_->version . ")" } | |||||||||||||||||||||||||||||||||||||||||
| 87 | @pkgs; | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | say encode( 'utf-8', | |||||||||||||||||||||||||||||||||||||||||
| 89 | $pad->left ( $module->name, 40 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 90 | $pad->right( $module->oldver, 14 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 91 | $pad->right( $module->newver, 14 ) . | ||||||||||||||||||||||||||||||||||||||||||
| 92 | " " x 5 . | ||||||||||||||||||||||||||||||||||||||||||
| 93 | join( ",", @details ) | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | say ''; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ( @ignored ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | say "** ignored modules: " . scalar(@ignored) . "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | print join ", ", map { $_->name ."(" . $_->newver . ")" } @ignored; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | say ''; | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | __END__ | ||||||||||||||||||||||||||||||||||||||||||