-----BEGIN PGP SIGNED MESSAGE-----

On Fri, 27 Aug 1999, Seth R Arnold wrote:

> Paul -- such a system sort of exists -- the popularity contest
> package, which reports via email the most commonly used packages. I
> haven't a clue how that thing works, I haven't looked into its source
> code yet; however, I think you are absolutely right in one respect --
> those seldom used packages, I installed because I thought they would
> be cool/useful/neat, whatever -- if I never use it, I must have
> forgotten about it. Something to email me a weekly basis the packages
> I *didn't* use, might be extremely helpful. Anyone care to hack apart
> the populatirty contest package to add this? :)

Didn't hack it apart, just wrote a perl prog to parse the input. Stick it
in a cronjob if you want it run every X amount of time, i guess.


- -- 
  finger for PGP public key.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBN8dAq77M/9WKZLW5AQHVugP9FtZqWGk9Mr3sV9WbZM7UZnTttBS3idQi
WmHqH9Ho/TiO2wyMCPOUXnTy2dswEa2hSWlcKvJBFPFeoPTRduOHMaQFgoPgwk6L
HBrVEedx2nr9P92M/gFzQjGxDRe+6znDJt9PxG2BVtCeFYGKDKN22aJrVoyCQb40
oeJ4kXMK5Ss=
=LTIG
-----END PGP SIGNATURE-----
#!/usr/bin/perl -w

[EMAIL PROTECTED];

($args{-h} or $args{'--help'}) and die <<"EOF" ;
USAGE: $0 [options]

Options:
  -l   lines per page (default 25)
  -w   width of "Most recent file" field (default 27)
  -h   This help message
EOF

open X,"popularity-contest |" or die "$!\n";
print STDOUT <<"EOF";
                    Unused Packages Report

Remember that libraries may be listed unused but be required for
other packages!

EOF

format STDOUT_TOP =
Package               Installed   Accessed    Most recently accessed file
--------------------  ----------  ----------  ---------------------------
.

$w=$args{-w} || 27;
--$w<26 and $w=26;

$x='
format STDOUT =
@<<<<<<<<<<<<<<<<<<<  @<<<<<<<<<  @<<<<<<<<<  @' . '<'x$w . '
$package,             join("/",@c), join("/",@a), $file
.
';
eval $x;

$^L="\n";
$= = $args{-l} || 25;

@PATH=split /:/, $ENV{PATH};
while(<X>){
    /<OLD>/ or next;
    ($atime,$ctime,$package,$file)=split;
    @a=reverse((localtime($atime))[3..5]);
    $a[0]+=1900;
    $a[1]++;
    @c=reverse((localtime($ctime))[3..5]);
    $c[0]+=1900;
    $c[1]++;
    for $dir (@PATH){
        $file=~s!^$dir/!!;
    }
    write;
}

Reply via email to