Created
January 28, 2014 09:16
-
-
Save fgabolde/8664490 to your computer and use it in GitHub Desktop.
(unsuccessful) attempt to tally module usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package EyeOfSauron; | |
use strict; | |
use warnings; | |
use 5.010; | |
use Carp; | |
# THE EYE SEES ALL, THE EYE KNOWS ALL | |
my %fellowship; | |
BEGIN { | |
*CORE::GLOBAL::require = sub { my $precious = $_[0]; | |
$fellowship{$precious}++; | |
CORE::require(@_) }; | |
} | |
END { | |
my @ringbearers = sort { $fellowship{$a} <=> $fellowship{$b} | |
|| lc $a cmp lc $b } keys %fellowship; | |
foreach my $precious (@ringbearers) { | |
warn sprintf("%s: %d\n", $precious, $fellowship{$precious}); | |
} | |
} | |
use DateTime; | |
say DateTime->new; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment