Seema has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping Question....
by virtualsue (Vicar) on Jun 20, 2001 at 22:58 UTC | |
Hello.. I am a new member of the Monks. My name is Seema. I am a student at Purdue University. I would love to chit-chat..but if I start...I won't stop. :o Be that as it may, I suggest you drop by the Chatterbox soon and discuss what you want with some of the monks, because at almost any time of the day or night you can usually find several reasonably clued-up people to help you. If you talk about what you're looking for in "real time" I think you will get a lot farther than you are by re-posting your question every couple of days. :-) | [reply] |
|
Re: Looping Question....
by Sifmole (Chaplain) on Jun 20, 2001 at 21:45 UTC | |
1) If you mean that you need your script to run once a day over 31 days, well then it sounds like you need to check out "cron" on your system -- this is not a Perl specific item. 2) If you are looking to populate a drop-down list of 31 days from the present, then you might want to check out the Date::Calc library which has some nice date calculation routines. You can search for it on cpan.org. Good Luck | [reply] |
by Seema (Novice) on Jun 20, 2001 at 22:19 UTC | |
I need to write a script in Perl before I even put it on the Unix machine. The problem is...I didnt' know how to come about this situation. Though I will take a look at: cpan.org. for some clues. Thanx for replying! :o) ~Seema | [reply] |
|
Re: Looping Question....
by dimmesdale (Friar) on Jun 20, 2001 at 21:46 UTC | |
| [reply] |
by sierrathedog04 (Hermit) on Jun 20, 2001 at 22:19 UTC | |
Let's say that Java is really the best tool for doing XML, but I do not know Java, I know Perl. If Perl's XML tools are almost as good as Java, and I can save weeks of learning time by programming my XML in Perl, then I will probably do my XML in Perl even though Java may be better. If a pure cron solution requires too much knowledge of Unix internals and a Perl solution requires only Date::Calc and a simple daily cron job, then I say write a Perl script that cron will run daily, and let Date::Calc, which is available from www.cpan.org, do the date calculations. | [reply] |
by Seema (Novice) on Jun 20, 2001 at 22:22 UTC | |
I really appreciate for you replying to me. :o) I am on Unix...though I need a Perl script before I even get on the Unix machine. I am not that familiar with this program...but if you say I may need to use cron...well then can you give me some hints on where I may can find how to use this tool? Once again...thanx for helping me out! :o) ~Seema | [reply] |
by dimmesdale (Friar) on Jun 21, 2001 at 01:47 UTC | |
I'd check out these manpages also, if you can: at(1), crontab(1), sh(1), queuedefs(4), attributes(5) (they were mentioned at the end of cron. I don't know much specifcially about cron, but you can access some manpages online at: http://www.tac.eu.org/cgi-bin/man-cgi?cron+8 if you don't have access to them. Here's an article thats rather useful, its from O'Reilly: http://www.onlamp.com/pub/a/bsd/2000/09/27/FreeBSD_Basics.html If you need anymore help, you can search the web, or ask someone--lots of people here are proficient with Unix; I'm, however, rather new to it, and only know a little.
DESCRIPTION The cron command starts a process that executes commands at specified dates and times. Regularly scheduled commands can be specified according to instructions found in crontab files in the directory /var/spool/cron/crontabs. Users can submit their own crontab file using the crontab(1) command. Commands which are to be executed only once may be submitted using the at(1) command. | [reply] |
|
Re: Looping Question....
by RhetTbull (Curate) on Jun 20, 2001 at 22:30 UTC | |
| [reply] |
by Seema (Novice) on Jun 20, 2001 at 23:04 UTC | |
Yes I did post the question again..cuz I didn't know if I had posted it correctly. I am trying to run the script daily. The script should only show 31 days in the code. Such as: Today is June 20. I want the 30 days before this date to show up in the output. When its June 21, I want the date at the top to bump off. I dont' know if I have explained myself properly..but hopefully you can help me out! ~Seema | [reply] |
by RhetTbull (Curate) on Jun 21, 2001 at 01:42 UTC | |
Here's a simple example using Date::Calc that will print out a list of dates from today to 31 days in the past. Regards, Rhet PS. -- since you're new here, I highly recommend taking a look at turnstep's guide to the monastery. | [reply] [d/l] |