App-DualLivedList

 view release on metacpan or  search on metacpan

bin/dual-lived  view on Meta::CPAN

    ANDK
    ANDYA
    AUDREYT
    BDFOY
    BINGOS
    BLM
    CHORNY
    CORION
    DAGOLDEN
    DANKOGAI
    DLAND
    DROLSKY
    DWHEELER
    ELIZABETH
    FERREIRA
    FLORA
    GAAS
    GBARR
    ILYAZ
    JDB
    JDHEDDEN
    JESSE
    JHI
    JSTOWE
    JV
    KANE
    LDS
    MAKAMAKA
    MAREKR
    MARKM
    MHX
    MJD
    MSERGEANT
    MSCHWERN
    MSHELOR
    MUIR
    N/A
    NWCLARK
    NUFFIN
    PJF
    PMQS
    RURBAN
    RGARCIA
    RKOBES
    RMBARKER
    RRA
    SADAHIRO
    SAPER
    SBECK
    SBURKE
    SIMONW
    SMUELLER
    TJENNESS
    TODDR
    TOMHUGHES
    YVES);

my (@matches) = grep( ( $_ eq $d ), @mods );
if (@matches) {

    for $d ( CPAN::Shell->expand( "Module", "$d" ) ) {
        $print->bold_black( "\n\tmodule: ", $d->id ),
            $print->dark_blue( "\tauthor: ",          $d->cpan_userid ),
            $print->dark_blue( "\tcurrent version: ", $d->cpan_version ),
            $print->dark_red( "\tinstalled version: ", $d->inst_version ),
            $print->dark_red( "\t",                    $d->inst_file );
    }
    $print->dark_magenta("\t@matches is core and is Dual-Lived");
}
else {
    for $d ( CPAN::Shell->expand( "Module", $d ) ) {
        $print->bold_black( "\n\tmodule: ", $d->id ),
            $print->dark_blue( "\tauthor: ",             $d->cpan_userid ),
            $print->dark_blue( "\tcurrent version is: ", $d->cpan_version ),
            $print->dark_red( "\tinstalled version: ", $d->inst_version ),
            $print->dark_red( "\t",                    $d->inst_file ),
            ;
    }
    print "\tIt's not on the Dual-Lived list", "\n";
}

print "\tFetching more details...\n";

my @d = Module::CoreList->find_modules(qr/^$d$/);
if (Module::CoreList::is_core($d)) {
     system("corelist $d");
}

else {
    print "\t$d is not core\n";
}

my $package = 'dual-lived';
my ( $name, $version ) = qw(App::DualLivedList 0.00_07);

my $verbose = 1;
my $debug   = 1;
my $trace   = 1;
my $test    = 1;

app_options();

$trace |= ( $debug || $test );

my $TMPDIR = $ENV{TMPDIR} || $ENV{TEMP} || '/usr/tmp';
exit 0;

sub app_options {
    Getopt::Long::Configure('bundling');
    GetOptions(
        'A|alpha'        => \&cpan_id,
        'a|authors'      => \&authors,
        'd|distribution' => \&distribution,
        'f|filestats'    => \&filestats,
        'l|list'         => \&list,
        'm|mods'         => \&modlist,
        'u|update'       => \&update,
        'v|version'      => \&version
    ) or Getopt::Long::HelpMessage(2);
}

sub version {
    print STDOUT ("This is $package [$name $version]\n");
}

sub list {
    print "module: ", "\n";
    foreach my $mod (@mods) {
        for $mod ( CPAN::Shell->expand( "Module", $mod ) ) {
            $print->bold_black( $mod->id );
        }
    }
}

sub update {
    CPAN::Shell->install($d);
}

sub filestats {

    use File::CountLines qw(count_lines);
    use Number::Bytes::Human qw(format_bytes);

    my $h = Number::Bytes::Human->new;
    for $d ( CPAN::Shell->expand( "Module", $d ) ) {
        my $size = $h->format( -s $d->inst_file );
        print "Installed size: ", $size, "\n";
        my $path     = ( $d->inst_file );
        my $no_lines = count_lines($path);
        print "Number of lines: ", $no_lines, "\n";
        print "Number of words: ";
        system("wc -w $path");
    }
}

sub authors {
    foreach my $mod (@mods) {
        for $mod ( CPAN::Shell->expand( "Module", $mod ) ) {
            $print->dark_blue( $mod->cpan_userid );
        }
    }
}

sub distribution {
    my $distribution
        = CPAN::Shell->expand( "Module", $d )->distribution()->pretty_id($d);
    print $distribution, "\n";

    CPAN::Index->reload();
    my @modules = CPAN::Shell->expand( "Distribution", $distribution )
        ->containsmods();
    foreach my $module (@modules) {
        print $module, "\n";
    }
}

sub cpan_id {
    foreach my $author (@authors) {
        $print->dark_blue($author);
    }
}

sub modlist {
    foreach my $mod (@mods) {
        $print->dark_blue($mod);
    }
}



( run in 0.698 second using v1.01-cache-2.11-cpan-5b529ec07f3 )