Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: using Email to Perl to append to a changelog.txt, html, or .xls?

by Xenograg (Scribe)
on Nov 22, 2004 at 17:04 UTC ( #409645=note: print w/replies, xml ) Need Help??


in reply to using Email to Perl to append to a changelog.txt, html, or .xls?

I avoided (but did not solve) the file lock issue on a project by coding a script to access a POP3 mailbox, and using cron to control execution. The mailbox was checked once every 30 minutes with a script that ran for 30 seconds, so simultaneous file access was high unlikely--but not impossible.
  • Comment on Re: using Email to Perl to append to a changelog.txt, html, or .xls?

Replies are listed 'Best First'.
Re^2: using Email to Perl to append to a changelog.txt, html, or .xls?
by freddo411 (Chaplain) on Nov 22, 2004 at 18:37 UTC
    The mailbox was checked once every 30 minutes with a script that ran for 30 seconds, so simultaneous file access was high unlikely--but not impossible.
    Hmmm. If you are 'reading' a mailbox, as a mail client might, then it seems you wouldn't run into the need to lock the file.

    I'd would approach the problem like so:

    my $mboxfhandle; # open $mboxfhandle for readonly my @mbox = <$mboxfhandle>; # Let's use lots of memory # rest of the process ...
    Seems like this would catch each new message, and not conflict with any incoming messages.

    ( on further reflections, I imagine that a mail client must be able to mark messages as read, which would involve a write ... )

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

      I meant that simultaneous file access upon the *output file* was high unlikely--but not impossible--because the script should run for only 30 seconds every 30 minutes.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://409645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2021-06-24 12:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (127 votes). Check out past polls.

    Notices?