http://www.perlmonks.org?node_id=686332

singh has asked for the wisdom of the Perl Monks concerning the following question:

Unable to create object. Constructor stuck at read (probably stdin)
#!/usr/bin/perl use Mail::Audit; my $item = Mail::Audit->new(); strace of this codes tells that it is wating for input. I thought this + will read the mail from user mail. ********************** open("/usr/share/perl/5.8/constant.pm", O_RDONLY|O_LARGEFILE) = 5 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfdc5e98) = -1 ENOTTY (Inapp +ropriate ioctl for device) _llseek(5, 0, [0], SEEK_CUR) = 0 read(5, "package constant;\n\nuse strict;\nu"..., 4096) = 3051 _llseek(5, 3050, [3050], SEEK_SET) = 0 _llseek(5, 0, [3050], SEEK_CUR) = 0 close(5) = 0 read(4, "ore (man MIME::Parser) set C<mim"..., 4096) = 4096 read(4, " given, Mail::Audit will use har"..., 4096) = 4096 read(4, " treat the\n # mailbox as a no"..., 4096) = 4096 brk(0x8300000) = 0x8300000 brk(0x82ff000) = 0x82ff000 read(4, "rn $lock_error if $lock_error;\n "..., 4096) = 4096 read(4, "ow in tmp/. hardlink to all the"..., 4096) = 4096 read(4, " for eternity.\n\nThis is a final "..., 4096) = 4096 brk(0x8320000) = 0x8320000 brk(0x831f000) = 0x831f000 read(4, "ail message with the given value"..., 4096) = 4096 read(4, ">?From )\n .*?\\b\n (Post(m"..., 4096) = 2878 read(4, "", 4096) = 0 close(4) = 0 read(3, "", 4096) = 0 close(3) = 0 read(0, *******************************************

Replies are listed 'Best First'.
Re: Mail::Audit
by moritz (Cardinal) on May 13, 2008 at 17:50 UTC
    You shouldn't wildly expect things, but read the docs instead:
    The constructor reads a mail message from STDIN (or, if the data option is set, from an array reference or \*GLOBref) and creates a Mail::Audit object from it.
Re: Mail::Audit
by ysth (Canon) on May 14, 2008 at 03:55 UTC
    I'm not sure what you mean by "read the mail from user mail". If you mean from the user's local mailbox, Mail::Audit is typically used on mail before it's delivered locally.