Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I spent 20 minutes knocking up this program

    I don't think any American writer would have used that phrase in quite that fashion.

    I remember reading in a Sherlock Holmes story, when Holmes wakes up Dr. Watson by knocking on his door early in the morning, he apologizes by saying:

    Very sorry to knock you up, Watson, but it's the common lot this morning. Someone knocked up Mrs. Hudson, she prevailed upon me, and I upon you.

    (I may not have the quote 100%, but it's very close.)

    • Hmmm, it's not uncommon in British English either, as a term for being pregnant. But using it in a phrase to mean "quickly built" is also not uncommon and it's normally fairly easy to distinguish by context!


  • Nine is quite a bit more elaborate though. Notable differences:

    sysopen my $fh, $fn, O_WRONLY | O_EXCL | O_CREAT
        or die "Couldn't open $fn for writing: $!\n";

    so I don't get stuff inadvertantly overwritten. Also,

    for( $msg->parts ) {
        my $fn = $_->filename;
        next if not defined $fn;
        # ...

    so I don't have to look at MIME types that way only seemed to lead to madness. (What're you passing a parameter to ->filename() for btw?)

    Other reaso

  • I wrote about this in The Perl Journal for one of the recent issues. I do the same thing, although each email address gets their own directory, and I only run it from within PINE when I want to detach something.
  • Davorg knocked up a script that contained:

        my $file = DUMP . $mime->filename(1);
        open FILE, '>', $file or die $!;

    What happens when I send you an attachment with a filename of ../../../../../home/davorg/.ssh/authorized_keys, or perhaps more innocently .htaccess?

    This is an excellent use for File::Basename, and Aristotle's previous sysopen() involving O_EXCL|O_CREAT.

    No prizes for guessing which course [] I've been recently reviewing.

    • I don't suppose you'd believe that this was a simplified copy of the program would you :)

      It's also been pointed out that an attachment called .htaccess would have interesting results.