Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Autoresponder automator

by b10m (Vicar)
on Jul 27, 2005 at 11:04 UTC ( [id://478551]=note: print w/replies, xml ) Need Help??


in reply to Autoresponder automator

Automating things is always a Good Thing™. A few things I find interesting though.

  • You use system() to copy a file. Not very Perl'ish ;)
  • Setting the "van" and "tm" variables are first stored in an array, then converted to a scalar, why?
  • User settings are hardcoded in the script. Shouldn't be a configuration file be easier?
  • This script is probably invoked by cron, a "--silent" switch would be nice.
  • $sdate (and others) will be in this format: 27-7-5, while "2005-07-27" probably makes more sense to international users.
  • Script dies when target start date has not been reached yet. This is a Bad Thing™ for other %users. next would be nicer in the foreach loop.

PS: isn't a BASH script easier for such tasks? ;)

--
b10m

All code is usually tested, but rarely trusted.

Replies are listed 'Best First'.
Re^2: Autoresponder automator
by jkva (Chaplain) on Jul 27, 2005 at 11:09 UTC
    • I don't know how else to do it (yet). (File::Copy?)
    • Leftover from the first design. It changed a lot... should be changed, I agree.
    • It's in my to-do, but thanks for the thought :)
    • That has crossed my mind too :)
    • I've been doubting that, yeah. I didn't think anyone else will use this, so I just left it this way.
    • It does? That's a bug. Thanks!

    Re: PS: As I said, it's for the exercise. If I don't code, I won't improve. Plus I wanted to make a shell script first, asked in the CB, and got asked why I didn't make a Perl script ;)

    All in all, thanks for the help.
      b10m:
      You use system() to copy a file. Not very Perl'ish ;)
      Detonite:
      I don't know how else to do it (yet). (File::Copy?)

      That would work.

      b10m:
      $sdate (and others) will be in this format: 27-7-5, while "2005-07-27" probably makes more sense to international users.
      Detonite:
      I've been doubting that, yeah. I didn't think anyone else will use this, so I just left it this way.

      First of all, you post it here, so someone might be using it already. Secondly, you seem to use that information also in your reply emails (s/_DATE_FROM_/$sdate/g;) - and those might reach other mailboxes besides yours ;)

      b10m:
      Script dies when target start date has not been reached yet.
      Detonite:
      It does? That's a bug. Thanks!

      Before you updated the node, it said "die("...") if($sdate ne $cdate)", so yes, it will die ;) Instead of die'ing, you might want to print just errors, so when something fails, cron will notify you. (See the --silent option I suggested before).

      Detonite
      As I said, it's for the exercise. If I don't code, I won't improve. Plus I wanted to make a shell script first, asked in the CB, and got asked why I didn't make a Perl script ;)

      True, it's good excercise, yet Perl isn't always the right tool ;)

      --
      b10m

      All code is usually tested, but rarely trusted.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-18 00:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found