Dear Monks,

I have also tried to avoid the use of map because I really can never understand what it is doing therefore assume that other people that might have to read my code might also find it difficult to understand if they ever had to maintain it.

Unfortunately I am the one maintaining the code of some really smart guy that thinks map, and unlesses and other crappy obfuscations make for maintainable code. Please forgive my rant ... anyways here's the bit of code I would to un map so I can add some debug to it.

sub _file_containing { my($self, $id) = @_; opendir(my $dir, $self->{update_dir}) or return; my @files = map { "$self->{update_dir}/$_" } sort { $a <=> $b } grep { /^\d+$/ && $_ <= $id } readdir $dir; return $files[-1]; }

Oh here's some more ranting ... sorry

I understand that back in the day structured programming it was a good idea to put an '_' in front of function if you where writing libraries so you wouldn't clutter the namespace of people using your libraries. But when I see it in circumstances like object orientated code is being used this practice of _my_great_subroutine only points out the pretensiousness of the doofus that wrote the code!

Thank you and I apologize for the rants.


In reply to How do I un-map this code? by Plankton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.