=pod

=for advent_year 2009

=for advent_day 08

=for advent_title No trace of X-mas

=for advent_author Jerrad Pierce

Sometimes even peppering your perl with prints is more than you care for just
to debug your code. Well, install M<Devel::Trace> and you get a C<sh -x>
analog that's as easy as tacking C<-d:Trace> onto the commandline like so:

=begin code

C:}/~/perl -d:Trace bin/whichpm Exporter
>> bin/whichpm:6: $VERSION = 0.02;
>> bin/whichpm:8: foreach my $PM ( @ARGV ){
>> bin/whichpm:9:   eval "require $PM" || next;
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/Devel/Trace.pm line 12.
>> (eval 2)[bin/whichpm:9]:3: >> bin/whichpm:10:   $PM = File::Spec->catfile(split(/::/, $PM));
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:92:     my $self = shift;
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:93:     my $file = $self->canonpath(pop @_);
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:43:     my ($self,$path) = @_;
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:50:     my $node = '';
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:51:     if ( $^O =~ m/^(?:qnx|nto|cygwin)$/ && $path =~ s:^(//[^/]+)(/|\z):/:s ) {
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:59:     $path =~ s|/+|/|g;                             # xx////xx  -> xx/xx
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:60:     $path =~ s@(/\.)+(/|\Z(?!\n))@/@g;             # xx/././xx -> xx/xx
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:61:     $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:62:     $path =~ s|^/(\.\./)+|/|;                      # /../../xx -> xx
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:63:     $path =~ s|^/\.\.$|/|;                         # /..       -> /
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:64:     $path =~ s|/\Z(?!\n)|| unless $path eq "/";          # xx/       -> xx
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:65:     return "$node$path";
>> /usr/lib/perl5/5.8.8/File/Spec/Unix.pm:94:     return $file unless @_;
>> bin/whichpm:12:   $PM .= '.pm' unless $PM =~ /\.pm$/;
>> bin/whichpm:13:   print $INC{$PM}, ' ';
>> bin/whichpm:15: print "\n";
/usr/lib/perl5/5.8.8/Exporter.pm

=end code

Unfortunately, many of the TODO items remain undone, probably because besides
A<http://rt.cpan.org/Public/Bug/Display.html?id=22562|suffering from buffering>
and some occasional indigestion with string C<eval>s, the elegantly simple code
does what it's supposed to. Alas, this also means it's not yet possible to use
M<Devel::Trace> as a quine cheat, or tweak the output into a more convincing
Hollywood-esque code crawl. However, in my experience,
<acronym title="Dominus">everyone's favorite octopus-loving hacker</acronym> is
usually willing to share commit bits to his toys with those willing to
persistently provide patches.

To make up for perfunctory review, and recent gaps, we've amassed a collection
of other advent calendars you might want to frequent this year in addition to
this one. Some of them also feature perl, but all are geeky. Follow the
A<http://delicious.com/perladvent/advent|Links> here,
or the footer of the front page.

=sourcedcode mod8.pl

=cut
