http_referer question
Hi, should I use $ENV{HTTP_REFERER} to check wether a form was sent from my site. Because I don't want people to download my webpage, put a link to a form, and modify some of the forms so it can crash the script.(eventough i tried to protect from that). The best way i can think of for the moment is http_referer Any ideas would help Anthony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Clearing Printers w/CGI
Hello, I've been trying to write a cgi script that will clear and restart the printers on our server. We have 3 printers that just give me fits running through a Linux server. I have no problem getting everything back up and running on the command line but when I go on vacation the office staff wont leave me alone and I have to log into the server from where ever I'm at and clear them. The steps that I've been trying to take are to move the print jobs to another directory on the server, then restart lpd. I'm using the file copy module but when it gets to this line it fails with the following error message in the log: Insecure dependency in rename while running setuid at /usr/lib/perl5/5.00503/File/Copy.pm line 156. The line in the script that causes this is: move(/var/spool/lpd/$printer/[cd]f*, $printer); The permissions on the script are: -rwsr-xr-x 1 root root 1312 Jun 26 08:21 clearpq.cgi I know it's probably not good to run a cgi script with suid root but I think that would be better then giving the Secretarys root access to the server and having them delete files. The server is not connected to the Internet but is an internal machine. Any help on solving this problem would sure make my upcoming vacation much nicer ;^) -- Rob Do not meddle in the affairs of wizards, for they are subtle and quick to anger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http_referer question
On 6/26/03 at 10:48 AM, [EMAIL PROTECTED] (anthony) wrote: Hi, should I use $ENV{HTTP_REFERER} to check wether a form was sent from my site. Because I don't want people to download my webpage, put a link to a form, and modify some of the forms so it can crash the script.(eventough i tried to protect from that). The best way i can think of for the moment is http_referer The HTTP_REFERER can easily be spoofed and in some cases is not included at all, so this is not a foolproof method. The only way that I know of to accomplish this is a bit complex, and involves sending some hashed data along with the form which is then checked when the form is submitted. Let me know if you want more info on this. Having said that, it sounds like good form validation will do what you are looking for. If a user modifies your form, it doesn't need to 'crash' anything, just don't accept form input that is not what it should be. Check each incoming parameter. If it is invalid, slap the user, or die, or whatever is appropriate. Andrew -- This post is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Any code contained herein is likely UNTESTED and may cause your system to explode upon execution. Furthermore, please be advised that I am really just a Perl ninny, and you probably should not be taking my advice in the first place. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Clearing Printers w/CGI
Rob, The problem is in the permissions of the user id that is running the script, not the owner of the script. In this case, your webserver is the person running the script. So more than likely, you should use 'clearpq.cgi' to kick off a different script 'clearpl.pl' as ROOT. The script should contain the following... use strict; I would suggest the following... - clearpg.cgi writes a 'properties file' that contains the 'printer' - clearpg.pl accepts NO ARGUMENTS, and reads the 'printer' name from the 'properties file'. - clearpg.pl should have a hash of accepted 'printer's. This hash could look like my $PrinterHash = { 'printer' = { 'name' = 'printer name', 'location' = 'full path to printer', 'clearcode' = 'full path to what ever' } } This is just an idea. Kristofer 2) --- Rob [EMAIL PROTECTED] wrote: Hello, I've been trying to write a cgi script that will clear and restart the printers on our server. We have 3 printers that just give me fits running through a Linux server. I have no problem getting everything back up and running on the command line but when I go on vacation the office staff wont leave me alone and I have to log into the server from where ever I'm at and clear them. The steps that I've been trying to take are to move the print jobs to another directory on the server, then restart lpd. I'm using the file copy module but when it gets to this line it fails with the following error message in the log: Insecure dependency in rename while running setuid at /usr/lib/perl5/5.00503/File/Copy.pm line 156. The line in the script that causes this is: move(/var/spool/lpd/$printer/[cd]f*, $printer); The permissions on the script are: -rwsr-xr-x 1 root root 1312 Jun 26 08:21 clearpq.cgi I know it's probably not good to run a cgi script with suid root but I think that would be better then giving the Secretarys root access to the server and having them delete files. The server is not connected to the Internet but is an internal machine. Any help on solving this problem would sure make my upcoming vacation much nicer ;^) -- Rob Do not meddle in the affairs of wizards, for they are subtle and quick to anger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = -BEGIN GEEK CODE BLOCK- Version: 3.12 GIT d s+:++ a C++ UL++ US+ P+++ L++ W+++ w PS PE t++ b+ G e r+++ z --END GEEK CODE BLOCK-- __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http_referer question
should I use $ENV{HTTP_REFERER} to check wether a form was sent from my site. Because I don't want people to download my webpage, put a link to a form, and modify some of the forms so it can crash the script.(eventough i tried to protect from that). Enough error handling in your script will keep it from crashing. And if the script does crash, it's not you who suffers, it's hte idiot who's trying to link a form to it when all their users get an error 500 :) You could try using the script to generate the HTML and set a cookie on the clients machine, then when they hit submit have it post back into the same script which would then see the cookie and do a small weak authentication based on it, then return the results of the form. I would make a smaple but it's only 7am here, I should be sleeping still... Dennis Stout -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http_referer question
I have found CGI::FormBuilder a great way to do the validation for you. First it ignores anything you didn't specifically ask for. Second, you can easily validate using regexes. An additional benefit is that this module provides client side (for legitimate users of your form), and server side checking using a single regex. mail2web - Check your email from the web at http://mail2web.com/ . -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
saving a textarea to a text file
How would I go about saving the textarea of an HTML page to a text file? Bob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: saving a textarea to a text file
Wrong. Try: use CGI; my $q = new CGI; my $record = $q-param('text_field'); open(OUTFILE, output.txt) or die Can't open output.txt: $!; print OUTFILE $record; close OUTFILE; Andrew Brosnan wrote: On 6/26/03 at 10:14 PM, [EMAIL PROTECTED] (Bob X) wrote: How would I go about saving the textarea of an HTML page to a text file? use CGI; my $q = new CGI; my $record = $q-param('text_field'); open(OUTFILE, output.txt) or die Can't open output.txt: $!; print OUTFILE $record; send donations to TPF: http://donate.yetanother.org/ read: perldoc perlintro perldoc CGI perldoc perlopentut Regards, Andrew -- This post is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Any code contained herein is likely UNTESTED and may cause your system to explode upon execution. Furthermore, please be advised that I am really just a Perl ninny, and you probably should not be taking my advice in the first place. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Why should I create an object?
Bare in mind that I am still a beginner at coding. Why is it good practice to create an object when using CGI, rather than just diving in? For example: use CGI ':standard'; my $q=new CGI; my $input=$q-param('input'); and use CGI ':standard'; my $input=param('input'); both put the contents of 'input' into $input and the last one has less lines and less opportunity for typos, but the first is better practice than the second. Gently, please; why? Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why should I create an object?
Bare in mind that I am still a beginner at coding. Why is it good practice to create an object when using CGI, rather than just diving in? Maintainability. For example: use CGI ':standard'; my $q=new CGI; my $input=$q-param('input'); and use CGI ':standard'; my $input=param('input'); both put the contents of 'input' into $input and the last one has less lines and less opportunity for typos, but the first is better practice than the second. Gently, please; why? Okay, I'll expand on it a little. So when you leave and someone else takes over, they can maintain it and have a clue. :) For instance, go here: www.stout.dyndns.org/~stout/ttms.tar.gz (2.8KB). You tell me how readable it is now and realize I'm using the good programming techniques, and tell me if it would even be close to readable if I weren't. Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: errors installing MD5 module
- Original Message - From: mario kulka [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 6:37 PM Subject: errors installing MD5 module Hi, I'm trying to install the MD5 module and following the steps from CPAN website. I got to the part C. BUILD- by typing: perl Makefile.PL it goes well, but then it says: make: gcc: Command not found make: *** [MD5.o] Error 127 Should I continue with install after this? Can anybody tell me what that error is about? Thank you for any help, Mariusz Hi - NO don't install. gcc is the GNU c compiler; not finding it means the .c (.XS) sources in the module were not compiled. Check that you have the c/c++ development tools installed on your system (and your login has access to them). Aloha = Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MD5 module
Mario Kulka wrote at Wed, 25 Jun 2003 19:36:45 +: Few days ago I sent a message about uploading modules but I just realized I wasn't subscribed to the list. I just re-subscribed but I missed the replys; is there a way to view the last messages posted to the list by date or something? or could someone just copy the reply to : How to install MD5 module to my hosting server and re-send it to me? An alternative way to the web access might be to use it from a newsreader. The appropriate nntp host is: nntp.perl.org (Port 119 of course) Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help needed perl
dear all i have got two linux systems with perl on it i want perl programming workable code through which i can transfer files from one system to another using sftp or ssh. hoping a reply early with regards uday ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed perl
vemulakonda uday bhaskar wrote: dear all i have got two linux systems with perl on it i want perl programming workable code through which i can transfer files from one system to another using sftp or ssh. sftp http://search.cpan.org/search?query=sftpmode=module ssh http://search.cpan.org/search?query=sshmode=module hoping a reply early with regards uday -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weekly list FAQ posting
case wrote at Tue, 24 Jun 2003 15:17:48 +: 2.9 Other tips before posting to the list * Check the FAQs first once * Don't send questions asking ... will this work?. Try it first, then report errors and ask the list why it *didn't* work. A good answer to will this work?, is What happened when you tried it?. * If your email begins with I know this isn't the right place to ask this, but..., don't send it to this list :) If you know it doesn't belong, send it to where it does. * Check the FAQs first twice * Look at the archives, (http://archive.develooper.com/[EMAIL PROTECTED]/) to see if your question has already been answered on the list. * Have meaningful Subjects. Subject lines like Help!, and This isn't working! may be skipped by many people, and you may not get all the great help you want. Try to make your subject lines meaningful. For example, sprintf() trouble, or Confused about formats. :-) Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Mason] OFF TOPIC: Emacs MMM mode
On Wed, 25 Jun 2003, Paul Kraus wrote: Ok this lets me compile them. As long as I don't end my emacs session all the modes are available but if I exit emacs and go back into I have to re-byte compile them in order to have access to the modes. Any ideas? The simplest thing is to have the .el file in a path that xemacs searches by default; eg, C:\Program Files\XEmacs\XEmacs-x.xx\lisp. Alternatively, in your initilization file, you can specify a load-path to add. After that, have your start-up file load the file. The documentation for various packages at http://www.xemacs.org/ has examples of where to put these files and how to load them. -- best regards, randy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mastering Learning Perl on Win 32 Systems
Anthony == Anthony Beaman [EMAIL PROTECTED] writes: Anthony Any advice on getting through the LP/Win 32 book? I know I Anthony can do it but I'm getting tripped up. I've moved on to other Anthony chapters and I'm about to read Chapter 7 but I still haven't Anthony gotten arrays and hashes. My study routine consists of Anthony reading and taking notes; studying the notes; going through Anthony and coding the examples and exercises. Any advice on learning Anthony to program and using my time wisely? I've searched for a How Anthony to learn to program FAQ or guide/tutorial but to no Anthony avail. My goals are to move on to Programming Perl, Network Anthony Programming with Perl (Stein's book), and one of Roth's Win32 Anthony admin books but I keep falling down. Thanks!! :-) What was your programming background before coming to this book? We didn't write it for non-programmers, and it sounds like you're probably in that category if you don't get arrays and hashes. And, some others in this thread have recommended the new Learning Perl, 3rd edition. I concur... it's a much better book now. (We learn from our mistakes about teaching. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mastering Learning Perl on Win 32 Systems
Charles == Charles K Clarkson [EMAIL PROTECTED] writes: Charles Whenever I do an exercise from one of the Charles books that assume a unix environment, I skip Charles the code that gets user input. If the code Charles is written like this: Charles my @names = STDIN; Charles I change it to: Charles my @names = ( qw/ joe bob jack / ); Why? Just fire up a COMMAND.COM, and do the exercises as if you were on Unix. It works. And some of them are interactive! You can't predict everything that you'd be entering! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
put path together?
hello to everyone. when i have a path like that: /usr/X11R6/lib/X11/locale how can i cut this path into strings like that: / /usr /usr/X11R6 /usr/X11R6/lib /usr/X11R6/lib/X11 /usr/X11R6/lib/X11/locale and write this at the beginning of a file? i tried many things, but all things i tried failed:( THANK YOU -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
linefeed
Hi All I am having a problem with linefeed. I have written a program that writes records to an output file. The program that uses this file as input requires that all records are ended with \x0A and not CRLF (\x0D\x0A). This program runs on UNIX. How do I ensure that records are ended only with \x0A??? Do I have to use an other method than: print FILHNDL Text...;??? Regards, Charles Scheepers Pr.Eng. [EMAIL PROTECTED] (011) 324-9026 (084) 511-6164 This communication is private, privileged and confidential intended only for the named addressee. Any recipient who is not a named addressee is not entitled to retain, copy, disseminate or take action in reliance upon this communication. If you have received it in error, please notify the sender immediately and destroy the original.
RE: linefeed
-Original Message- Charles Scheepers wrote: Hi All I am having a problem with linefeed. I have written a program that writes records to an output file. The program that uses this file as input requires that all records are ended with \x0A and not CRLF (\x0D\x0A). This program runs on UNIX. How do I ensure that records are ended only with \x0A??? Do I have to use an other method than: print FILHNDL Text...;??? For keeping it simple I suggest you to write the text file as usually with print FILHNDL Text...;, then to use UNIX utilities like as dos2unix to convert DOS text file in UNIX text file (you can run dos2unix from within Perl of course). E. LOQUENDO S.p.A. Vocal Technology and Services [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: linefeed
Thanks for the reply... I an actually running the program on an UNIX platform, but it still uses CRLF in the output. I have actually tried: print FILHNDL Text...\012; and the output is still translated to CRLF. Will utilities like dos2unix make a difference? Regards, Charles Scheepers Pr.Eng. [EMAIL PROTECTED] (011) 324-9026 (084) 511-6164 -Original Message- From: Darbesio Eugenio [mailto:[EMAIL PROTECTED] Sent: 26 June 2003 10:55 To: Charles Scheepers; [EMAIL PROTECTED] Subject: RE: linefeed -Original Message- Charles Scheepers wrote: Hi All I am having a problem with linefeed. I have written a program that writes records to an output file. The program that uses this file as input requires that all records are ended with \x0A and not CRLF (\x0D\x0A). This program runs on UNIX. How do I ensure that records are ended only with \x0A??? Do I have to use an other method than: print FILHNDL Text...;??? For keeping it simple I suggest you to write the text file as usually with print FILHNDL Text...;, then to use UNIX utilities like as dos2unix to convert DOS text file in UNIX text file (you can run dos2unix from within Perl of course). E. LOQUENDO S.p.A. Vocal Technology and Services [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you This communication is private, privileged and confidential intended only for the named addressee. Any recipient who is not a named addressee is not entitled to retain, copy, disseminate or take action in reliance upon this communication. If you have received it in error, please notify the sender immediately and destroy the original. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: linefeed
-Original Message- Charles Scheepers wrote: I an actually running the program on an UNIX platform, but it still uses CRLF in the output. I have actually tried: print FILHNDL Text...\012; and the output is still translated to CRLF. Will utilities like dos2unix make a difference? Dos2unix converts CRLF to LF in text files. So it works like as a post-processor of your Perl program. Anyway now I am working on Windows platforms then I cannot test my suggestion. E. LOQUENDO S.p.A. Vocal Technology and Services [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: put path together?
[EMAIL PROTECTED] wrote: hello to everyone. when i have a path like that: /usr/X11R6/lib/X11/locale how can i cut this path into strings like that: / /usr /usr/X11R6 /usr/X11R6/lib /usr/X11R6/lib/X11 /usr/X11R6/lib/X11/locale You have multiple options 1) split (perldoc -f split) 2) index and substr (perldoc -f index, perldoc -f substr) 3) File::Basename module (perldoc File::Basename) Example using File::Basename #!/usr/bin/perl use strict; use warnings; use File::Basename; strip_path (/usr/X11R6/lib/X11/locale); sub strip_path { strip_path (dirname ($_[0])) if ($_[0] ne '/'); print $_[0], \n; } and write this at the beginning of a file? i tried many things, but all things i tried failed:( You will have to write the paths first to a temp file. Copy over the original contents to the temp file and rename the temp file as the original file. OR perldoc perlrun (look at the -p switch) perldoc perlvar (look at the $^I variable) THANK YOU -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: linefeed
Charles Scheepers wrote: Thanks for the reply... I an actually running the program on an UNIX platform, but it still uses CRLF in the output. I have actually tried: print FILHNDL Text...\012; and the output is still translated to CRLF. Will utilities like dos2unix make a difference? Is the special perl variable $\ (output record separator) getting modified in this code or in any module that you are using. print concatenates $\ to whatever it is printing. The default value for $\ is undef. perldoc -f print perldoc perlvar Regards, Charles Scheepers Pr.Eng. [EMAIL PROTECTED] (011) 324-9026 (084) 511-6164 -Original Message- From: Darbesio Eugenio [mailto:[EMAIL PROTECTED] Sent: 26 June 2003 10:55 To: Charles Scheepers; [EMAIL PROTECTED] Subject: RE: linefeed -Original Message- Charles Scheepers wrote: Hi All I am having a problem with linefeed. I have written a program that writes records to an output file. The program that uses this file as input requires that all records are ended with \x0A and not CRLF (\x0D\x0A). This program runs on UNIX. How do I ensure that records are ended only with \x0A??? Do I have to use an other method than: print FILHNDL Text...;??? For keeping it simple I suggest you to write the text file as usually with print FILHNDL Text...;, then to use UNIX utilities like as dos2unix to convert DOS text file in UNIX text file (you can run dos2unix from within Perl of course). E. LOQUENDO S.p.A. Vocal Technology and Services [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you This communication is private, privileged and confidential intended only for the named addressee. Any recipient who is not a named addressee is not entitled to retain, copy, disseminate or take action in reliance upon this communication. If you have received it in error, please notify the sender immediately and destroy the original. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: put path together?
In article [EMAIL PROTECTED], Sudarshan Raghavan wrote: [EMAIL PROTECTED] wrote: hello to everyone. when i have a path like that: /usr/X11R6/lib/X11/locale how can i cut this path into strings like that: / /usr /usr/X11R6 /usr/X11R6/lib /usr/X11R6/lib/X11 /usr/X11R6/lib/X11/locale You have multiple options 1) split (perldoc -f split) 2) index and substr (perldoc -f index, perldoc -f substr) 3) File::Basename module (perldoc File::Basename) Example using File::Basename #!/usr/bin/perl use strict; use warnings; use File::Basename; strip_path (/usr/X11R6/lib/X11/locale); sub strip_path { strip_path (dirname ($_[0])) if ($_[0] ne '/'); print $_[0], \n; } [...] I thought that the purpose of File::Basename is platform portability. It seems here that you are only using this for half the job. Is there another function in File::Basename (I didn't find one) or another module that also splits the dir-path? (for example producing @dirname so that $dirname[0] is the top level, $dirname[1] is the next down, etc.? -K -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help:Perl ssh file tranfer
sir please help me with the code which does the following : transfer of files from one system through another system which are both working on linux through ssh as iam in need of it urgently, exepecting a working codee Regards uday bhaskar ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: put path together?
Kevin Pfeiffer wrote: In article [EMAIL PROTECTED], Sudarshan Raghavan wrote: [EMAIL PROTECTED] wrote: hello to everyone. when i have a path like that: /usr/X11R6/lib/X11/locale how can i cut this path into strings like that: / /usr /usr/X11R6 /usr/X11R6/lib /usr/X11R6/lib/X11 /usr/X11R6/lib/X11/locale You have multiple options 1) split (perldoc -f split) 2) index and substr (perldoc -f index, perldoc -f substr) 3) File::Basename module (perldoc File::Basename) Example using File::Basename #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Spec; strip_path (/usr/X11R6/lib/X11/locale); sub strip_path { strip_path (dirname ($_[0])) if ($_[0] ne '/'); For portable code code change this to strip_path (dirname ($_[0])) if ($_[0] ne File::Spec-rootdir); print $_[0], \n; } [...] I thought that the purpose of File::Basename is platform portability. It seems here that you are only using this for half the job. Is there another function in File::Basename (I didn't find one) or another module that also splits the dir-path? (for example producing @dirname so that $dirname[0] is the top level, $dirname[1] is the next down, etc.? There is a splitdir function (File::Spec-splitdir). This is similar to split ('/', $your_path) on unix except it is portable. I am not aware of any function that will do what you are asking for. -K -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File size problem
Hi, I have this rather critical problem, I am trying to download quite huge files from a remote server through ftp. (The file being in a zipped format). I have an array which stores the names of the files to be downloaded. I am opening each of them up at my end and extracting data out of it and storing it in my oracle database. Q1. After unzipping, the file is huge (even the zipped one is :(( ).. almost 5GB. The system throws an errorFile too large and exits. How do I get around this ache? One way I want to do it is unzipped file into many parts and process each part separately but cant get to write a code for it. Is there any better solution? Q2. Is there a way I can parallely do all these things? i.e downloading.unzippingdata extraction... database operations. Here is the script.. if somebody can help me optimize it. @filenames=(A.gz,B.gz,, ...,.); open(ZP,database_zipped_archive.dat); while (@filenames) { [EMAIL PROTECTED]; $ftp-get($ftpfile); $unzippedftpfile=unzipped.txt; open IN,gzip -d $ftpfile $unzippedftpfile |; close(IN); $subst=substr($_,0,2); open(ZNP,tempfile.txt) or die tempfilenot ready.f: $!\n;; while (ZNP) { if ($subst=~/XXX/) { Some Operations . push(@XXX,xxx); } if ($subst=~/YYY/) { Some Operations . push(@YYY,y); } . . . . . } $filenumber++; } my $th = $db-prepare(INSERT INTO XXX_Table VALUES (?,?)); [EMAIL PROTECTED]; while (@XXX) { while ($checkorg $len) { $th-bind_param(1, $checkorg); $th-bind_param(2, @XXX-[$checkorg]); my $rc = $th-execute || die Can't execute statement: $DBI::errstr; $checkorg++; } } $checkorg=0; my $th = $db-prepare(INSERT INTO YYY_Table VALUES (?,?)); [EMAIL PROTECTED]; while (@YYY) { while ($checkorg $len) { $th-bind_param(1, $checkorg); $th-bind_param(2, @YYY-[$checkorg]); my $rc = $th-execute || die Can't execute statement: $DBI::errstr; $checkorg++; } } . . . . . Thanks In advance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help perl
vemulakonda uday bhaskar wrote: sir Please don't address me as sir, sudarshan would do as u asked me to do i have gone thru the below site for ssh tranfer of files in two linux systems http://search.cpan.org/author/IVAN/Net-SCP-0.06/SCP.pm I would appreciate it if you would keep this thread going in the list. You are missing out on a lot of expertise available there I am copying the list in this mail but the error i got is cant locate Net.SCP.pm in @INC. do i need to download Net::SCP qw(scp ISCP) SINCE I INCLUDED It using use Net::SCP qw(scp ISCP). does it is not be installed when perl is installed You will have to install it, it does not get installed with standard perl. Download it and follow the instructions given in the README file whats the problem andf how ro solve it thnaks with regards Uday ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help:Perl ssh file tranfer
vemulakonda uday bhaskar said: sir please help me with the code which does the following : transfer of files from one system through another system which are both working on linux through ssh as iam in need of it urgently, exepecting a working codee Whilst your candour is doubtless appreciated, I fear you may have the wrong idea about this list. This list exists to help those who are learning Perl in order that they may improve their skills. Many of those who give freely to this list would otherwise be charging customers extortionate amounts for such advice (and those who aren't probably would be given half a chance :-) yet the help is given freely in the hopes that the recipient will benefit through learning. It may be that someone finds your project interesting and would like improve their Perl by using it as an exercise. It may be that someone will feel generous and provide you with a solution. But if you are in urgent need of working code then you will probably need to travel a more conventional route and hire someone to write the code for you. If I have misunderstood your request and you have a specific problem with some Perl that you have written, please feel free to post the problem along with the associated code and error messages and I am sure that you will receive plenty of help and advice. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File size problem
-Original Message- Vasudev.K. wrote: . Q1. After unzipping, the file is huge (even the zipped one is :(( ).. almost 5GB. The system throws an errorFile too large and exits. How do I get around this ache? One way I want to do it is unzipped file into many parts and process each part separately but cant get to write a code for it. Is there any better solution? . Try hjsplit.exe to split a huge file into many pieces. It is a freeware product (available on Internet) that can manage file of 10GB and over. It doesn't need installation, it is a simple executable ... Then download each piece separately... E. LOQUENDO S.p.A. Vocal Technology and Services [EMAIL PROTECTED] CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to [EMAIL PROTECTED] Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weekly list FAQ posting
From: Janek Schleicher [EMAIL PROTECTED] case wrote at Tue, 24 Jun 2003 15:17:48 +: 2.9 Other tips before posting to the list * Check the FAQs first once * Don't send questions asking ... will this work?. Try it first, then report errors and ask the list why it *didn't* work. A good answer to will this work?, is What happened when you tried it?. * If your email begins with I know this isn't the right place to ask this, but..., don't send it to this list :) If you know it doesn't belong, send it to where it does. * Check the FAQs first twice ... I agree twice is not enough. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help:Perl ssh file tranfer
Vemulakonda Uday Bhaskar wrote at Thu, 26 Jun 2003 10:14:22 +: please help me with the code which does the following : Where is the code? transfer of files from one system through another system which are both working on linux through ssh as iam in need of it urgently, exepecting a working codee What do you pay for? However, that's also not a job list - perl.jobs is one, Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PERL format utility -error
HI John eveyone, I did solve the syntax error with regards to the format utility. However, when I tried including the format utility into the contents of the mail, the contents of the mail were empty. Hence I tried writting the formatted contents into a text file and it worked. The only drawback is it did not include the headers: PROG NO VERSION PROTO PORT SERVICE RESPONSE --- when I defined the format to below into the text file: format FILE = FILE PROG NO VERSION PROTO PORT SERVICE RESPONSE --- . Could someone show me the method of getting the headers above to appear into the file? Currently, contents of the file are as shown: SUBJECT: RPCPING OUTPUT HOST :pglc0001 IP :127.0.0.1 OS :linux 1073741824 1 udp661 program 1073741824 version 1 is not available 1073741825 1 udp899 program 1073741825 version 1 is not available 1073741826 1 udp756 program 1073741826 version 1 is not available 1073741827 1 udp813 program 1073741827 version 1 is not available I would like to have it appear as: SUBJECT: RPCPING OUTPUT HOST :mickey IP :127.0.0.1 OS :linux PROG NO VERSION PROTO PORT SERVICE RESPONSE 1073741824 1 udp661 program 1073741824 version 1 is not available 1073741825 1 udp899 program 1073741825 version 1 is not available 1073741826 1 udp756 program 1073741826 version 1 is not available 1073741827 1 udp813 program 1073741827 version 1 is not available Could someone help me out with this problem? Attached is my new script which prints such format into a text file and mails it out. Thanks -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:45 AM To: [EMAIL PROTECTED] Subject: Re: PERL format utility -error Chern Jian Leaw wrote: Hi, Hello, I have the script below which outputs some values in a tabular form into the body of a mail. I'm using the format utility in PERL to output the values in a tabular form as in: PROG NO VERSION PROTOCOLPORTSERVICE RESPONSE - 106665671.1 tcp 5676walld 10666567 program is not available. However, it produced the errors below: [EMAIL PROTECTED] file-5.pl names Format not terminated at file-5.pl line 97, at end of line Format not terminated at file-5.pl line 97, at end of line Missing right bracket at file-5.pl line 97, at end of line syntax error at file-5.pl line 97, at EOF Execution of file-5.pl aborted due to compilation errors. Below is my script which reads the file containing the output of the rpcinfo UNIX utility, as in: program versproto portservice response 18 1 udp 55734 walld program 18 version 1 ready and waiting 1073741824 1 udp 661 program 1073741824 version 1 is not available 1073741825 1 udp 899 program 1073741825 version 1 is not available and mails to sys-admins whenever the program response is NOT ready and waiting. The problem scenario is similar my earlier posting. However, I'm now wanting to include the formatting utility in PERL to better format my outputs. Below is my script which produced the ERROR output above: open(INPUT, $file) || die Can't open $file \n; open(NAMES, $nameList) || die Can't open $nameList \n; @names=NAMES; $list=; for($i=0;$i@names;$i++){ chomp($names[$i]); print \$names[$i]=$names[$i] \n; $list=$list. .$names[$i].$domain; } my @data = grep{/^\d/ !/(ready and waiting)$/ !/^RPC/ !/^program/} map {chomp; $_}$ if(@data==0){ print No error rows found\n; exit 1; } else{ print MAIL SUBJECT: RPCPING OUTPUT \n; print MAIL HOST :$hostName\n; print MAIL IP :$ip\n; print MAIL OS :$^O \n; foreach(@data){ print ELEMENTS: $_ \n; my @field=split(/:?\s+/,$_,6); ##break it up into 6 fields format STDOUT_TOP = MAIL PROG NO VERSION PROTO PORT SERVICE RESPONSE -- . shift @field unless $field[0]; $progNo = $field[0]; $version = $field[1]; $protocol = $field[2]; $port = $field[3]; $service = $field[4]; $response =$field[5]; write(); format STDOUT = @
RE: File size problem
Ya.. I guess .. I got a part of the answer.. I am unzipping it onto the STDOUT and reading it from there But... still stuck with parallel processing :p:D -Original Message- From: Vasudev.K. [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:06 PM To: [EMAIL PROTECTED] Subject: File size problem Hi, I have this rather critical problem, I am trying to download quite huge files from a remote server through ftp. (The file being in a zipped format). I have an array which stores the names of the files to be downloaded. I am opening each of them up at my end and extracting data out of it and storing it in my oracle database. Q1. After unzipping, the file is huge (even the zipped one is :(( ).. almost 5GB. The system throws an errorFile too large and exits. How do I get around this ache? One way I want to do it is unzipped file into many parts and process each part separately but cant get to write a code for it. Is there any better solution? Q2. Is there a way I can parallely do all these things? i.e downloading.unzippingdata extraction... database operations. Here is the script.. if somebody can help me optimize it. @filenames=(A.gz,B.gz,, ...,.); open(ZP,database_zipped_archive.dat); while (@filenames) { [EMAIL PROTECTED]; $ftp-get($ftpfile); $unzippedftpfile=unzipped.txt; open IN,gzip -d $ftpfile $unzippedftpfile |; close(IN); $subst=substr($_,0,2); open(ZNP,tempfile.txt) or die tempfilenot ready.f: $!\n;; while (ZNP) { if ($subst=~/XXX/) { Some Operations . push(@XXX,xxx); } if ($subst=~/YYY/) { Some Operations . push(@YYY,y); } . . . . . } $filenumber++; } my $th = $db-prepare(INSERT INTO XXX_Table VALUES (?,?)); [EMAIL PROTECTED]; while (@XXX) { while ($checkorg $len) { $th-bind_param(1, $checkorg); $th-bind_param(2, @XXX-[$checkorg]); my $rc = $th-execute || die Can't execute statement: $DBI::errstr; $checkorg++; } } $checkorg=0; my $th = $db-prepare(INSERT INTO YYY_Table VALUES (?,?)); [EMAIL PROTECTED]; while (@YYY) { while ($checkorg $len) { $th-bind_param(1, $checkorg); $th-bind_param(2, @YYY-[$checkorg]); my $rc = $th-execute || die Can't execute statement: $DBI::errstr; $checkorg++; } } . . . . . Thanks In advance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Please explain warnings error
Hi everyone, I'm getting this warning: Possible unintended interpolation of @pkg::array1 in string What does it mean and how do I fix it?
Re: Help getting output from IO::Socket::INET
Errr, sorry, I cut the IO::Socket::INET to put it in the subject, I should have done a copy... Here is what it should have been... code use IO::Socket; my $socket = IO::Socket::INET-new(localhost:80) or die cannot connect to localhost:80 : [EMAIL PROTECTED]; print $socket GET / HTTP/1.1\n\n; while ($socket) { print } # My Problem line... /code Thanks for any help! -- Tim Musson Flying with The Bat! eMail v1.62q Windows 2000 5.0.2195 (Service Pack 2) Ever stop to think, and forget to start again? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help - perl ssh
hello to all first of all i would like to pay my regrets for my earlier mail asking the code. sorry for that. i have wriiten a code for file tranfer between linux systems so i used Net::SCP qw(scp iscp). i downloaded it from the site http://serach.cpan.org/author/IVAN but after gunzip and tar -xvf.. when i gave the command as said in README file perl Makefile.pl it is giving error saying that cannot locate NET ncp/[EMAIL PROTECTED] please help me on how tosolve the problem and any other site where from i can download scp modules Regards uday ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
scp : perl :help
hello all please tell me from where can i download scp modules for perl regards uday ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: scp : perl :help
I've always found the CPAN website of great help for any module. http://www.cpan.org/modules/00modlist.long.html sulabh -Original Message- From: vemulakonda uday bhaskar [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 8:40 AM To: [EMAIL PROTECTED] Subject: scp : perl :help hello all please tell me from where can i download scp modules for perl regards uday ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weekly list FAQ posting
Jenda Krynicky wrote at Thu, 26 Jun 2003 14:05:14 +0200: case wrote at Tue, 24 Jun 2003 15:17:48 +: 2.9 Other tips before posting to the list * Check the FAQs first once * Don't send questions asking ... will this work?. Try it first, then report errors and ask the list why it *didn't* work. A good answer to will this work?, is What happened when you tried it?. * If your email begins with I know this isn't the right place to ask this, but..., don't send it to this list :) If you know it doesn't belong, send it to where it does. * Check the FAQs first twice ... I agree twice is not enough. Yep, either once or following a german idiom, all good things are three ones! Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please explain warnings error
Motherofperl wrote at Thu, 26 Jun 2003 08:35:05 -0400: I'm getting this warning: Possible unintended interpolation of @pkg::array1 in string What does it mean and how do I fix it? Let Perl explain it to you, include not only strict and warnings, also use diagnostics; If you still don't know what does it mean and how you can fix it, ask us again, but please also add some code. (It's hard to explain how to fix something without seeing that thing) Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help - perl ssh
Vemulakonda Uday Bhaskar wrote at Thu, 26 Jun 2003 12:41:16 +: i have wriiten a code for file tranfer between linux systems so i used Net::SCP qw(scp iscp). i downloaded it from the site http://serach.cpan.org/author/IVAN but after gunzip and tar -xvf.. when i gave the command as said in README file perl Makefile.pl it is giving error saying that cannot locate NET ncp/[EMAIL PROTECTED] please help me on how tosolve the problem and any other site where from i can download scp modules I'm not sure about the error message (better to copy+paste the complete error message than only one line), but perhaps you'll need also some other modules. Net::NCP needs also Net::SSH String::ShellQuote IO::Handle Only the last one is usually installed. I couldn't detect something special in it's Makefile.PL, so perhaps that's really the problem. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to write to a file at certain position?
Is there any methods or documents I can refer to learn how to write a file at any desire position with any length without to write the whole again ? I mean, I dont want to write to a new file, kill the old file, rename the new file, or read the old file, modify it and rewrite the old file etc... for example, for a mp3 file, I can modify the tags by its header location. So I just want to overwrite some bytes to the head of the file, then the rest are just remain the same Any suggestion are very apperciate =) Thanks in advice
Re: How to write to a file at certain position?
LI NGOK LAM said: Is there any methods or documents I can refer to learn how to write a file at any desire position with any length without to write the whole again ? I mean, I dont want to write to a new file, kill the old file, rename the new file, or read the old file, modify it and rewrite the old file etc... for example, for a mp3 file, I can modify the tags by its header location. So I just want to overwrite some bytes to the head of the file, then the rest are just remain the same Any suggestion are very apperciate =) Thanks in advice You want seek(), and possibly tell(). perldoc -f seek -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies rejected
Hi Todd Thanks a lot for the pointer. WWW::Mechanize was exactly what I needed. Using it's field replacement, I could log in to the site without any problem with the cookies. However, the next web page from where I actually want to send the message contains a text box for the mobilenumber and textarea for the message. The textbox was filled with the mobile number easily using $agent-field(mobilenumber,+9198155...); Result : input TABINDEX=1 TYPE=text NAME=mobilenumber MAXLENGTH=200 SIZE=55 VALUE=+9198155... All is great till this point. The hurdle now is that I could not find any method to populate the textarea :( Here is the html line from page where I'm supposed to put the message : textarea TABINDEX=2 ID=message NAME=message COLS=45 ROWS=4 WRAP=PHYSICAL onBlur=textRemaining(); onfocus=textRemaining(); onkeydown=textRemaining(); onkeypress=textRemaining(); onkeyup=textRemaining();/textarea Could anyone please tell me how I could populate the textarea using Mechanize so that a submit() would send the msg on it's way... Thanks you so much aman -Original Message- From: Todd Wade [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 11:02 PM To: [EMAIL PROTECTED] Subject: Re: Cookies rejected Aman Thind [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi All On receiving no reply to my previous post, I myself struggled a bit and came up with the following code to login to the site : -- use LWP::UserAgent; use HTTP::Cookies; $ua = LWP::UserAgent-new; $ua-cookie_jar(HTTP::Cookies-new(file = lwpcookies.txt,autosave = 1)); my $req = HTTP::Request-new(POST = 'http://www.sms.ac/login.asp'); $req-content_type('application/x-www-form-urlencoded'); $req-content('loginuserid=myuseridloginpassword=mypassword'); my $res = $ua-request($req); print $res-as_string; -- However, on running this script, a web page with the following message is returned : Unable to establish login (cookies rejected). Could someone please guide me how to overcome this. You are running in to some very usual issues with http clients. Really the best we ( or at least myself ) can say is that you are not sending a properly formatted cookie. There is a module called WWW::Mechanize that helps facilitate what you are trying to do. You might want to give it a look. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write to a file at certain position?
You want seek(), and possibly tell(). perldoc -f seek Thanks for reply, but seems I have to clarify my question. 'seek' and 'tell' only helping me to target my position within a file handle. Say, if I have a 1MB file, and I just want to over write bytes from 0 to 1000 byte then my job is done, file is supposed to be saved. I want to avoid to rewrite the rest 900KBs again. Would you imagine what I am asking ? Welcome for any further suggestions. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: linefeed
I just did this myself (see the item from this list from the 24th with title duh...) I had to mess with chomp and chop both (you might have to play with them to get your format exactly right), there might be a more efficient way to do this, but this works: *** while ($logResp ne ) { $logResp = LOGRESP; chop $logResp; $eol = \r\n; $sendLR .= $logResp$eol; } chomp $sendLR; chop $sendLR; #do something with $sendLR ** -Chris -Original Message- From: Charles Scheepers [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:33 AM To: [EMAIL PROTECTED] Subject: linefeed Hi All I am having a problem with linefeed. I have written a program that writes records to an output file. The program that uses this file as input requires that all records are ended with \x0A and not CRLF (\x0D\x0A). This program runs on UNIX. How do I ensure that records are ended only with \x0A??? Do I have to use an other method than: print FILHNDL Text...;??? Regards, Charles Scheepers Pr.Eng. [EMAIL PROTECTED] (011) 324-9026 (084) 511-6164 This communication is private, privileged and confidential intended only for the named addressee. Any recipient who is not a named addressee is not entitled to retain, copy, disseminate or take action in reliance upon this communication. If you have received it in error, please notify the sender immediately and destroy the original. _ This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.
Re: How to write to a file at certain position?
LI NGOK LAM said: You want seek(), and possibly tell(). perldoc -f seek Thanks for reply, but seems I have to clarify my question. 'seek' and 'tell' only helping me to target my position within a file handle. Say, if I have a 1MB file, and I just want to over write bytes from 0 to 1000 byte then my job is done, file is supposed to be saved. I want to avoid to rewrite the rest 900KBs again. Would you imagine what I am asking ? Welcome for any further suggestions. Open your file in read/write mode. Seek to where you want to be. Write the data. Close the file. You will probably want to open the file with a mode of +. perldoc -f open -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weekly list FAQ posting
ok I want to bookmark this link, but it seems it is only one week's worth of questions, even though there is a [Prev Page][Next Page] on the page (which if it is a link, doesn't work). -JW --- Janek Schleicher [EMAIL PROTECTED] wrote: case wrote at Tue, 24 Jun 2003 15:17:48 +: 2.9 Other tips before posting to the list * Check the FAQs first once * Don't send questions asking ... will this work?. Try it first, then report errors and ask the list why it *didn't* work. A good answer to will this work?, is What happened when you tried it?. * If your email begins with I know this isn't the right place to ask this, but..., don't send it to this list :) If you know it doesn't belong, send it to where it does. * Check the FAQs first twice * Look at the archives, (http://archive.develooper.com/[EMAIL PROTECTED]/) to see if your question has already been answered on the list. * Have meaningful Subjects. Subject lines like Help!, and This isn't working! may be skipped by many people, and you may not get all the great help you want. Try to make your subject lines meaningful. For example, sprintf() trouble, or Confused about formats. :-) Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write to a file at certain position?
This is a snippet from an cgi based file uploader I wrote once. I think this is what you're after #/!perl -w use strict; use IO::File; my $offset = 3; my $file_binary = fg; sysopen(OUTFILE, out.txt, O_WRONLY) or print Couldn't open file for read/write ($!)\n; binmode OUTFILE; sysseek OUTFILE, $offset, 0; syswrite OUTFILE, $file_binary, length($file_binary); close OUTFILE; out.txt goes from 1234567 to 123fg67 Li Ngok Lam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You want seek(), and possibly tell(). perldoc -f seek Thanks for reply, but seems I have to clarify my question. 'seek' and 'tell' only helping me to target my position within a file handle. Say, if I have a 1MB file, and I just want to over write bytes from 0 to 1000 byte then my job is done, file is supposed to be saved. I want to avoid to rewrite the rest 900KBs again. Would you imagine what I am asking ? Welcome for any further suggestions. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write to a file at certain position?
You will probably want to open the file with a mode of +. Yes and thank you! That does what I want now. Thank you very much !! But I found new problem now. I did what I want if I try on a bitmap file, but for text file, my new contents will overwrite the whole file, what's that about or where I should refer to now? -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write to a file at certain position?
#/!perl -w use strict; use IO::File; my $offset = 3; my $file_binary = fg; sysopen(OUTFILE, out.txt, O_WRONLY) or print Couldn't open file for read/write ($!)\n; binmode OUTFILE; sysseek OUTFILE, $offset, 0; syswrite OUTFILE, $file_binary, length($file_binary); close OUTFILE; out.txt goes from 1234567 to 123fg67 Thank you veeery much ! It does what I want too, but I wonder why we have to make it a binmode while we are dealing with a text file ? Is that we must treat the FH is a binary source for whatever + or sysread/write ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write to a file at certain position?
Hi Again, You're right, if we were dealing with a text file, you wouldn't have to use binmode. However, my original script **was** for uploading binarys, and you mentioned mp3, so it made sense to leave it in. Hope I've been of some help Rob Li Ngok Lam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] #/!perl -w use strict; use IO::File; my $offset = 3; my $file_binary = fg; sysopen(OUTFILE, out.txt, O_WRONLY) or print Couldn't open file for read/write ($!)\n; binmode OUTFILE; sysseek OUTFILE, $offset, 0; syswrite OUTFILE, $file_binary, length($file_binary); close OUTFILE; out.txt goes from 1234567 to 123fg67 Thank you veeery much ! It does what I want too, but I wonder why we have to make it a binmode while we are dealing with a text file ? Is that we must treat the FH is a binary source for whatever + or sysread/write ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help:Perl ssh file tranfer
On 26 Jun 2003 10:14:22 -, [EMAIL PROTECTED] (Vemulakonda Uday Bhaskar) wrote: sir please help me with the code which does the following : transfer of files from one system through another system which are both working on linux through ssh as iam in need of it urgently, exepecting a working codee ssh won't transfer files, you need scp or sftp #!/usr/bin/perl -w use strict; use Net::SFTP; my $sftp = undef; eval{ $sftp = Net::SFTP-new(localhost, user=zz, password=ztest, ); }; if ($@) { print Sftp connection failed:\n [EMAIL PROTECTED]; } if (! $sftp) { print I can't connect!\n; }else{ print SUCCESS!\n; } $sftp-get(foo, bar); $sftp-put(bar, baz); __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Matching
Hi, Is there anyway to match a string in a 2-dimensional array only at one index? For example, say I have this 2-d array: @AoA = ( [ABC, BCD], [CDE, DEF], [EFG, FGH], ); Then I wanted to see if CD exist, but only in column index 1 ($AoA[$row][1]). Is there a way to do this w/o using a for loop within a for loop? Thanks. ~Sitha
IPC with parent from mutiple children
Hi all, Again, I drown in the muddy watters of child processes: What I want to achieve is: spawn up to $max_child processes and setup pipes in such away that all child processes can 'print' to the parent. This because I want to inform the parent about the exit value of the process (I know I can set up a signal handler for that, but I have found them very unreliable, so I want to trry it using pipes) My output is not what I expected :( Can somebody help me?? This is the code: #!/bin/env perl # use strict; use FileHandle; # Global variables; my $child = 0; my $max_child = 4; sub SpawnChild { my ($no, $child) = @_; pipe(READ, WRITE); autoflush WRITE 1; # Fork a new child process my $pid = fork(); if ($pid) { # This is the parent process close(WRITE); return; } else { # this is the child close(READ); my $sleep = int(rand(6)+1); # a no use random work load sleep($sleep); print WRITE End $no Slept $sleep\n; exit; } } sub Parent { my ($max_iterations) = @_; for (my $i = 1; $i $max_iterations; $i++) { $child++; print STDOUT Spawn $i $child\n; SpawnChild($i, $child); while ($child = $max_child) { my $input = READ; print STDOUT $input; $child--; } } for (my $i = 1; $i $max_child; $i++) { my $input = READ; print STDOUT $input; $child--; } } This is my output: Spawn 1 1 Spawn 2 2 Spawn 3 3 Spawn 4 4 End 4 Slept 6 Spawn 5 4 End 5 Slept 2 Spawn 6 4 End 6 Slept 1 Spawn 7 4 End 7 Slept 1 Spawn 8 4 End 8 Slept 2 Spawn 9 4 End 9 Slept 5 So I miss something like End 1 Slept 6 End 2 Slept 3 End 3 Slept 2 End 4 Slept 4 Where did the 'return print' for the first 4 children go Thanks for any suggestions Jeroen Lodewijks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: errors installing MD5 module
- Original Message - From: mario kulka [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 6:37 PM Subject: errors installing MD5 module Hi, I'm trying to install the MD5 module and following the steps from CPAN website. I got to the part C. BUILD- by typing: perl Makefile.PL it goes well, but then it says: make: gcc: Command not found make: *** [MD5.o] Error 127 Should I continue with install after this? Can anybody tell me what that error is about? Thank you for any help, Mariusz Hi - NO don't install. gcc is the GNU c compiler; not finding it means the .c (.XS) sources in the module were not compiled. Check that you have the c/c++ development tools installed on your system (and your login has access to them). I have this same problem with Tk. I have HP-UX 11 and it came with Activestate perl. However, I purchased the ANSI C bundle for HP-UX and I don't want to also install gcc. Can I force CPAN to use cc and not gcc in any way? -Mark Important Warning: This message is intended for the use of the person or entity to which it is addressed and may contain information that is privileged and confidential, the disclosure of which is governed by applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it is the intended recipient, you are hereby notified that any dissemination, distribution or copy of this information is STRICTLY PROHIBITED. If you have received this message by error, please notify us immediately by calling (310) 423-6428 and destroy the related message. Thank you for your cooperation. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to use command-line switches...
I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message.
Re: Matching
Sitha Nhok wrote at Thu, 26 Jun 2003 12:47:25 -0400: Is there anyway to match a string in a 2-dimensional array only at one index? For example, say I have this 2-d array: @AoA = ( [ABC, BCD], [CDE, DEF], [EFG, FGH], ); Then I wanted to see if CD exist, but only in column index 1 ($AoA[$row][1]). Is there a way to do this w/o using a for loop within a for loop? Thanks. [untested] if (grep /CD/, map {$_-[1]} @AoA) { ... } Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hmm....is a hot directory possible?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there some way that I can write a bit of code that will watch a directory and as soon as a file is written to that directory, something is run against that file? What would be the best way to turn this into a daemon? Thanks. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE++zk3kXvEbfjFKqoRAivUAKC4GaRnlokBfdh8FTeqPe2ED1DFggCeIChh 6KVy0XwHtK/pwnqdB96lltU= =cS1I -END PGP SIGNATURE- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use command-line switches...
[EMAIL PROTECTED] wrote: I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? perldoc Getopt::Std and perldoc Getopt::Long -- Brett -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use command-line switches...
Richard here is an example of code that gets the switch variables from the command line and checks it before continuing with the script. The shift function is operating on the @_ array and the @_ array contains the parameters passed to that subroutine from the command line(reference perlvar). my $switch = shift; if($switch eq or $switch =~ /-u/i) { print $usagestring; exit 1; } elsif ($switch =~ /-p/i) { $portnum = shift; } elsif ($switch =~ /-d/i) { $dbalias = shift; } else { print Invalid argument passed. Try again.\n$usagestring; exit 1; } Hope it helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: How to use command-line switches... I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use command-line switches...
Thank you! This is exactly what I need. The 17 pages in the PERLDOC lib info on Getopt::Long were a bit daunting/intimidating and for me like driving a nail with a shotgun This sample code gives me a really good example that shows the concept! Thank you for sharing it! -Original Message- From: Miller, Joseph S [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:48 PM To: Copits Richard; [EMAIL PROTECTED] Subject: RE: How to use command-line switches... Richard here is an example of code that gets the switch variables from the command line and checks it before continuing with the script. The shift function is operating on the @_ array and the @_ array contains the parameters passed to that subroutine from the command line(reference perlvar). my $switch = shift; if($switch eq or $switch =~ /-u/i) { print $usagestring; exit 1; } elsif ($switch =~ /-p/i) { $portnum = shift; } elsif ($switch =~ /-d/i) { $dbalias = shift; } else { print Invalid argument passed. Try again.\n$usagestring; exit 1; } Hope it helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: How to use command-line switches... I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use command-line switches...
No problem, glad to help. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:56 PM To: Miller, Joseph S; [EMAIL PROTECTED] Subject: RE: How to use command-line switches... Thank you! This is exactly what I need. The 17 pages in the PERLDOC lib info on Getopt::Long were a bit daunting/intimidating and for me like driving a nail with a shotgun This sample code gives me a really good example that shows the concept! Thank you for sharing it! -Original Message- From: Miller, Joseph S [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:48 PM To: Copits Richard; [EMAIL PROTECTED] Subject: RE: How to use command-line switches... Richard here is an example of code that gets the switch variables from the command line and checks it before continuing with the script. The shift function is operating on the @_ array and the @_ array contains the parameters passed to that subroutine from the command line(reference perlvar). my $switch = shift; if($switch eq or $switch =~ /-u/i) { print $usagestring; exit 1; } elsif ($switch =~ /-p/i) { $portnum = shift; } elsif ($switch =~ /-d/i) { $dbalias = shift; } else { print Invalid argument passed. Try again.\n$usagestring; exit 1; } Hope it helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: How to use command-line switches... I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching
Hi Janek, In article [EMAIL PROTECTED], Janek Schleicher wrote: Sitha Nhok wrote at Thu, 26 Jun 2003 12:47:25 -0400: Is there anyway to match a string in a 2-dimensional array only at one index? For example, say I have this 2-d array: @AoA = ( [ABC, BCD], [CDE, DEF], [EFG, FGH], ); Then I wanted to see if CD exist, but only in column index 1 ($AoA[$row][1]). Is there a way to do this w/o using a for loop within a for loop? Thanks. [untested] if (grep /CD/, map {$_-[1]} @AoA) { ... } It seems (to me) like it should work, but... (here's my most recent test variation): if (grep 'CD', my @tmp = map {$_-[1]} @AoA) { print @tmp\n; print Found CD here: $_\n; } @tmp is fine, but that's about all. (?) -- Kevin Pfeiffer International University Bremen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use command-line switches...
This will work for the most part, but I would really recommend against it. Check out the docs for Getopt::Std. It is much simpler than Getopt::Long, and will really end up simplifying your scripts, although it might not seem like it at first look. Here's an example of a script that uses Getopt::Std to put the switches into a hash to use later. The options with a colon after them in the getopts() line take a parameter, and the other ones are on/off switches. An example command line would be: myscript.pl -s SERVERNAME -o OUTFILE -v ## use strict; use warnings; use Getopt::Std; my %opt = (); getopts('ho:s:v',\%opt); my $outfile = $opt{o}; if($opt{h}){ Help(); }elsif($opt{v}){ Ver(); } ## -Original Message- From: Miller, Joseph S [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 11:48 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: How to use command-line switches... Richard here is an example of code that gets the switch variables from the command line and checks it before continuing with the script. The shift function is operating on the @_ array and the @_ array contains the parameters passed to that subroutine from the command line(reference perlvar). my $switch = shift; if($switch eq or $switch =~ /-u/i) { print $usagestring; exit 1; } elsif ($switch =~ /-p/i) { $portnum = shift; } elsif ($switch =~ /-d/i) { $dbalias = shift; } else { print Invalid argument passed. Try again.\n$usagestring; exit 1; } Hope it helps. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: How to use command-line switches... I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Use of uninitialized value in pattern match (m//) at ...
I think this is a very basic warning, but I coudn't find the way to avoid it (tried google, faq, and archive): Use of uninitialized value in pattern match (m//) at poComen.cgi line 138. line 138: if ($q-param('template') =~ /^[1234]$/) { # trying to find out if the value of a form parameter is a digit between 1 and 4 This only happens with use strict. How can I get rid of it? Thanks in advance. Regards, SB. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hmm....is a hot directory possible?
Chris Zimmerman wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there some way that I can write a bit of code that will watch a directory and as soon as a file is written to that directory, something is run against that file? What would be the best way to turn this into a daemon? you could take a look at the stat function provided by Perl to see if the directory's last modified time or inode change time changed: #!/usr/bin/perl -w use strict; my($pmm,$pic); while(1){ my($mm,$ic) = (stat('/tmp'))[9,10]; if($pmm and $pic and $pmm != $mm || $pic != $ic){ print some change to /tmp\n; }else{ print .\n; } $pmm=$mm; $pic=$ic; sleep(7); } __END__ 1. this is not a daemon. 2. this only reports there are some changes (it could be adding a file or deleting a file,etc) in /tmp but you don't know what really happened there. 3. this only reports changes to /tmp not knowing any change below the /tmp level. for example: #-- #-- the scrpipt report the following 3 changes to /tmp #-- mkdir /tmp/another touch /tmp/hi rm -f /tmp/hi #-- #-- but doesn't know the following 3 changes #-- mkdir /tmp/another/yet touch /tmp/another/yet/file rm -fr /tmp/another/yet because there is really no change to /tmp, only its child directory. solution to #2 and #3 can do done with a different approch. something like the following might work: 1. recursively cache (in a hash) all sub directories and files under /tmp during start up of your daemon. 2. once a while, do the same resursive scan for the /tmp directory and compare the directory content with the hash you cached a while ago. 3. if there is any differences, you know something has changed and because you have 2 hashs, you can easily find out what really happened. for example, if the first hash has an entry where the second hash doesn't, you know something has been deleted from the directory. Or if the second hash has something that's missing from the first hash, you know there are new files. 4. update the cache to be the most recent scan. repeat step #2. File::Find module can help you do the recursive scan portion fairly easily. you can take the same approach but instead of caching the directory contents, you can cache each sub directory's last modified time instead. this will reduce the size of your hash a bit. either way, even this approach has many drawback: 1. if you target directory is huge, the scaning part will take a long time which brings us to the 2 drawback. 2. race condition. it's totally possible for a file to appear and disappear during your directory scan especially if the scan takes a long time or the directory is busy (means there are tons of activity in the directory so files appear and disappear really fast). your scan will miss those. you might need to apply some kind of locking to the directory during the scan. finally, take a look in CPAN to see if something comes up. on top of my head, i don't remember any modules that does what you want. good luck. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cmsg cancel 002001e9fea7$123dbbe0$d402a8c0@sysserver
Cancel help:about file format -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Q: get table info
Howdy: I am trying to write a script to get table info from PostgreSQL. Basically, I want to generate a list of tables from a sub function and pass that and then use that returned variable and put it inside a NEW sql loop and create more output files based. My problem is (and I'm sure there are a lot of them) I can't seem to return the list outside the sub function and have that variable used again. How do I do that? I mean, I can see that it's dying at the very end of the 'unless' statement at the bottom of the script, but I don't know *why* ... I'm not sure I understand what the error is trying to say. The table exist and I can select from that, too. The errors that I am getting are: [snip errors] DBD::Pg::st execute failed: ERROR: Attribute 't_prof_inp_det_combined' not found at ./getpg_sch.pl line 58. Execute failed for stmt: SELECT a.attname, format_type(a.atttypid, a.atttypmod) FROM pg_class c, pg_attribute a WHERE c.relname = t_prof_inp_det_combined AND a.attnum 0 AND a.attrelid = c.oid ORDER BY a.attnum Error = ERROR: Attribute 't_prof_inp_det_combined' not found Uncaught exception from user code: Clean up finished [/snip errors] --- [snip script] #!/usr/bin/perl -w # created 26 Jun 03 -X # script to connect to Postgres do a count # get a list of tables info (DDL) and make # new DDL files to move to another DB # # need table owner, table name, column, type # and pass that into a file # # should be cool use strict; use diagnostics; use DBI; use POSIX 'strftime'; our $qual=$qual; our $owner=$owner; our $name=$name; our $type=$type; our $rem=$rem; my $datestr=strftime '%d%B%Y',localtime; # connect to postgres via DBI my $dbh=DBI-connect('dbi:Pg:dbname=test_db', 'joeuser') or die Can not connect: $!; getTable(); # without the sub(), this works by # itself - but I want the results of # the query from $sql to be appended into # each $name.dll file # sub getTable() { my $tabsth = $dbh-table_info(); while (my ($qual, $owner, $name, $type, $rem)= $tabsth-fetchrow_array() ) { open (FILE, $name.dll) or die Snootch-to-the-nootch\n; print FILE $name\n; return $name; } } # this works if i put in an actual # table name; but i want to put the list # of $name inside this to loop and # generate $name.ddl files # how can i do that? # my $sql= qq| SELECT a.attname, format_type(a.atttypid, a.atttypmod) FROM pg_class c, pg_attribute a WHERE c.relname = $name AND a.attnum 0 AND a.attrelid = c.oid ORDER BY a.attnum |; my $sth=$dbh-prepare($sql) or die Error =,DBI::errstr; unless ($sth-execute) { print\n\tExecute failed for stmt:\n\t$sql\nError = , DBI::errstr; $sth-finish; $dbh-disconnect; die \n\t\tClean up finished\n; } while (my ($tablename, $type)= $sql-fetchrow_array() ) { print FILE \n; print FILE $tablename\t$type\n; } close (FILE); $dbh-disconnect; __END__ [/snip script] Thanks! -X
Re: Re: Hmm....is a hot directory possible?
I keep forgetting to post the hold group. Hopes this helps. #!/usr/bin/perl -w use strict; use POSIX qw(setsid); # set costants my$MAKEPORT=/home/jspencer/bin/make-port; # daemonize the program daemonize; while(1) { # set costants [EMAIL PROTECTED](/home/jspencer/acucorp/std/std-unix-misc.tar.gz) ; my$FIRSTTIME = $FILETIME[9]; my$SECTIME=scalar time; sleep(2); if (($FIRSTTIME + 2) $SECTIME) { system($MAKEPORT); }} sub daemonize { my $outlog = '/home/jspencer/bin/daemons/logs/hotfolder_out.log'; my $errorlog = '/home/jspencer/bin/daemons/logs/hotfolder_error.log'; chdir '/' or die Can't chdir to /: $!; umask 0; open STDIN, '/dev/null' or die Can't read /dev/null: $!; open STDOUT, $outlog or die Can't write to /dev/null: $!; open STDERR, $errorlog or die Can't write to /dev/null: $!; defined(my $pid = fork) or die Can't fork: $!; exit if $pid; setsidor die Can't start a new session: $!; } From: david [EMAIL PROTECTED] Date: 2003/06/26 Thu PM 04:16:49 EDT To: [EMAIL PROTECTED] Subject: Re: Hmmis a hot directory possible? Chris Zimmerman wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there some way that I can write a bit of code that will watch a directory and as soon as a file is written to that directory, something is run against that file? What would be the best way to turn this into a daemon? you could take a look at the stat function provided by Perl to see if the directory's last modified time or inode change time changed: #!/usr/bin/perl -w use strict; my($pmm,$pic); while(1){ my($mm,$ic) = (stat('/tmp'))[9,10]; if($pmm and $pic and $pmm != $mm || $pic != $ic){ print some change to /tmp\n; }else{ print .\n; } $pmm=$mm; $pic=$ic; sleep(7); } __END__ 1. this is not a daemon. 2. this only reports there are some changes (it could be adding a file or deleting a file,etc) in /tmp but you don't know what really happened there. 3. this only reports changes to /tmp not knowing any change below the /tmp level. for example: #-- #-- the scrpipt report the following 3 changes to /tmp #-- mkdir /tmp/another touch /tmp/hi rm -f /tmp/hi #-- #-- but doesn't know the following 3 changes #-- mkdir /tmp/another/yet touch /tmp/another/yet/file rm -fr /tmp/another/yet because there is really no change to /tmp, only its child directory. solution to #2 and #3 can do done with a different approch. something like the following might work: 1. recursively cache (in a hash) all sub directories and files under /tmp during start up of your daemon. 2. once a while, do the same resursive scan for the /tmp directory and compare the directory content with the hash you cached a while ago. 3. if there is any differences, you know something has changed and because you have 2 hashs, you can easily find out what really happened. for example, if the first hash has an entry where the second hash doesn't, you know something has been deleted from the directory. Or if the second hash has something that's missing from the first hash, you know there are new files. 4. update the cache to be the most recent scan. repeat step #2. File::Find module can help you do the recursive scan portion fairly easily. you can take the same approach but instead of caching the directory contents, you can cache each sub directory's last modified time instead. this will reduce the size of your hash a bit. either way, even this approach has many drawback: 1. if you target directory is huge, the scaning part will take a long time which brings us to the 2 drawback. 2. race condition. it's totally possible for a file to appear and disappear during your directory scan especially if the scan takes a long time or the directory is busy (means there are tons of activity in the directory so files appear and disappear really fast). your scan will miss those. you might need to apply some kind of locking to the directory during the scan. finally, take a look in CPAN to see if something comes up. on top of my head, i don't remember any modules that does what you want. good luck. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using whence
Hi. I have a perl script that calls various programs. I would like to be able to verify that a given program is being called from the right place - what I would use whence for in the korn shell. I tried $path = `whence $cmdname`; but I don't get anything in $path. I'm undoubtedly missing something - I'm a beginner! Thanks in advance for any clues - DAP -- David Parker Rocket Software (617) 614-2128 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of uninitialized value in pattern match (m//) at ...
Singing Banzo wrote: I think this is a very basic warning, but I coudn't find the way to avoid it (tried google, faq, and archive): Use of uninitialized value in pattern match (m//) at poComen.cgi line 138. line 138: if ($q-param('template') =~ /^[1234]$/) { # trying to find out if the value of a form parameter is a digit between 1 and 4 The warning means that the value of $q-param('template') is undef. This only happens with use strict. How can I get rid of it? if ( defined $q-param('template') and $q-param('template') =~ /^[1234]$/ ) { John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: Hmm....is a hot directory possible?
Hello, I should add that in the below script MAKEPORT is another script that I have performing once there is a change in the directory. From: [EMAIL PROTECTED] Date: 2003/06/26 Thu PM 05:20:51 EDT To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: Re: Hmmis a hot directory possible? I keep forgetting to post the hold group. Hopes this helps. #!/usr/bin/perl -w use strict; use POSIX qw(setsid); # set costants my$MAKEPORT=/home/jspencer/bin/make-port; # daemonize the program daemonize; while(1) { # set costants [EMAIL PROTECTED](/home/jspencer/acucorp/std/std-unix-misc.tar.gz) ; my$FIRSTTIME = $FILETIME[9]; my$SECTIME=scalar time; sleep(2); if (($FIRSTTIME + 2) $SECTIME) { system($MAKEPORT); }} sub daemonize { my $outlog = '/home/jspencer/bin/daemons/logs/hotfolder_out.log'; my $errorlog = '/home/jspencer/bin/daemons/logs/hotfolder_error.log'; chdir '/' or die Can't chdir to /: $!; umask 0; open STDIN, '/dev/null' or die Can't read /dev/null: $!; open STDOUT, $outlog or die Can't write to /dev/null: $!; open STDERR, $errorlog or die Can't write to /dev/null: $!; defined(my $pid = fork) or die Can't fork: $!; exit if $pid; setsidor die Can't start a new session: $!; } From: david [EMAIL PROTECTED] Date: 2003/06/26 Thu PM 04:16:49 EDT To: [EMAIL PROTECTED] Subject: Re: Hmmis a hot directory possible? Chris Zimmerman wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there some way that I can write a bit of code that will watch a directory and as soon as a file is written to that directory, something is run against that file? What would be the best way to turn this into a daemon? you could take a look at the stat function provided by Perl to see if the directory's last modified time or inode change time changed: #!/usr/bin/perl -w use strict; my($pmm,$pic); while(1){ my($mm,$ic) = (stat('/tmp'))[9,10]; if($pmm and $pic and $pmm != $mm || $pic != $ic){ print some change to /tmp\n; }else{ print .\n; } $pmm=$mm; $pic=$ic; sleep(7); } __END__ 1. this is not a daemon. 2. this only reports there are some changes (it could be adding a file or deleting a file,etc) in /tmp but you don't know what really happened there. 3. this only reports changes to /tmp not knowing any change below the /tmp level. for example: #-- #-- the scrpipt report the following 3 changes to /tmp #-- mkdir /tmp/another touch /tmp/hi rm -f /tmp/hi #-- #-- but doesn't know the following 3 changes #-- mkdir /tmp/another/yet touch /tmp/another/yet/file rm -fr /tmp/another/yet because there is really no change to /tmp, only its child directory. solution to #2 and #3 can do done with a different approch. something like the following might work: 1. recursively cache (in a hash) all sub directories and files under /tmp during start up of your daemon. 2. once a while, do the same resursive scan for the /tmp directory and compare the directory content with the hash you cached a while ago. 3. if there is any differences, you know something has changed and because you have 2 hashs, you can easily find out what really happened. for example, if the first hash has an entry where the second hash doesn't, you know something has been deleted from the directory. Or if the second hash has something that's missing from the first hash, you know there are new files. 4. update the cache to be the most recent scan. repeat step #2. File::Find module can help you do the recursive scan portion fairly easily. you can take the same approach but instead of caching the directory contents, you can cache each sub directory's last modified time instead. this will reduce the size of your hash a bit. either way, even this approach has many drawback: 1. if you target directory is huge, the scaning part will take a long time which brings us to the 2 drawback. 2. race condition. it's totally possible for a file to appear and disappear during your directory scan especially if the scan takes a long time or the directory is busy (means there are tons of activity in the directory so files appear and disappear really fast). your scan will miss those. you might need to apply some kind of locking to the directory during the scan. finally, take a look in CPAN to see if something comes up. on top of my head, i don't remember any modules that does what you want. good luck. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe,
Re: Hmm....is a hot directory possible?
From: Chris Zimmerman [EMAIL PROTECTED] Is there some way that I can write a bit of code that will watch a directory and as soon as a file is written to that directory, something is run against that file? What would be the best way to turn this into a daemon? Depends on the OS. Under windows it'd be Win32::ChangeNotify and Win32::Daemon(::Simple)? Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re : Compilation Errors
Hi All, Reading through Learning Perl (3rd Ed), and messing around with Binary Assignment Operators (2.5.3). Code is as follows : #!perl -w $fred = 4; print Fred is now : $fred \n; $fred += 4; print Add 4 to Fred : $fred \n; $fred *= 2; print Multiply by 2 : $fred \n; $fred -= 6; print Subtract 6 : $fred \n; $fred /= 2; print Divide by 2 : $fred \n; #$fred .= 5 $fred = $fred . 5 print $fred \n; And I get the following error : C:\SCRIPTS\testperl fred.pl syntax error at fred.pl line 14, near print Execution of fred.pl aborted due to compilation errors. What I'm trying to do is to append 5 to the value of $fred. If you comment out the last 3 lines, you get 5 as the value for $fred. Is this a valid assignment? Is it possible to paste in a number to the end of another number to make a new number? (In this case, 55). I've also tried encapsulating the value of 5 with and without '' and `` And I don't reckon changing Fred into Barney will work either :o) Thanks in advance, DerekB Meteor web site http://www.meteor.ie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: Re : Compilation Errors
Just a note - running win2k and perl v5.8.0 (built for MSWin32-x86-multi-thread). -Original Message- From: Derek Byrne Sent: 27 June 2003 00:13 To: [EMAIL PROTECTED] Subject: Re : Compilation Errors Hi All, Reading through Learning Perl (3rd Ed), and messing around with Binary Assignment Operators (2.5.3). Code is as follows : #!perl -w $fred = 4; print Fred is now : $fred \n; $fred += 4; print Add 4 to Fred : $fred \n; $fred *= 2; print Multiply by 2 : $fred \n; $fred -= 6; print Subtract 6 : $fred \n; $fred /= 2; print Divide by 2 : $fred \n; #$fred .= 5 $fred = $fred . 5 print $fred \n; And I get the following error : C:\SCRIPTS\testperl fred.pl syntax error at fred.pl line 14, near print Execution of fred.pl aborted due to compilation errors. What I'm trying to do is to append 5 to the value of $fred. If you comment out the last 3 lines, you get 5 as the value for $fred. Is this a valid assignment? Is it possible to paste in a number to the end of another number to make a new number? (In this case, 55). I've also tried encapsulating the value of 5 with and without '' and `` And I don't reckon changing Fred into Barney will work either :o) Thanks in advance, DerekB Meteor web site http://www.meteor.ie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re : Compilation Errors
-Original Message- From: Derek Byrne [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 4:15 PM To: '[EMAIL PROTECTED]' Subject: FW: Re : Compilation Errors Just a note - running win2k and perl v5.8.0 (built for MSWin32-x86-multi-thread). -Original Message- From: Derek Byrne Sent: 27 June 2003 00:13 To: [EMAIL PROTECTED] Subject: Re : Compilation Errors Hi All, Reading through Learning Perl (3rd Ed), and messing around with Binary Assignment Operators (2.5.3). Code is as follows : #!perl -w $fred = 4; print Fred is now : $fred \n; $fred += 4; print Add 4 to Fred : $fred \n; $fred *= 2; print Multiply by 2 : $fred \n; $fred -= 6; print Subtract 6 : $fred \n; $fred /= 2; print Divide by 2 : $fred \n; #$fred .= 5 $fred = $fred . 5 At this point, you are stringifying $fred, so this should be: $fred = $fred . '5'; -Mark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re : Compilation Errors
Oopsie - just saw my own mistake, forgot to add the ; at the end of the line preceding the last print.. Doh! Thank you Mark, just tried it again, and it works without the '' surrounding the 5.. to be proper, should it have the ''? -Original Message- From: LoBue, Mark [mailto:[EMAIL PROTECTED] Sent: 27 June 2003 00:45 To: 'Derek Byrne'; '[EMAIL PROTECTED]' Subject: RE: Re : Compilation Errors -Original Message- From: Derek Byrne [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 4:15 PM To: '[EMAIL PROTECTED]' Subject: FW: Re : Compilation Errors Just a note - running win2k and perl v5.8.0 (built for MSWin32-x86-multi-thread). -Original Message- From: Derek Byrne Sent: 27 June 2003 00:13 To: [EMAIL PROTECTED] Subject: Re : Compilation Errors Hi All, Reading through Learning Perl (3rd Ed), and messing around with Binary Assignment Operators (2.5.3). Code is as follows : #!perl -w $fred = 4; print Fred is now : $fred \n; $fred += 4; print Add 4 to Fred : $fred \n; $fred *= 2; print Multiply by 2 : $fred \n; $fred -= 6; print Subtract 6 : $fred \n; $fred /= 2; print Divide by 2 : $fred \n; #$fred .= 5 $fred = $fred . 5 At this point, you are stringifying $fred, so this should be: $fred = $fred . '5'; -Mark Meteor web site http://www.meteor.ie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re : Compilation Errors
-Original Message- From: Derek Byrne [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 4:44 PM To: 'LoBue, Mark'; Derek Byrne; '[EMAIL PROTECTED]' Subject: RE: Re : Compilation Errors Oopsie - just saw my own mistake, forgot to add the ; at the end of the line preceding the last print.. Doh! Thank you Mark, just tried it again, and it works without the '' surrounding the 5.. to be proper, should it have the ''? Perhaps perl is doing that for you also, it is just so smart, since the . is a string operator, it converts both arguments to strings. -Mark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of uninitialized value in pattern match (m//) at ...
Perfect! It works great. Thank you very much! Thanks Steve also, but I WANT warnings and all errors I can get as early as posible! =) Regards, SB. - Original Message - From: John W. Krahn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 6:29 PM Subject: Re: Use of uninitialized value in pattern match (m//) at ... Singing Banzo wrote: I think this is a very basic warning, but I coudn't find the way to avoid it (tried google, faq, and archive): Use of uninitialized value in pattern match (m//) at poComen.cgi line 138. line 138: if ($q-param('template') =~ /^[1234]$/) { # trying to find out if the value of a form parameter is a digit between 1 and 4 The warning means that the value of $q-param('template') is undef. This only happens with use strict. How can I get rid of it? if ( defined $q-param('template') and $q-param('template') =~ /^[1234]$/ ) { John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Original Message - From: Steve Grazzini [EMAIL PROTECTED] To: Singing Banzo [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 6:06 PM Subject: Re: Use of uninitialized value in pattern match (m//) at ... On Thu, Jun 26, 2003 at 04:28:49PM -0300, Singing Banzo wrote: Use of uninitialized value in pattern match (m//) at poComen.cgi line 138. line 138: if ($q-param('template') =~ /^[1234]$/) { This only happens with use strict. Are you sure? :-) It would make more sense if it only happened with use warnings. How can I get rid of it? You could make sure $q-param('template') is defined before using it in the pattern-match. OTOH, if you don't care whether it's defined (and I think it's safe to say that you don't care *here* whether it's defined) then you can locally turn off the uninitialized warnings: { no warnings 'uninitialized'; if ($q-param('template') =~ /$pattern/) { ... } } -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using whence
David Parker wrote: Hi. I have a perl script that calls various programs. I would like to be able to verify that a given program is being called from the right place - what I would use whence for in the korn shell. I tried $path = `whence $cmdname`; but I don't get anything in $path. I'm undoubtedly missing something - I'm a beginner! Thanks in advance for any clues There's no 'whence' command in ksh that I know of... I think you want 'which' -- Brett http://www.chapelperilous.net/ Grief can take care of itself; but to get the full value of a joy you must have somebody to divide it with. -- Mark Twain -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re : Compilation Errors
Last question on this, but, is there anything I should be aware of if I code the Fred prog like this : #!perl -w $Add = 4; $Mul = 2; $Sub = 6; $Div = 2; $Append = 5; $fred = 4; print Fred is now : $fred \n; $fred += $Add; print Add 4 to Fred : $fred \n; $fred *= $Mul; print Multiply by 2 : $fred \n; $fred -= $Sub; print Subtract 6 : $fred \n; $fred /= $Div; print Divide by 2 : $fred \n; $fred .= $Append; print Append 5 to Fred : $fred \n; -Original Message- From: LoBue, Mark [mailto:[EMAIL PROTECTED] Sent: 27 June 2003 00:51 To: 'Derek Byrne'; '[EMAIL PROTECTED]' Subject: RE: Re : Compilation Errors -Original Message- From: Derek Byrne [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 4:44 PM To: 'LoBue, Mark'; Derek Byrne; '[EMAIL PROTECTED]' Subject: RE: Re : Compilation Errors Oopsie - just saw my own mistake, forgot to add the ; at the end of the line preceding the last print.. Doh! Thank you Mark, just tried it again, and it works without the '' surrounding the 5.. to be proper, should it have the ''? Perhaps perl is doing that for you also, it is just so smart, since the . is a string operator, it converts both arguments to strings. -Mark Meteor web site http://www.meteor.ie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hmm....is a hot directory possible?
[EMAIL PROTECTED] writes: I keep forgetting to post the hold group. Hopes this helps. #!/usr/bin/perl -w [...] Jeez.. I wish you wouldn't over comment like that. Makes it too easy to figure out what is going on : ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hmm....is a hot directory possible?
david [EMAIL PROTECTED] writes: you could take a look at the stat function provided by Perl to see if the directory's last modified time or inode change time changed: This is not what the OP asked. But I wondered if one can determine if a file has been writen to or changed inside a directory by looking at a stat on the directory. File changes don't seem to be reflected in mtime, unless a new file is added or one taken away. Ditto for atime and ctime. So is stat not able to determine if a file has been written to by looking at the parent dir? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hmm....is a hot directory possible?
Harry, Please don't ever tell someone how to code their source. Jeez! Is right. -Original Message- From: Harry Putnam [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 6:19 PM To: [EMAIL PROTECTED] Subject: Re: Hmmis a hot directory possible? [EMAIL PROTECTED] writes: I keep forgetting to post the hold group. Hopes this helps. #!/usr/bin/perl -w [...] Jeez.. I wish you wouldn't over comment like that. Makes it too easy to figure out what is going on : ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hmm....is a hot directory possible?
Sorry, Chris. Harry, is right I should have explained better with my comments. Regards, Jaimee -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Hmm....is a hot directory possible?
jandrspencer [EMAIL PROTECTED] writes: Please don't ever tell someone how to code their source. Jeez! Is right. I don't see any smileys here so I guess you were offended. Even though it was clearly said in complete jest. Not sure how to respond. I guess its enough to say no ill intent was involved. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hmm....is a hot directory possible?
Sorry, Harry. I emailed to soon. I read the email as I commented to much, but really didn't comment at all. Which is not good! Best Regards, Jaimee -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Harry Putnam Sent: Thursday, June 26, 2003 9:44 PM To: [EMAIL PROTECTED] Subject: Re: Hmmis a hot directory possible? jandrspencer [EMAIL PROTECTED] writes: Please don't ever tell someone how to code their source. Jeez! Is right. I don't see any smileys here so I guess you were offended. Even though it was clearly said in complete jest. Not sure how to respond. I guess its enough to say no ill intent was involved. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]