From lindadl at uga.edu Thu Mar 2 09:30:41 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Thu, 2 Mar 2006 12:30:41 -0500 Subject: [Classiccity-pm] Timeout Message-ID: <012301c63e1f$0730ba20$7352c080@lindadl> Paul Keck made me join this list because he was jealous of Leslie Grove because she got to have all the fun of helping me solve all of my interesting perl problems. Just kidding. Here is today's problem: Running on HP/UX, certain users login and are thrown into a perl menu script. They can go from there to other perl scripts that I want to time out after a very short time compared to the menu. They can also go to third party software but always end up back at this menu and thrown out of the system when they quit the menu. The third party software has its own timeout function that works great and has to stay because many of the users only see the third party software. Not everyone gets the pleasure of seeing the results of my scripts. Anyway, is there something that I can put between these two lines that will kick the user out of the system while the script is waiting for input? print "\n\n Q or q to quit : "; chomp ($task = ); Thanks, Linda Law ************** #!/usr/contrib/bin/perl use Shell; # $SIG{INT} = 'IGNORE'; while ($task ne 'Q' and $task ne 'q') { system (clear); print " BULLDOG BUCKS MAIN MENU\n\n"; print " 1. Go to the OPTIM program\n"; print " 2. Add 1 card holder to the system\n"; print " 3. Add a Library Print and Copy Card Range\n"; print " 4. *Add 1 Departmental Card\n"; print " 5. *Add Housing Summer Camp Card Range\n"; print " 6. *Change Plan and Reset Balance for 1 Cardholder\n"; print " 7. *View and/or print last daily email sent to a location\n"; print " 8. *Get Cardholder Notes by Status Code and Date\n"; print " 9. Lock a user account\n"; print " 10. Unlock a user account\n"; print "\n\n * indicates the option is not yet ready for use."; print "\n\n Q or q to quit : "; chomp ($task = ); SWITCH: { ($task eq '1') && do { From stephen at enterity.com Thu Mar 2 09:41:12 2006 From: stephen at enterity.com (Stephen Howard) Date: Thu, 02 Mar 2006 12:41:12 -0500 Subject: [Classiccity-pm] Timeout In-Reply-To: <012301c63e1f$0730ba20$7352c080@lindadl> References: <012301c63e1f$0730ba20$7352c080@lindadl> Message-ID: <44072E38.8010204@enterity.com> The only thing that comes immediately to mind is to have an external program throw a signal at your script, which it can then can catch, check if input has been provided, and otherwise kick the user off the system. This external program could be a couple of things: - a child that forks off right before the read for STDIN, which signals it's parent when the time is up. - a daemon that the script signals right before the STDIN read. The script would indicate to the daemon when it would like a wake up call You might also see if POE has something that could help. I understand it's interrupt/event driven: http://poe.perl.org/ HTH -Stephen Linda Dubes Law wrote: > Paul Keck made me join this list because he was jealous of Leslie Grove > because she got to have all the fun of helping me solve all of my > interesting perl problems. Just kidding. > > Here is today's problem: > > Running on HP/UX, certain users login and are thrown into a perl menu > script. They can go from there to other perl scripts that I want to time > out after a very short time compared to the menu. They can also go to third > party software but always end up back at this menu and thrown out of the > system when they quit the menu. The third party software has its own > timeout function that works great and has to stay because many of the users > only see the third party software. Not everyone gets the pleasure of seeing > the results of my scripts. > > Anyway, is there something that I can put between these two lines that will > kick the user out of the system while the script is waiting for input? > > print "\n\n Q or q to quit : "; > > chomp ($task = ); > > > Thanks, > > Linda Law > > ************** > > #!/usr/contrib/bin/perl > > use Shell; > > # $SIG{INT} = 'IGNORE'; > > while ($task ne 'Q' and $task ne 'q') > { > > system (clear); > > print " BULLDOG BUCKS MAIN MENU\n\n"; > > print " 1. Go to the OPTIM program\n"; > print " 2. Add 1 card holder to the system\n"; > print " 3. Add a Library Print and Copy Card Range\n"; > print " 4. *Add 1 Departmental Card\n"; > print " 5. *Add Housing Summer Camp Card Range\n"; > print " 6. *Change Plan and Reset Balance for 1 Cardholder\n"; > print " 7. *View and/or print last daily email sent to a location\n"; > print " 8. *Get Cardholder Notes by Status Code and Date\n"; > print " 9. Lock a user account\n"; > print " 10. Unlock a user account\n"; > > print "\n\n * indicates the option is not yet ready for use."; > > print "\n\n Q or q to quit : "; > > chomp ($task = ); > > SWITCH: > { > ($task eq '1') && do { > > _______________________________________________ > Classiccity-pm mailing list > Classiccity-pm at pm.org > http://mail.pm.org/mailman/listinfo/classiccity-pm From nhruby at uga.edu Thu Mar 2 09:50:08 2006 From: nhruby at uga.edu (nathan r. hruby) Date: Thu, 2 Mar 2006 12:50:08 -0500 (EST) Subject: [Classiccity-pm] Timeout In-Reply-To: <012301c63e1f$0730ba20$7352c080@lindadl> References: <012301c63e1f$0730ba20$7352c080@lindadl> Message-ID: On Thu, 2 Mar 2006, Linda Dubes Law wrote: > Paul Keck made me join this list because he was jealous of Leslie Grove > because she got to have all the fun of helping me solve all of my > interesting perl problems. Just kidding. > > Here is today's problem: > > Running on HP/UX, certain users login and are thrown into a perl menu > script. They can go from there to other perl scripts that I want to time > out after a very short time compared to the menu. They can also go to third > party software but always end up back at this menu and thrown out of the > system when they quit the menu. The third party software has its own > timeout function that works great and has to stay because many of the users > only see the third party software. Not everyone gets the pleasure of seeing > the results of my scripts. > > Anyway, is there something that I can put between these two lines that will > kick the user out of the system while the script is waiting for input? > > print "\n\n Q or q to quit : "; > > chomp ($task = ); > "perldoc -f alarm" and rejoyce! -- ------------------------------------------- nathan hruby uga enterprise information technology services core services support ------------------------------------------- "In 1972 a crack commando unit was sent to prison by a military court for a crime they didn't commit...." From lindadl at uga.edu Thu Mar 2 10:17:32 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Thu, 2 Mar 2006 13:17:32 -0500 Subject: [Classiccity-pm] Timeout In-Reply-To: Message-ID: <012701c63e25$92fc05e0$7352c080@lindadl> Nathan Hruby is my hero! Here is what I added and it works brilliantly. *********************** eval { alarm(600); chomp ($task = ); }; if ($@) { exit(1); }; *********************** Thanks, Linda -----Original Message----- From: classiccity-pm-bounces+lindadl=uga.edu at pm.org [mailto:classiccity-pm-bounces+lindadl=uga.edu at pm.org] On Behalf Of nathan r. hruby Sent: Thursday, March 02, 2006 12:50 PM To: All purpose mailing list for Athens, Ga Perl Mongers Subject: Re: [Classiccity-pm] Timeout On Thu, 2 Mar 2006, Linda Dubes Law wrote: > Paul Keck made me join this list because he was jealous of Leslie > Grove because she got to have all the fun of helping me solve all of > my interesting perl problems. Just kidding. > > Here is today's problem: > > Running on HP/UX, certain users login and are thrown into a perl menu > script. They can go from there to other perl scripts that I want to > time out after a very short time compared to the menu. They can also > go to third party software but always end up back at this menu and > thrown out of the system when they quit the menu. The third party > software has its own timeout function that works great and has to stay > because many of the users only see the third party software. Not > everyone gets the pleasure of seeing the results of my scripts. > > Anyway, is there something that I can put between these two lines that > will kick the user out of the system while the script is waiting for input? > > print "\n\n Q or q to quit : "; > > chomp ($task = ); > "perldoc -f alarm" and rejoyce! -- ------------------------------------------- nathan hruby uga enterprise information technology services core services support ------------------------------------------- "In 1972 a crack commando unit was sent to prison by a military court for a crime they didn't commit...." _______________________________________________ Classiccity-pm mailing list Classiccity-pm at pm.org http://mail.pm.org/mailman/listinfo/classiccity-pm From lindadl at uga.edu Mon Mar 20 13:50:17 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Mon, 20 Mar 2006 16:50:17 -0500 Subject: [Classiccity-pm] Compiled perl modules Message-ID: <20060320165017812.00000000328@lindadl> Hello, I have an hp/ux machine with pa-risc processors. I want to use Date::Calc but need to install Bit:Vector and Carp::Clan first. I can't compile Bit::Vector because it requires an Ansi C compiler. My hp/ux machine does not have an ansi c compiler and I can't install one because of certain third parties. My goal is to be able to add and subtract dates. What are my options? Thanks, Linda From stephen at enterity.com Mon Mar 20 13:59:31 2006 From: stephen at enterity.com (Stephen Howard) Date: Mon, 20 Mar 2006 16:59:31 -0500 Subject: [Classiccity-pm] Compiled perl modules In-Reply-To: <20060320165017812.00000000328@lindadl> References: <20060320165017812.00000000328@lindadl> Message-ID: <441F25C3.9070808@enterity.com> Does DateTime.pm have similar constraints? It has pretty good date math support. Linda Dubes Law wrote: > Hello, > > I have an hp/ux machine with pa-risc processors. I want to use Date::Calc but need to install Bit:Vector and Carp::Clan first. I can't compile Bit::Vector because it requires an Ansi C compiler. My hp/ux machine does not have an ansi c compiler and I can't install one because of certain third parties. > > My goal is to be able to add and subtract dates. > > What are my options? > > Thanks, > > Linda > > _______________________________________________ > Classiccity-pm mailing list > Classiccity-pm at pm.org > http://mail.pm.org/mailman/listinfo/classiccity-pm From lindadl at uga.edu Tue Mar 21 07:14:24 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Tue, 21 Mar 2006 10:14:24 -0500 Subject: [Classiccity-pm] Compiled perl modules In-Reply-To: <441F25C3.9070808@enterity.com> Message-ID: <20060321101424062.00000002624@lindadl> DateTime.pm also requires an ansi c compiler. Although it says that it is only some of the options of the module that require it? I am guessing that there is someone in the world with a machine like mine with an ansi c compiler on it. Is there any reason that I couldn't have someone else compile it and then move it to my machine? Thanks, Linda -----Original Message----- From: classiccity-pm-bounces+lindadl=uga.edu at pm.org [mailto:classiccity-pm-bounces+lindadl=uga.edu at pm.org] On Behalf Of Stephen Howard Sent: Monday, March 20, 2006 5:00 PM To: All purpose mailing list for Athens, Ga Perl Mongers Subject: Re: [Classiccity-pm] Compiled perl modules Does DateTime.pm have similar constraints? It has pretty good date math support. Linda Dubes Law wrote: > Hello, > > I have an hp/ux machine with pa-risc processors. I want to use Date::Calc but need to install Bit:Vector and Carp::Clan first. I can't compile Bit::Vector because it requires an Ansi C compiler. My hp/ux machine does not have an ansi c compiler and I can't install one because of certain third parties. > > My goal is to be able to add and subtract dates. > > What are my options? > > Thanks, > > Linda > > _______________________________________________ > Classiccity-pm mailing list > Classiccity-pm at pm.org > http://mail.pm.org/mailman/listinfo/classiccity-pm _______________________________________________ Classiccity-pm mailing list Classiccity-pm at pm.org http://mail.pm.org/mailman/listinfo/classiccity-pm From stephen at enterity.com Tue Mar 21 09:13:57 2006 From: stephen at enterity.com (Stephen Howard) Date: Tue, 21 Mar 2006 12:13:57 -0500 Subject: [Classiccity-pm] Compiled perl modules In-Reply-To: <20060321101424062.00000002624@lindadl> References: <20060321101424062.00000002624@lindadl> Message-ID: <44203455.8090600@enterity.com> If they're running the same OS and processor architecture you should be able to get that to work. I don't entierly know what is involved, though. A good general overview of date/time modules in CPAN is here: http://www.perl.com/pub/a/2003/03/13/datetime.html I don't know if there's something else out there that will fit your needs. -Stephen Linda Dubes Law wrote: > DateTime.pm also requires an ansi c compiler. Although it says that it is only some of the options of the module that require it? I am guessing that there is someone in the world with a machine like mine with an ansi c compiler on it. Is there any reason that I couldn't have someone else compile it and then move it to my machine? > > Thanks, > > Linda > > -----Original Message----- > From: classiccity-pm-bounces+lindadl=uga.edu at pm.org [mailto:classiccity-pm-bounces+lindadl=uga.edu at pm.org] On Behalf Of Stephen Howard > Sent: Monday, March 20, 2006 5:00 PM > To: All purpose mailing list for Athens, Ga Perl Mongers > Subject: Re: [Classiccity-pm] Compiled perl modules > > Does DateTime.pm have similar constraints? It has pretty good date math support. > > Linda Dubes Law wrote: > >>Hello, >> >>I have an hp/ux machine with pa-risc processors. I want to use Date::Calc but need to install Bit:Vector and Carp::Clan first. I can't compile Bit::Vector because it requires an Ansi C compiler. My hp/ux machine does not have an ansi c compiler and I can't install one because of certain third parties. >> >>My goal is to be able to add and subtract dates. >> >>What are my options? >> >>Thanks, >> >>Linda >> >>_______________________________________________ >>Classiccity-pm mailing list >>Classiccity-pm at pm.org >>http://mail.pm.org/mailman/listinfo/classiccity-pm > > > _______________________________________________ > Classiccity-pm mailing list > Classiccity-pm at pm.org > http://mail.pm.org/mailman/listinfo/classiccity-pm > > _______________________________________________ > Classiccity-pm mailing list > Classiccity-pm at pm.org > http://mail.pm.org/mailman/listinfo/classiccity-pm From pkeck at uga.edu Tue Mar 21 09:35:24 2006 From: pkeck at uga.edu (Paul Keck) Date: Tue, 21 Mar 2006 12:35:24 -0500 Subject: [Classiccity-pm] Compiled perl modules In-Reply-To: <20060321101424062.00000002624@lindadl> References: <441F25C3.9070808@enterity.com> <20060321101424062.00000002624@lindadl> Message-ID: <20060321173524.GU28584@uga.edu> On Tue, Mar 21, 2006 at 10:14:24AM -0500, Linda Dubes Law wrote: > > My goal is to be able to add and subtract dates. You've no doubt already dismissed this, but just in case- Depending how accurate you have to be, as long as your dates are all 1970 or later you could convert the date to a UNIX epoch number, add or subtract 86,400 seconds for each day, and convert back. I think you'd run afoul of leap seconds and maybe even leap years, but maybe for your purpose you don't care? Just a thought. -- Paul Keck pkeck at uga.edu http://www.arches.uga.edu/~pkeck University of Georgia http://www.uga.edu/ucns/telecom EITS Network Engineering mailto:pkeck at ediacara.org --Opinions mine.-- Go fighting anomalocaridids!!! From lindadl at uga.edu Tue Mar 21 11:52:50 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Tue, 21 Mar 2006 14:52:50 -0500 Subject: [Classiccity-pm] Compiled perl modules In-Reply-To: <20060321173524.GU28584@uga.edu> Message-ID: <20060321145250593.00000002624@lindadl> I will go ahead and admit that I did not think of doing that. We might run into some troubles with our reporting and leap times but nothing that can't be fixed. I will probably confuse myself for reports that run on less than 24 hour schedules or skip weekends but that's what fun about being me. Leave it to Paul to understand the need to keep it simple. Of course, that is what I thought Date::Calc would do for me but not if I can't get it there! Thanks, Linda -----Original Message----- From: classiccity-pm-bounces+lindadl=uga.edu at pm.org [mailto:classiccity-pm-bounces+lindadl=uga.edu at pm.org] On Behalf Of Paul Keck Sent: Tuesday, March 21, 2006 12:35 PM To: All purpose mailing list for Athens, Ga Perl Mongers Subject: Re: [Classiccity-pm] Compiled perl modules On Tue, Mar 21, 2006 at 10:14:24AM -0500, Linda Dubes Law wrote: > > My goal is to be able to add and subtract dates. You've no doubt already dismissed this, but just in case- Depending how accurate you have to be, as long as your dates are all 1970 or later you could convert the date to a UNIX epoch number, add or subtract 86,400 seconds for each day, and convert back. I think you'd run afoul of leap seconds and maybe even leap years, but maybe for your purpose you don't care? Just a thought. -- Paul Keck pkeck at uga.edu http://www.arches.uga.edu/~pkeck University of Georgia http://www.uga.edu/ucns/telecom EITS Network Engineering mailto:pkeck at ediacara.org --Opinions mine.-- Go fighting anomalocaridids!!! _______________________________________________ Classiccity-pm mailing list Classiccity-pm at pm.org http://mail.pm.org/mailman/listinfo/classiccity-pm From lindadl at uga.edu Thu Mar 30 05:30:02 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Thu, 30 Mar 2006 08:30:02 -0500 Subject: [Classiccity-pm] Processing, renaming files Message-ID: <20060330083002105.00000003416@lindadl> Hello, I am considering a perl script to process scanned documents. I have a bunch of the same type of document with each ideally having a unique number that matches a particular pattern. There may be some duplicates that need to be kept track of. As the documents are scanned, they will be assigned generic names by the software that comes with the scanner. So, at the end of the day, after a certain number of documents have been scanned in, a script runs that will grab the unique number out of the file and rename that file the unique number. If the filename already exists, the process goes to a recursive function that adds an 'a' at the end of the file name then checks to see if the 'a' file exists. If the 'a' file exists then a 'b' gets added to then end of the file name rather than an 'a'. And so on and so on. I am wondering if there is some grand perl module out there that I should look at or if anyone has a suggestion or opinion about what I am trying to do. Right now, the plan is to scan the documents into pdf. Thanks, Linda Law My pseudo code that I so diligently learned in school goes: ***************** ls /directory/ > filenames.txt open filenames.txt while filenames.txt $filename = stdin $newfilename = grep /pattern/ $filename mv $filename $newfilename (recursive function to check and assign new filename if $newfilename exists) ********************