RE: Config file
-Original Message- From: Rod [mailto:[EMAIL PROTECTED] Sent: martedì 2 dicembre 2003 16.55 To: beginners Subject: Config file What is the best way to read a config file for a perl script. I have some very ugly code that can do it, but I would like to find something cleaner. Thanks, Rod. ## configuration file example clientMaster.ini debug = 1 mailerFlag = 1 mailServer = mailhost.drh.it mailDir = hpi9670\\c\$\\inetpub\\mailroot\\pickup mailDirTemp = D:\\VoxNauta\\temp t1 = 600 #t2 = 60 t2 = 0 #tempiLog = cache logRun = cache Try this simple code for reading the above configuration file: open FILE_CONF,clientMaster.ini || die; while (FILE_CONF) { next if (/^#/ || /^;/ || /^$/ || /^\s/); eval(\$$_); } close FILE_CONF; # verifying variables read from configuration file print debug = $debug\nt1 = $t1\nt2 = $t2\nmailServer = $mailServer\nmailDir = $mailDir\nmailDirTemp = $mailDirTemp\n; print tempiLog = $tempiLog\nlogRun = $logRun\n; E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [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: create log as well as print on screen
Mark wrote: -Original Message- From: mark sony [mailto:[EMAIL PROTECTED] Sent: mercoledì 20 agosto 2003 15.11 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: create log as well as print on screen Hi All, I wrote a script which is running perfectly fine providing many outputs on the screen . Only glitch is that it does not print in a log file . Now what I want is that it would print on the screen as well as create a log file . At the end of the program I will output that the above output can also be seen at the $log_File_position . Hope I am clear with my question . Any type of pointers and I would be over the moon ;) Thanx in advance Mark I simply solve your problem in this manner (defining a sub log()...): . . . . . . open (LOG, my_log_file); . . . log(some text\n, 1, 1); # log on screen AND log on file . . . log(some text\n, 1, 0); # log on screen only . . . log(some text\n, 0, 1); # log on file only . . . close(LOG); . . . . . . sub log() { my ($stg, $a, $b) = @_; print $stg if $a; print LOG $stg if $b; } E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [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: writing back to a file
AN wrote: Hi, Newbie here. I am writing a program that takes a file that has two columns of words, extracts the second column, then saves the original file with only the data in the first column. Question #1 - would it be better to do this w/ the split or s/// functions ? Question #1 - how do I write back the results to the original file ? I tried using + or but all these do is add to the original file and not re-write it. if I open it like this then it erases the file first and I get no data. my source file (searchandreplace.txt) looks like this: X Y X Y X Y my code looks like this: my $source_file = searchandreplace.txt; open(SOURCE, +$source_file) || die can't open file: $1; flock(SOURCE,2); foreach ( SOURCE ) { s/\s+\w+//; print SOURCE ; } after I run the program it looks like this: X Y X Y X Y X X X instead of what I want X X X thanx for your patience. AN try this: my $source_file = searchandreplace.txt; open(IN,$source_file) || die can't open file: $1; while(IN) { $row = $_; $row =~ s/\s+\w+//i; push(@arr, $row); } close(IN); open(OUT,$source_file ) || die can't open file: $1; foreach (@arr) { print OUT $_; } close(OUT); E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [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]
get http through a proxy authentication
Hi In this code I do http request through the env proxy: my $user_agent = new LWP::UserAgent; $user_agent-agent(Mozilla/4.0); $user_agent-timeout($timeOut); $user_agent-env_proxy(); $page = ($user_agent-request(HTTP::Request-new(GET=$url)))-as_string; but my proxy requests an authetication (username/password). How can I introduce authetication in my code? Thanks! E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [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: regular expresion question.
Try $a = 30 23 * * * /usr/lbin/sa/sa1 600 6; $a =~ m|[^\/]+(.*\/[^\/\s]+)\s[^\/]+|i; $path = $1; print $path ; E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it http://www.loquendo.it/ [EMAIL PROTECTED] -Original Message- From: Jas Grewal (DHL UK) [mailto:[EMAIL PROTECTED] Sent: mercoledì 13 agosto 2003 15.29 To: [EMAIL PROTECTED] Org Subject: regular expresion question. Hi all, I am trying to write a regular expresion to get a file path from a cron file, I have issolated the required lines, but am having problems with extracting just the file path and name. The line is as follows : 30 23 * * * /usr/lbin/sa/sa1 600 6 I inned to extract just the '/usr/bin/sa/sa1' section. Any guidance would be appreciated. Jas 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
RE: get http through a proxy authentication
Jose`, your suggestion works fine. Problem solved. Thanks a lot. E. -Original Message- From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED] Sent: giovedì 7 agosto 2003 17.20 To: Darbesio Eugenio; [EMAIL PROTECTED] Subject: RE: get http through a proxy authentication Try use LWP::UserAgent; $ua = LWP::UserAgent-new; $ua-proxy(['http', 'ftp'] = 'http://proxy.mydomain:port'); $req = HTTP::Request-new('GET',http://www.perl.com;); $req-proxy_authorization_basic(username, password); $res = $ua-request($req); print $res-content if $res-is_success; José. -Original Message- From: Darbesio Eugenio [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 5:02 PM To: [EMAIL PROTECTED] Subject: get http through a proxy authentication Hi In this code I do http request through the env proxy: my $user_agent = new LWP::UserAgent; $user_agent-agent(Mozilla/4.0); $user_agent-timeout($timeOut); $user_agent-env_proxy(); $page = ($user_agent-request(HTTP::Request-new(GET=$url)))-as_string; but my proxy requests an authetication (username/password). How can I introduce authetication in my code? Thanks! E. LOQUENDO S.p.A. Vocal Technology and Services www.loquendo.it [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] DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. 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: perl help ftp
-Original Message- vemulakonda uday bhaskar wrote: ... can anyone tell me from where i can download Net::FTP from www.cpan.org ... Browse to http://search.cpan.org/ then search for Net::FTP. E. 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: help perl ftp
-Original Message- ... thoughi searched http://search.cpan.org/, i couldnot get the p[lace from where i can download NEt::FTP. I on;y got is a theorotical explanation of Net::FTP ... Try http://search.cpan.org/, then search for Net::FTP, choice the second one in the list, click (LMB) on libnet-1.16, click on Download button near This release ... Save this file to disk ... E. 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
-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
-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: 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]