procmail or perl to drop dups?
Greetings; Has anyone developed any method to drop messages that are cross-posted to both [EMAIL PROTECTED] and [EMAIL PROTECTED]? Care to share? Thanks, Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
$ENV{'HTTP_USER_AGENT'
Hi there, I have a problem in detecting any kind of environment variables. I always get a premature script error , when I launch sth like this. #!C:/Perl/bin/perl.exe -w use diagnostics; use strict; use CGI; $browser = $ENV{'HTTP_USER_AGENT'}; if ($browser =~ /Mozilla/) { # # Netscape # } else { # # Non Netscape # } I run a apache 1.3.22 with activ perl build518 what else do I have to say? I have no Idea... in my apache cgi is set up and i can run basic scripts from the prompt. who knows what I have to do? cheers. bernd __ Beginnen Sie das neue Jahr gut informiert: Zeitschriften-Abos zum Sparpreis! http://www.lycos.de/webguides/entertainment/weihnachten/abo.html 250 Farb-Visitenkarten GRATIS*. In einem Wert von EUR 99,00! http://www.vistaprint.de/vp/splash/lycosde.asp Jetzt eigene Domains für 1,23 Euro/Monat http://lycos.de.domainnames.com/default.asp?caller=lycos_d_footer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormMail Spam Hole
If you have time, please read the following article. If you use FormMail.cgi, then let me suggest that it's required reading. http://www.newsbytes.com/news/02/174174.html For beginning Perl/CGI programmers, this is good information to have. When I first started using CGIs, I used FormMail frequently, and I still have a few sites that employ a more feature-rich hack of the program called BFormMail. It's not necessarily just the script that is the problem; it is also how it is installed. If you choose to use this freeware CGI rather than writing your own code, make sure you run it SUID (on UNIX/Linux systems). If that sounds intimidating, it's not. It's a relatively painless process: 1. Log on to your UNIX web hosting account with your secure shell. (You have SSH access, right?) :-) 2. Find the directory where you have the script (probably cgi-bin, although if you can run scripts in another directory, that may frustrate some newer crackers). 3. Change the permissions of the directory to SUID: chmod 4711 dirname 4. Change the permissions of the CGI script to SUID (from within the cgi directory): chmod 4711 FormMail.cgi 5. Change the shebang line (line 1) of your FormMail script: Old way: #!/usr/bin/perl New way: #!/usr/bin/perl -U This tells your script that it will run the script as the authorized user, and any attempts to run it by an outside entity will be denied. Not due to any security built into the script, but rather the existing security mechanisms on *NIX. - Scot Robnett inSite Internet Solutions Square West Center 454 West Jackson Street Woodstock, IL 60098 (815)206-2907 office (815)342-6480 mobile [EMAIL PROTECTED] http://www.insiteful.tv --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Renaming files with Perl
Hello, I posted a question about this a couple days ago and only got 2 responses, but neither of them worked for him. So I figured I'd start new since he told me the EXACT format he would like the files to be in. My friend wants to rename a dat file as he calls it. (message.dat?) He would like to rename them in this exact format: the word mess, current date (2 character format) then the extension .html. So if he would run this today, the renamed file would be: mess020802.html Any ideas on this? He's really bugging me about it. :) Troy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $ENV{'HTTP_USER_AGENT'
Bernd Lach wrote: Hi there, I have a problem in detecting any kind of environment variables. I always get a premature script error , when I launch sth like this. #!C:/Perl/bin/perl.exe -w use diagnostics; use strict; use CGI; $browser = $ENV{'HTTP_USER_AGENT'}; if ($browser =~ /Mozilla/) { # # Netscape # } else { # # Non Netscape # } I run a apache 1.3.22 with activ perl build518 what else do I have to say? I have no Idea... in my apache cgi is set up and i can run basic scripts from the prompt. who knows what I have to do? cheers. bernd Just add: print Content-type: text/html\n\n; before you print anything else and on the other hand: I recomend not to use $ENV{'HTTP_USER_AGENT'} if using CGI module use user_agent() method instead: my $q = new CGI; my $uagent = $q-user_agent(); eGardz! ;-) -- The Power to Serve! http://www.freebsd.org/ : Kliment Ognianov : : Network Administrator Developer : : ISP Networks Department: : BulInfo Ltd. : :.: : ICQ #16864572, #64866894 : :.: : http://www.bulinfo.net/: :.:
Re: Renaming files with Perl
On Fri, 8 Feb 2002 06:48:56 -0800, Troy May [EMAIL PROTECTED] wrote: Hello, I posted a question about this a couple days ago and only got 2 responses, but neither of them worked for him. So I figured I'd start new since he told me the EXACT format he would like the files to be in. My friend wants to rename a dat file as he calls it. (message.dat?) He would like to rename them in this exact format: the word mess, current date (2 character format) then the extension .html. So if he would run this today, the renamed file would be: mess020802.html Any ideas on this? He's really bugging me about it. :) #!/usr/bin/perl -w use strict; my $file = 'message.dat'; my ($d,$m,$y)=(localtime)[3,4,5]; my $newname = sprintf('mess%02i%02i%02i.html', $d, ++$m, ($y+1900)%100); print $file = $newname\n; rename($file, $newname) or warn Could not rename '$file' to '$newname': $!\n; __END__ -- briac dynamic .sig on strike, we apologize for the inconvenience -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reading a big text file
Hi all, I want to read a text file line by line and to make some changes in some lines. Which method do you recommend? To store the file in an array, then to insert the changed value in that array, and then to write that array to the file, or to use a temporary file to store each line from the source file and twhen I want to modify a line, I have just to insert it in the temporary file. I ask this because I don't know if using the first method it will eat my whole memory. Thanks! Teddy, My dear email address is [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with a simple script
Hi all, I tried to make a simple script that for the moment needs only to read the content of a .dbx file. I used: #!c:\perl\bin\perl.exe print Content-type: text/html\n\n; #here I printed a simple HTML header. open (DAT, $file); while (DAT) { print $_; } # here the HTML footer. I think this should print the content of the file on the screen. But it prints only a line of text. I think I know which could be the problem but I don't know the solution. The file is a dbx one and it is not 100% text only. I want to read all the file and to extract the text. The line printed on the screen is: ÏþÅýtofãÑšNÀO£ ÔðäÀ RTâl ð“ €÷ ‰ œÜ ð8p‹ Ô*qLçÐPl Ž L Thank you for help. Teddy, My dear email address is [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading a big text file
On Fri, 8 Feb 2002, Octavian Rasnita wrote: To store the file in an array, then to insert the changed value in that array, and then to write that array to the file, or to use a temporary file to store each line from the source file and twhen I want to modify a line, I have just to insert it in the temporary file. I recommend the latter, using a temp file to write your changes out to. Reading a file into an array will eat up memory if it's a big file. -- Brett http://www.chapelperilous.net/ Q: Why do WASPs play golf ? A: So they can dress like pimps. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Image Galleries On-the-Fly
Hello, All: I'm hoping to build a CGI script that: 1. creates a thumbnail index of .jpg files in a directory, and 2. serves full-size images wrapped in an HTML template, on-the-fly. I recall a similar thread a few weeks ago on this list but have misplaced the series of messages that transpired (and I can't find the [EMAIL PROTECTED] arhive). Could somebody please tell me where to find the archive? -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image Galleries On-the-Fly
http://archive.develooper.com/beginners-cgi%40perl.org/ http://lists.perl.org At Friday, 8 February 2002, Eric Pretorious [EMAIL PROTECTED] wrote: Hello, All: I'm hoping to build a CGI script that: 1. creates a thumbnail index of .jpg files in a directory, and 2. serves full-size images .wrapped in an HTML template, on-the-fly. I recall a similar thread a few weeks ago on this list but have misplaced the series of messages that transpired (and I can't find the [EMAIL PROTECTED] arhive). Could somebody please tell me where to find the archive? -- Eric P. Los Gatos, CA -- 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: Image Galleries On-the-Fly
On Fri, 8 Feb 2002, Eric Pretorious wrote: I'm hoping to build a CGI script that: 1. creates a thumbnail index of .jpg files in a directory, and 2. serves full-size images wrapped in an HTML template, on-the-fly. I found the Apache::Album modlue and read the readme.txt file but still need some guidance on a few items: 1. Is there a module like Apache::Album that can be configured to wrap every response in an HTML template? 2. Should I split the thumbnail/index-creation and full-sized image response between two modules? 3. Is there a module that will add 'previous' and 'next' links to each full-sized image so that users can view the entire series of images without having to go back to the index after every image? 3. How can I set-up Apache to dynamically recognize users' photo directories. i.e., Add users to the system without adjusting httpd.conf for each new user? e.g., in httpd.conf: Alias /photos/*/ /home/*/photo_album/ # Would this work? instead of spec'ing: Alias /photos/eric/ /home/eric/photo_album/ Alias /photos/justine/ /home/justine/photo_album/ Alias /photos/ariel/ /home/ariel/photo_album/ ad nauseum. 4. Does Apache::Album cache the thumbnails or does it create then anew every time? -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image Galleries On-the-Fly
Eric == Eric Pretorious [EMAIL PROTECTED] writes: Eric I'm hoping to build a CGI script that: Eric 1. creates a thumbnail index of .jpg files in a directory, and Eric 2. serves full-size images Eric ...wrapped in an HTML template, on-the-fly. google for: site:stonehenge.com Stonehenge::Pictures -- 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: beginners-cgi Digest 8 Feb 2002 17:29:24 -0000 Issue 165
I want to change the string d:\orant\oracle to d:\\orant\\oracle Anyone know how to do this? Thanks, allen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:29 AM To: [EMAIL PROTECTED] Subject: beginners-cgi Digest 8 Feb 2002 17:29:24 - Issue 165 File: ATT1194029.txtMessage: Multiple Print Location:$link; Message: To write a script that reads numbers from STDIN and print on STDOUT.Message: Re: To write a script that reads numbers from STDIN and print on STDOUT.Message: Re: To write a script that reads numbers from STDIN and print on STDOUT.Message: regular expressionsMessage: Re: regular expressionsMessage: multipart/x-mixed-replace and image/gif
RE: beginners-cgi Digest 8 Feb 2002 17:29:24 -0000 Issue 165
On Fri, 8 Feb 2002, Allen Wang wrote: I want to change the string d:\orant\oracle to d:\\orant\\oracle Anyone know how to do this? $string =~ s|\\||g; (\ is used to escape metacharacters in a regexp, so you need to escape \ also). -- Brett http://www.chapelperilous.net/ Mathematicians practice absolute freedom. -- Henry Adams -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: beginners-cgi Digest 8 Feb 2002 17:29:24 -0000 Issue 165
--- Allen Wang [EMAIL PROTECTED] wrote: I want to change the string d:\orant\oracle to d:\\orant\\oracle Anyone know how to do this? Thanks, allen I'm not sure exactly what this stemmed from, so my comment may be out of place, but Perl is portable and will let you use the forward slash in file paths. With an absolute path it's not as useful, but a relative path such as ../images/foo.jpg could be just the same on a Windows box as a Linux box as a Mac Box... With that in mind: $path =~ s{\\}{/}g; Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: beginners-cgi Digest 8 Feb 2002 17:29:24 -0000 Issue 165
I am not sure that this applies to command lines - if I put a file path with / in a variable, then pass that variable to a command line tool, I think that fails. So I constantly have to put these kinds of variables in \\ form rather than s# before calling the CLT. Actually what I do is to help with porting is set a variable to / or \\ based on what OS I am in, use that variable as a directory/file separator, then use [\\/] in regexes that parse paths. Hopefully there is a better way? The same would probably be true for environment variables, which looks like what this Oracle thing is for. At Friday, 8 February 2002, Curtis Poe [EMAIL PROTECTED] wrote: --- Allen Wang [EMAIL PROTECTED] wrote: I want to change the string d:\orant\oracle to d:\\orant\\oracle Anyone know how to do this? Thanks, allen I'm not sure exactly what this stemmed from, so my comment may be out of place, but Perl is portable and will let you use the forward slash in file paths. With an absolute path it's not as useful, but a relative path such as ../images/foo.jpg could be just the same on a Windows box as a Linux box as a Mac Box... With that in mind: $path =~ s{\\}{/}g; Cheers, Curtis Ovid Poe = Ovid on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.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]
image button submit?
Is there a way to use an image button in CGI.pm to submit? Thanks, Josiah -Original Message- From: Al Hospers [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 8:42 PM To: 'Josiah Altschuler'; [EMAIL PROTECTED] Subject: RE: Passing a hash through a URL I have a question about passing data through URL's. I'm passing hashes in a CGI script, but sometimes when I click on a link that passes a larger hash, nothing happens. I don't get any message. I'm guessing there is a limit to the amount of data I can pass through a URL? If this is the case, are there any ways to fix this problem? I assume by passing data through URL's you mean using GET. there is a limit, I don't remember exactly what it is. if you use POST there is effectively no limit. hth Al Hospers CamberSoft, Inc. alatcambersoftdotcom http://www.cambersoft.com Shockwave and Director development, CD-ROM, HTML, CGI scripting, and Graphic Design. A famous linguist once said: There is no language wherein a double positive can form a negative. YEAH, RIGHT -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: image button submit?
On Fri, 8 Feb 2002, Josiah Altschuler wrote: Is there a way to use an image button in CGI.pm to submit? Sure: print image_button(-name='name', -src='path/to/img'); will produce: input type=image name=name src=/path/to/img / This is documented in the CGI.pm documentation, accessible via perldoc. -- Brett http://www.chapelperilous.net/ BOFH excuse #393: Interferance from the Van Allen Belt. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: procmail or perl to drop dups?
On Fri, 8 Feb 2002, Dennis G. Wicks wrote: Has anyone developed any method to drop messages that are cross-posted to both [EMAIL PROTECTED] and [EMAIL PROTECTED]? Here's the procmail recipe I use for duplicates: :0 Whc: msgid.lock | formail -D 8192 msgid.cache :0 a: DUPLICATES -- Brett http://www.chapelperilous.net/ A king's castle is his home. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $ENV{'HTTP_USER_AGENT'
On , Bernd Lach said: #!C:/Perl/bin/perl.exe -w use diagnostics; use strict; You're using strict and -w, good. use CGI; $browser = $ENV{'HTTP_USER_AGENT'}; Oops. You didn't declare $browser. my $browser = $ENV{HTTP_USER_AGENT}; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Complie perl with Tk
Can I use perlcc compile a perl program with Tk and DBD:mysql into .exe file on windows? How to make the command line? Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Seeking perlish workaround for problem with filehandle-tying in the camel
the Shout.pm and demonstration code in pperl3 pp 385-389 elicit a rather obfuscated error message Can't use an undefined value as filehandle reference at ... under 5.6.1 (activeperl / cygwin). Following is a minimal illustration : #!perl -w package Myfile; use Carp; require Tie::Handle; @ISA = (Tie::Handle); sub TIEHANDLE { use Symbol; my $class = shift; my $form = shift; open my $self, $form, @_or croak can't open $form@_: $!; return bless $self, $class; } sub CLOSE { my $self = shift; return close $self; } # ... more methods package main; tie(*FOO, Myfile::, +foo.tmp); # ... close FOO; The problem lies in the open line open my $self, $form, @_or croak can't open $form@_: $!; in conjunction with the form tie(*FOO, Myfile::, +foo.tmp); Using the alternate form tie(*FOO, Myfile::, +, foo.tmp); does not elicit an error, but constraining client code this way is harly acceptable. Changing the open line above into my $self; if (@_) { open $self, $form, @_ or croak can't open $form@_: $!; } else { open $self, $form or croak can't open $form: $!; } is better but beyond uglyness... There must exist a better way. Any taker ? Also, the error message sounds a bit off-topic, which might indicate a problem in 'open' itself. However I don't know who this should be reported to, nor how. Any pointers ? TIA, --Christian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
date
Hi all Is there a module/or some function to do calculations on date e.g. if today is 1st March, and i want the date for previous day (i.e. 28th or 29th Feb) Thanks in advance Regards Mayank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
objects and hash
problem? sub new { my $procc=shift; my $text=shift; my $self={}; return 0 unless $email; my @body=split('\n',$text); foreach (@body) { @ref=split(':',$_); $self-{header}-{$ref[0]}=$ref[1]; } ??? foreach $key (keys $self-{header}) ??? { ??? print $key.:.$self-{header}-{$key}.\n; ??? } bless $self; return $self; } : :. s pozdravom :.. Roman Fordinal :.. project manager :.: :.: WebCom s.r.o. - Internet Advertising Agency Design Studio :.: Stanicna 12, Zohor, Slovakia :.: Tel: +421.02.65458251, +421.0907.178147 :.: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Date
Hi all Is there a module/or some function to do calculations on date e.g. if today is 1st March, and i want the date for previous day (i.e. 28th or 29th Feb) Thanks in advance Regards Mayank -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: date
On Fri, Feb 08, 2002 at 04:32:58PM +0531, Mayank wrote: Hi all Is there a module/or some function to do calculations on date e.g. if today is 1st March, and i want the date for previous day (i.e. 28th or 29th Feb) The Date::Manip, although not the fastest, is by far the most comfortable module I know for that job. Another popular module is Date::Calc. -- If we fail, we will lose the war. Michael Lamertz| [EMAIL PROTECTED] Nordstr. 49| http://www.lamertz.net - http://www.perl-ronin.de 50733 Cologne | Priv:+49 221 445420 Germany| Mobile: +49 171 6900 310 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: objects and hash
On Fri, Feb 08, 2002 at 12:54:58PM +0100, Roman Fordinal wrote: problem? Yes! :.. Roman Fordinal :.. project manager Well, as a Project Manager you should, perhaps, be a bit more specific about what you want :-) sub new { my $procc=shift; my $text=shift; my $self={}; return 0 unless $email; Is that ---^^ global? And what's it for? my @body=split('\n',$text); foreach (@body) { @ref=split(':',$_); $self-{header}-{$ref[0]}=$ref[1]; } You cannot be sure that you now have a valid header. What if there's a quoted mailheader *inside* the message content? You need to make sure you only weed out the header section of the mail and ignore the body, since you'd overwrite your valid headers. Check out this sample-mail: -- snip -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Some stuff... Dear List members, can anybody enlighten me on why my mails bounce? Here are my headers: ...cut here... From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: overridden ... -- snip -- And gone are your real header fields. And besides from that you'd have another headerfield called 'Here are my headers' with an empty value. Go to http://search.cpan.org and look for some mailparsing module there. There are things like Mail::Box that'll assist you in parsing emails... -- If we fail, we will lose the war. Michael Lamertz| [EMAIL PROTECTED] Nordstr. 49| http://www.lamertz.net - http://www.perl-ronin.de 50733 Cologne | Priv:+49 221 445420 Germany| Mobile: +49 171 6900 310 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: date
Mayank wrote: Hi all Hello, Is there a module/or some function to do calculations on date e.g. if today is 1st March, and i want the date for previous day (i.e. 28th or 29th Feb) $ perl -le' print scalar localtime; print scalar localtime( time - 24 * 60 * 60 ); ' Fri Feb 8 04:36:56 2002 Thu Feb 7 04:36:56 2002 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: off topic question : simple shell script
This will do the job File starts from the line #!/bin/bash --- --- #!/bin/bash #-- #AUTHOR: William Ampeh #PURPOSE: Reads input from $1 (a file) and print output to $2 (another file) #- if [ $# -ne 2 ] then echo ; echo ; echo USAGE: $0 {input file} {ouput filename}; echo echoEG: $0 infile.txt outfile.txt; echo ; echo ; exit 1 fi INFILE=$1; OUTFILE=$2 # in case user switches order .. [ -s $OUTFILE ] { echo ERROR: $OUTFILE already exists. Remane or delete it; echo ; exit 2; } #... keeping track of old file handlers . exec 40 #save stdin handle, just a safety precaution in case you want to #read input from keyboard somewhere in this script exec 51 #save stdout handle, just a safety precaution in case you want to #write to screen somewhere in this script exec 0 $INFILE #opens $INFILE as file handle 0 (stdin) exec 1 $OUTFILE #opens $OUTFILE as file handle 1 (stdout) while read cell1 cell2 cell3 rest_of_line do echo column2 = $cell2-- rest of line = $rest_of_line #say # do some more manipulations done #... restore old file handlers . exec 04; exec 15 echo ; echo ; echo DONE exit 0 #-- # TRY THIS ON THE FOLLOWING INPUT FILE #l1_c1 l1_c2 l1_c3 l1_c4 l1_c5 #l2_c1 l2_c2 l2_c3 l2_c4 l2_c5 #l3_c1 l3_c2 l3_c3 l3_c4 l3_c5 #l4_c1 l4_c2 l4_c3 l4_c4 l4_c5 #l5_c1 l2_c2 l2_c3 l2_c4 l2_c5 #l6_c1 l6_c2 l6_c3 l6_c4 l6_c5 #The output will be: #column2 = l1_c2-- rest of line = l1_c4 l1_c5 #column2 = l2_c2-- rest of line = l2_c4 l2_c5 #column2 = l3_c2-- rest of line = l3_c4 l3_c5 #column2 = l4_c2-- rest of line = l4_c4 l4_c5 #column2 = l2_c2-- rest of line = l2_c4 l2_c5 #column2 = l6_c2-- rest of line = l6_c4 l6_c5 __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Other ways to send mail with perl?
I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) I would settle for ideas using a NT perl module also. I want to know all my options if possible. THANX! Nikola Janceski Summit Systems, Inc. 212-896-3400 I don't care to belong to any organization that accepts me as a member. -- Groucho Marx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
@ARGV and getopts
Good Morning, I have what I think is a trick question and is causing me a bit of trouble: My command line looks similar to this: command.pl-rz:\Tech Team -p/Tools Team -fFile Found Today.txt -vRDP 1.2_A What I'm trying to check for is to make sure when people run my script, they have each option surrounded by the double quotes, as you see above. To check this, I was at first trying to see what $opt_r as returned by 'getopts' was set to, but it strips off my quotes automatically, so there is no way to see what was actually input vs what is interpreted. Thus, I tried to see what @ARGV contained. @ARGV does the same thing! Here is a description of what I mean. If I look to see what $ARGV[0] is set to (from command above), it will say: -rz:\Tech Team (no quotes) whereas I was hoping it would say: -rz:\Tech Team(keeping my quotes) That way, if my command line was bad and looked like this: (Notice missing quote between -rz right after command.pl) command.pl-rz:\Tech Team -p/Tools Team -fFile Found Today.txt -vRDP 1.2_A ARGV[0] would return: -rz:\Tech Team and I would be able to catch the missing quote error. Perhaps I'm overlooking something, soif anyone can offer any advice, it would be greatly appreciated! Thnak you! -R -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: date
On Feb 8, John W. Krahn said: Mayank wrote: Is there a module/or some function to do calculations on date e.g. if today is 1st March, and i want the date for previous day (i.e. 28th or 29th Feb) $ perl -le' print scalar localtime; print scalar localtime( time - 24 * 60 * 60 ); ' Fri Feb 8 04:36:56 2002 Thu Feb 7 04:36:56 2002 That will break during daylight savings time adjustment... it's safer to get the time for noon, and THEN subtract 86400 from it, or to subtract 60 * 60 * ($hours + 2) where $hours is the current hour of the day. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Other ways to send mail with perl?
I use Solaris 8 and I can only find binaries for postie on linux, FreeBSD and Win32. Any more suggestions? -Original Message- From: McCollum, Frank [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:13 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Other ways to send mail with perl? postie.exe is a great tool. I use it with perl scripts a good bit, because it allows so many options. Any search on the web will turn up a copy. I am pretty positive it is freeware too. -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:08 AM To: [EMAIL PROTECTED] Subject: Other ways to send mail with perl? I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) I would settle for ideas using a NT perl module also. I want to know all my options if possible. THANX! Nikola Janceski Summit Systems, Inc. 212-896-3400 I don't care to belong to any organization that accepts me as a member. -- Groucho Marx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ IMPORTANT NOTICES: This message is intended only for the addressee. Please notify the sender by e-mail if you are not the intended recipient. If you are not the intended recipient, you may not copy, disclose, or distribute this message or its contents to any other person and any such actions may be unlawful. Banc of America Securities LLC(BAS) does not accept time sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail. BAS reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the BAS e-mail system. The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Other ways to send mail with perl?
I've been using Net::Smtp and liking it. At 9:08 AM -0500 2/8/02, Nikola Janceski wrote: I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) I would settle for ideas using a NT perl module also. I want to know all my options if possible. THANX! Nikola Janceski Summit Systems, Inc. 212-896-3400 I don't care to belong to any organization that accepts me as a member. -- Groucho Marx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ..---. |Jennifer Sturm | |System Administrator and Research Support Specialist | |Chemistry Department | |Hamilton College | | | |[EMAIL PROTECTED]| |315-859-4745 | |www.chem.hamilton.edu | ..---. |Duct tape is like the force. It has a light side, | | and a dark side, and it holds the universe together. | | -Carl Zwanzig | | | | | |One only needs two tools in life: WD-40 to make things| | go, and duct tape to make them stop. | | -G. Weilacher | ..---. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
procmail or perl to drop dups?
Greetings; Has anyone developed any method to drop messages that are cross-posted to both [EMAIL PROTECTED] and [EMAIL PROTECTED]? Care to share? Thanks, Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Other ways to send mail with perl?
You migth consider Mail::Sender. On Fri, 2002-02-08 at 09:17, Nikola Janceski wrote: I use Solaris 8 and I can only find binaries for postie on linux, FreeBSD and Win32. Any more suggestions? -Original Message- From: McCollum, Frank [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:13 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Other ways to send mail with perl? postie.exe is a great tool. I use it with perl scripts a good bit, because it allows so many options. Any search on the web will turn up a copy. I am pretty positive it is freeware too. -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:08 AM To: [EMAIL PROTECTED] Subject: Other ways to send mail with perl? I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) I would settle for ideas using a NT perl module also. I want to know all my options if possible. THANX! Nikola Janceski Summit Systems, Inc. 212-896-3400 I don't care to belong to any organization that accepts me as a member. -- Groucho Marx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ IMPORTANT NOTICES: This message is intended only for the addressee. Please notify the sender by e-mail if you are not the intended recipient. If you are not the intended recipient, you may not copy, disclose, or distribute this message or its contents to any other person and any such actions may be unlawful. Banc of America Securities LLC(BAS) does not accept time sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail. BAS reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the BAS e-mail system. The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Umlaut Zebra über alles! Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Renaming files with Perl
Hello, I posted a question about this a couple days ago and only got 2 responses, but neither of them worked for him. So I figured I'd start new since he told me the EXACT format he would like the files to be in. My friend wants to rename a dat file as he calls it. (message.dat?) He would like to rename them in this exact format: the word mess, current date (2 character format) then the extension .html. So if he would run this today, the renamed file would be: mess020802.html Any ideas on this? He's really bugging me about it. :) Troy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Renaming files with Perl
http://www.google.com/search?sourceid=navclientq=perl+rename+file HTH John -Original Message- From: Troy May [mailto:[EMAIL PROTECTED]] Sent: 08 February 2002 14:50 To: Perl Beginners Subject: Renaming files with Perl Hello, I posted a question about this a couple days ago and only got 2 responses, but neither of them worked for him. So I figured I'd start new since he told me the EXACT format he would like the files to be in. My friend wants to rename a dat file as he calls it. (message.dat?) He would like to rename them in this exact format: the word mess, current date (2 character format) then the extension .html. So if he would run this today, the renamed file would be: mess020802.html Any ideas on this? He's really bugging me about it. :) Troy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I get trim or rounding on a float number ?
$ aver = $total_hours/$total_jobs some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? thanks Jim F
Re: Renaming files with Perl
On Feb 8, Troy May said: I posted a question about this a couple days ago and only got 2 responses, but neither of them worked for him. So I figured I'd start new since he told me the EXACT format he would like the files to be in. My friend wants to rename a dat file as he calls it. (message.dat?) He would like to rename them in this exact format: the word mess, current date (2 character format) then the extension .html. So if he would run this today, the renamed file would be: mess020802.html You'll want the rename() function, and you can get the parts of the date you want from localtime() -- you'll be interested in (localtime)[3,4,5] to get only the elements you wanted. You'll use sprintf() to format them (%02d formats a number as a two-digit number with a leading zero if needed). That should be enough to start you on your way. If you come up with some code, and it doesn't work quite right, show it to us, and we'll see how we can help. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: objects and hash
Friday, February 08, 2002, 2:26:47 PM, you wrote: :.. Roman Fordinal :.. project manager ML Well, as a Project Manager you should, perhaps, be a bit more specific ML about what you want :-) sorry, my englisch is too bad for detail informations about my problem. but i have this problem result foreach (keys %{$self-{header}}) { print $_:$self-{header}-{$_}:\n; } : :. s pozdravom :.. Roman Fordinal :.. project manager :.: :.: WebCom s.r.o. - Internet Advertising Agency Design Studio :.: Stanicna 12, Zohor, Slovakia :.: Tel: +421.02.65458251, +421.0907.178147 :.: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get trim or rounding on a float number ?
On Fri, 8 Feb 2002, FLAHERTY, JIM-CONT wrote: $ aver = $total_hours/$total_jobs some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? my $aver = sprintf(%.2f, $total_hours/$total_jobs); perldoc -f sprintf -- Brett http://www.chapelperilous.net/ Forecast, n.: A prediction of the future, based on the past, for which the forecaster demands payment in the present. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I get trim or rounding on a float number ?
On Feb 8, FLAHERTY, JIM-CONT said: some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? perldoc -q round will tell you about whether or not Perl has a rounding function. If you're REALLY worried about whether 12.345 rounds to 12.34 or 12.35, then you should use a specific rounding function, but if not, you can use sprintf(): $num = sprintf %.02f, $raw; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do I get trim or rounding on a float number ?
Well, do you want to round or trim? The number you mention rounded to 2dp would be 25.00. Trimmed to 2dp would be 24.99. To round the number you could do this $number = 24.97; $rounded = sprintf %.2f,$number; print $rounded; To trim you could do $number = 24.97; ($rounded) = $number =~ /(\d*\.\d{2})/; print $rounded; John -Original Message- From: FLAHERTY, JIM-CONT [mailto:[EMAIL PROTECTED]] Sent: 08 February 2002 14:48 To: Beginners (E-mail) Subject: How do I get trim or rounding on a float number ? $ aver = $total_hours/$total_jobs some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? thanks Jim F --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
flock() failure - possible Perl compile problem?
Hi Folks, I posted this awhile back, but then had problems with my mailer and saw no responses. I have also attempted to clarify the froblem. When I run the following program under Linux ( Red Hat 7.1, Perl 5.6.0 ) it works fine. If I run the program under Solaris, it fails with Bad File Number ( EBADF). I have two Solaris machines, a Sun 450 running Solaris 2.6 on which I have compiled Perl 5.6.1 using gcc 2.8.1, and a Compaq running Solaris 8i with the installed Perl 5.005003. In config.h on both Solaris boxes HAVE_FLOCK is not defined, but HAVE_FCNTL is defined. I thought that Solaris perl emulated flock() using fcntl(), but the emulation appears not to work. Do I need to define any special flags when I compile perl in order to get the emulation? Unfortunately I am not in a position to upgrade my gcc or my OS at the present time. Thanks, Smiddy P.S. As you can probably tell from the commented out line, I have also tried: flock( fileno( dataHandle ), LOCK_EX ); #!/usr/bin/perl -w use strict; use Fcntl qw( :DEFAULT :flock ); # Put your data file name here. my $datafile = './test_file'; open( dataHandle, $datafile ) or die( Cannot open data file $datafile: $! ); # my $file_num = fileno( dataHandle ); flock( dataHandle, LOCK_EX ) or die( Cannot lock data file $datafile: $! ); print Ready to use file $datafile.\n; close( dataHandle ); exit( 0 ); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Other ways to send mail with perl?
Please keep in mind the I already have working e-mailer... I am looking for one that can create e-mails with outlook properties (ie. flags with due dates, meetings, etc.) I have looked into POSTIE, but that's not going to be enough for me. Any other ideas? (I wish I new the protocols that Outlook takes for this crap, I would write the module myself and distribute it free). -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:38 AM To: Nikola Janceski Cc: perl beginners Subject: RE: Other ways to send mail with perl? You migth consider Mail::Sender. On Fri, 2002-02-08 at 09:17, Nikola Janceski wrote: I use Solaris 8 and I can only find binaries for postie on linux, FreeBSD and Win32. Any more suggestions? -Original Message- From: McCollum, Frank [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:13 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Other ways to send mail with perl? postie.exe is a great tool. I use it with perl scripts a good bit, because it allows so many options. Any search on the web will turn up a copy. I am pretty positive it is freeware too. -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:08 AM To: [EMAIL PROTECTED] Subject: Other ways to send mail with perl? I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) I would settle for ideas using a NT perl module also. I want to know all my options if possible. THANX! Nikola Janceski Summit Systems, Inc. 212-896-3400 I don't care to belong to any organization that accepts me as a member. -- Groucho Marx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ IMPORTANT NOTICES: This message is intended only for the addressee. Please notify the sender by e-mail if you are not the intended recipient. If you are not the intended recipient, you may not copy, disclose, or distribute this message or its contents to any other person and any such actions may be unlawful. Banc of America Securities LLC(BAS) does not accept time sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail. BAS reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the BAS e-mail system. The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Umlaut Zebra über alles! Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do I get trim or rounding on a float number ?
Ah. Reading this I realised that while the number you gave (24.97) will round to 25.00 using sprintf, not all number will round as expected using that methos. Instead you can use this (which does appear to work). $number = 12.345; # Round this number $n = 2; # to this many places $rounded = int($number * (10 ** $n) + .5) / (10 ** $n); print $rounded; HTH John -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: 08 February 2002 15:01 To: FLAHERTY, JIM-CONT Cc: Beginners (E-mail) Subject: Re: How do I get trim or rounding on a float number ? On Feb 8, FLAHERTY, JIM-CONT said: some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? perldoc -q round will tell you about whether or not Perl has a rounding function. If you're REALLY worried about whether 12.345 rounds to 12.34 or 12.35, then you should use a specific rounding function, but if not, you can use sprintf(): $num = sprintf %.02f, $raw; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --Confidentiality--. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Replacing text in only certain sections of a file.
Hi all, I am having some problems and I can't seem to get it right. In short, I want to only modify text in a specific section. That section is denoted by the following snip *DESCRIPTION multiple line of text to be edited *END snip Here is what I have. I know the problem, I am reading this line by line so when I find the DESCRIPTION I drop into the loop, but because I still have DESCRIPTION obviously I won't search and replace. open (RUNSET, $FLOW) || die Can't access $FLOW[0][1]\n; while (RUNSET) { if ($_ =~ m/DESCRIPTION/){ print Entering description block; until ( $_ =~ m/END\.){ print Entering until; # next if /;/ # Remove Comments s/^\ INDISK\s+=.*/ INDISK= $FILENAME ; SMK /; s/^\ PRIMARY\s+=.*/ PRIMARY = $CELLNAME ; SMK /; } } print TEMPFLOW $_; # push @runset, $_ ; } I know there must be a way to do this. I know I could get messy by using a flag, but I'm sure there is a better way. Would anyone mind helping me out on this? Thanks -- Steven M. Klass Physical Design Manager National Semiconductor Corp 7400 W. Detroit Street Suite 170 Chandler AZ 85226 Ph:480-753-2503 Fax:480-705-6407 [EMAIL PROTECTED] http://www.nsc.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $ENV{'HTTP_USER_AGENT'
Bernd Lach wrote: Hi there, I have a problem in detecting any kind of environment variables. I always get a premature script error , when I launch sth like this. #!C:/Perl/bin/perl.exe -w use diagnostics; use strict; use CGI; $browser = $ENV{'HTTP_USER_AGENT'}; if ($browser =~ /Mozilla/) { # # Netscape # } else { # # Non Netscape # } I run a apache 1.3.22 with activ perl build518 what else do I have to say? I have no Idea... in my apache cgi is set up and i can run basic scripts from the prompt. who knows what I have to do? cheers. bernd Just add: print Content-type: text/html\n\n; before you print anything else and on the other hand: I recomend not to use $ENV{'HTTP_USER_AGENT'} if using CGI module use user_agent() method instead: my $q = new CGI; my $uagent = $q-user_agent(); eGardz! ;-) -- The Power to Serve! http://www.freebsd.org/ : Kliment Ognianov : : Network Administrator Developer : : ISP Networks Department: : BulInfo Ltd. : :.: : ICQ #16864572, #64866894 : :.: : http://www.bulinfo.net/: :.:
RE: append local file to remote file
-Original Message- From: Alex Harris [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 3:08 PM To: [EMAIL PROTECTED] Subject: append local file to remote file Apologies for the loosely interpreted perl issue below. I have rsh on my system and nothing else is available that I know of. I need to send a local file to a remote system and APPEND the local file to the remote file. All I can find in the man pages however is how to do just the reverse. I realize that I can rcp it over then do the remote file append to remote file, but I'd like to do the whole process in ONE step not two. Any ideas? Anything in Perl? Does the remote system have ftp running? If so, you could use the Net::FTP module to append to the remote file. Or, if you want to use rsh, how about something like: $ rsh remotehost 'cat remotefile' localfile -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looking for Mod 10 check digit routine
A quick jaunt over to http://search.cpan.org reveals Search: mod10 --- no results. Search: credit RESULTS! Give the Business::CreditCard module a try. Actually, it is what I use quite often... Good luck! Brent [EMAIL PROTECTED] ate.oh.us To: [EMAIL PROTECTED] cc: 02/08/02 09:41 AM Subject: Looking for Mod 10 check digit routine Can anyone refer me to where I might be able to find the code to do a mod 10 check digit calculation so that I can use it as a guide in creating a subroutine to do that? I have the info and theory but need an example to see how it's actually done. Thanks! -- 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: Getting mail with Perl
Try the Mail::Pop3Client. It is available from CPAN I think. You should be able to use this to get your messages. The following code is used to print the headers of all your emails. This is straight from example code on the Mail::Pop3Client site (cant remember the address sorry, but just tytype Mail::Pop3Client into google, and you should have alot of luck). use Mail::POP3Client; $pop = new Mail::POP3Client( USER = USERNAME, PASSWORD = PASSWORD, HOST = SERVERNAME ); for( $i = 1; $i = $pop-Count(); $i++ ) { foreach( $pop-Head( $i ) ) { /^(From|Subject):\s+/i print $_, \n; } } $pop-Close(); Chris. - Original Message - From: Jerry Preston [EMAIL PROTECTED] To: begginners [EMAIL PROTECTED] Sent: Saturday, February 09, 2002 4:36 AM Subject: Getting mail with Perl Hi, I what to be able to check and read mail, is this possible with PERL? If so, what, where do I need to look, read and learn? Thanks, Jerry -- 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: Other ways to send mail with perl?
From: Nikola Janceski [EMAIL PROTECTED] I currently use Mime::Entity to send mail with attachments but I have to pipe to 'sendmail' regardless. Any ideas if there is an alternative mailing program or module to send mail without using 'sendmail'? I send mail on UNIX. And I would like to send mail with 'MS Outlook' type properties (ie. Follow up flags with due dates, etc.) Send yourself a mail from Outlook with those options and then look at the headers. Whatever mail module/program you use it should allows you to add custom headers. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @ARGV and getopts
From: Pfeiffer, Richard [EMAIL PROTECTED] I have what I think is a trick question and is causing me a bit of trouble: My command line looks similar to this: command.pl-rz:\Tech Team -p/Tools Team -fFile Found Today.txt -vRDP 1.2_A What I'm trying to check for is to make sure when people run my script, they have each option surrounded by the double quotes, as you see above. If you happen to use Windows you may get the original command line like this: use Win32::API; { my $GetCommandLine = Win32::API-new('kernel32', 'GetCommandLine', [ ] , 'P' ); $cmdline = $GetCommandLine-Call(); } If you are using a *nix you are out of luck. The shell has processed the parameters and stripped the quotes before exec()uting your script and passing it the parameters array. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: execute dynamic block of code
On Feb 8, John said: On Feb 7, Jeff 'japhy' Pinyan said: ($func, $fname, @args) = ( UCM::ucmPiperNewsDB, \UCM::ucmPiperNewsDB, $file, uc(INTERNET_$env), $script, ); print Simulating $func(@args)\n; Ick. My brain switched $func and $fname. It would make more sense for $fname to be UCM::ucmPiperNewsDB and for $func to be the reference, but oh well. I was trying to avoid the multiple variables, and specifically having to change two strings/variables where there is really only one value (since this might end up being a big if (why no switch/case?) so I will cut and pasto. This solution does work. $fname-( @args ); Will the subroutine be called as if I had used subroutine? I don't see how it could since I am passing parameters, but I don't want to execute it that way (without it's own parameter stack) so I want to be sure. I read about this in perldoc perlsub but couldn't find this detail. Also, if I did want it to be called as subroutine (not that I would), how would I specify this? $fname(@args); $fname is a REFERENCE to a function. To call the function, you must either do $fname-(...) or $fname(...). When I use uc( INTERNET_$env_NEWS ), the result is INTERNET_. I have to use INERNET_${env}_NEWS. Is that a bug or a feature, and if a feature, what is the feature? The _ character is allowed in variables names. $abc_def = x; $abc = y; print $abc_def, ${abc}_def; # x, y_def So it is indeed a feature. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re[2]: objects and hash
From: Roman Fordinal [EMAIL PROTECTED] Friday, February 08, 2002, 2:26:47 PM, you wrote: :.. Roman Fordinal :.. project manager ML Well, as a Project Manager you should, perhaps, be a bit more specific ML about what you want :-) sorry, my englisch is too bad for detail informations about my problem. Tak mi to poslete slovensky :-) (So send it directly to me in Slovak.) Because this way noone understands what's the problem. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
print over prior print
I recall doing this in C a long long time ago, but I've forgotten most of my C. Is it possible and how would you print say an integer from a count++ and have the next increment print over the last? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: print over prior print
print First number\r; print Second number\n; ## this has too be longer than the first it overwrites what was there. -Original Message- From: Jesse Ahrens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:12 PM To: [EMAIL PROTECTED] Subject: print over prior print I recall doing this in C a long long time ago, but I've forgotten most of my C. Is it possible and how would you print say an integer from a count++ and have the next increment print over the last? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl variable - cuts
Hi all; Got a newbie question for you. I have a number of exactly 10 digits (2001090701) and I want to be able to read it from a file, cut the first 8 digits from the last two digits and put each into a variable (for comparison and addition). I would do it in the korn shell like this: NUM=`grep Serial FILE | awk '{print $1}'` TODAY=`date '+%Y%m%d'` FDAY=`echo $NUM | cut -c 1-8` typeset -Z2 INCR INCR=`echo $NUM | cut -c 9-10` if [ $FDAY -ne $TODAY ]; then SNUM=${TODAY}01 else let INCR=$INCR + 1 SNUM=${TODAY}${INCR} fi print $SNUM ;Serial NEWFILE However, I need to insert this logic into an existing perl script and am only vaguely familiar with Perl (I can figure out what they do - but do most of my programming in sh or ksh) Thanks so much, Chris P.S. Please respond to my email address. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: print over prior print
in perl... $count++; print ${count}\r; -Original Message- From: Jesse Ahrens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:12 PM To: [EMAIL PROTECTED] Subject: print over prior print I recall doing this in C a long long time ago, but I've forgotten most of my C. Is it possible and how would you print say an integer from a count++ and have the next increment print over the last? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ IMPORTANT NOTICES: This message is intended only for the addressee. Please notify the sender by e-mail if you are not the intended recipient. If you are not the intended recipient, you may not copy, disclose, or distribute this message or its contents to any other person and any such actions may be unlawful. Banc of America Securities LLC(BAS) does not accept time sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail. BAS reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the BAS e-mail system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl variable - cuts
$num = 2001090701; if ($num =~ /(\d{8})(\d{2})/) { $fday = $1; $incr = $2; print fday = $fday \t incr = $incr \n; } else { print $num is not in correct format\n; } The regular expression /(\d{8})(\d{2})/ looks for 8 digits followed by 2 digits and stores the results (due to the parens) in $1 and $2. /\/\ark -Original Message- From: HURT, CHRIS [Non-Pharmacia/1000] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:29 AM To: '[EMAIL PROTECTED]' Subject: Perl variable - cuts Importance: High Hi all; Got a newbie question for you. I have a number of exactly 10 digits (2001090701) and I want to be able to read it from a file, cut the first 8 digits from the last two digits and put each into a variable (for comparison and addition). I would do it in the korn shell like this: NUM=`grep Serial FILE | awk '{print $1}'` TODAY=`date '+%Y%m%d'` FDAY=`echo $NUM | cut -c 1-8` typeset -Z2 INCR INCR=`echo $NUM | cut -c 9-10` if [ $FDAY -ne $TODAY ]; then SNUM=${TODAY}01 else let INCR=$INCR + 1 SNUM=${TODAY}${INCR} fi print $SNUM ;Serial NEWFILE However, I need to insert this logic into an existing perl script and am only vaguely familiar with Perl (I can figure out what they do - but do most of my programming in sh or ksh) Thanks so much, Chris P.S. Please respond to my email address. -- 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]
print, sleep, print.....
While looking over the 'print over prior print' thread, I found that, as it should be, perl will print out as fast as it can. Below code #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; } So? Great, right? Well, what if I want to slow if down with a sleep() statement? #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; sleep(1); } From what I have done using perl 5.4.x, I was able to do things like this. But it seems that perl 5.6.0 will just sleep and not print anything out. Can someone explain why? And can some one explain how to slow the while loop down a bit if not using sleep()? Thanks! -James James Kelty Sr. Unix Systems Administrator The Ashland Agency 541.488.0801 [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: print, sleep, print.....
Look at perldoc -q flush. On Fri, 2002-02-08 at 12:50, James Kelty wrote: While looking over the 'print over prior print' thread, I found that, as it should be, perl will print out as fast as it can. Below code #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; } So? Great, right? Well, what if I want to slow if down with a sleep() statement? #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; sleep(1); } From what I have done using perl 5.4.x, I was able to do things like this. But it seems that perl 5.6.0 will just sleep and not print anything out. Can someone explain why? And can some one explain how to slow the while loop down a bit if not using sleep()? Thanks! -James James Kelty Sr. Unix Systems Administrator The Ashland Agency 541.488.0801 [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wierd Error
Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: directory tree minus certain directories
Use File::Find in V5.6.1 of perl or higher. -Original Message- From: John [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:56 PM To: [EMAIL PROTECTED] Subject: directory tree minus certain directories Is this the right/best way to do this? I wanted to use File::Find but couldn't figure out how to exclude directories. I want to display a directory tree, but I don't want to display the directories called WORKAREA, STAGING, EDITION, or .raw, and I don't want to search those directories for subdirectories either. This is on NT, I'm not sure that matters. Anyone else using Interwoven TeamSh?ite? use strict; require TeamSite::Config; my $iwmount = TeamSite::Config::iwgetmount(); my @list = (); addSubDirs( $iwmount, \@list ); print join( \n, @list ); sub addSubDirs { my $dir = shift( @_ ); my $list = shift( @_ ); local *DIR; opendir( DIR, $dir ) || die( opendir $dir fails : $! ); while( defined( my $sub = readdir( DIR ))) { if ( $sub !~ m#^(EDITION|WORKAREA|STAGING|\.{1,2}|\.raw)$# -d ${dir}\\${sub} ) { addSubDirs( ${dir}/${sub} ); } } closedir( DIR ); push( @list, $dir ); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: directory tree minus certain directories
At Friday, 8 February 2002, Nikola Janceski nikola_janceski@summithq. com wrote: Use File::Find in V5.6.1 of perl or higher. I gotta go with what the vendor ships. This version doesn't seem to have CGI Vars either, which would be really handy. Anyone know what the approximate build date for this would be? Any issues regarding this version I should cower in fear of? C:\iwperl -v This is perl, version 5.005_03 built for MSWin32-x86 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy for Access Tables?
I guess this means nobody knows anyway to do this??? -Original Message- From: Ned Cunningham [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 11:21 AM To: '[EMAIL PROTECTED]' Subject:Copy for Access Tables? Hi, I have 2 tables in an Access mdb that I need to distribute to 500 remote sites. I would need to copy the tables into an existing mdb that does not have Access loaded on the system. Can this be done with PERL? Is there a way to copy the tables in a PERL script? Thankx -- 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: Wierd Error
Obviously you have been a good programmer and turend on warning (either with -w or use warnings). What you are seeing is not an error; it is a warning. Warnings are good because they help you find places where you did something wrong, but sometimes you do mean to do a dangerous thing. In those cases you can say something like this no warnings; $freqidx{$key}[$_] += $fields[$vars[$_]]; use warnings; On Fri, 2002-02-08 at 13:00, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Frink! Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
The only concern I have with that is that there will always be different types of data coming into the script. Is there any way to test (regex?) for a non-digit character in the first position set then 0? $freqidx{$key}[$_] += $fields[$vars[$_]] unless( $vars[$_] =~ /^\d/ ); Would something like that work? -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:17 PM To: 'Balint, Jess' Subject: RE: Wierd Error set those that are to 0 when you want to do algebric operations. -Original Message- From: Balint, Jess [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:07 PM To: 'Nikola Janceski' Cc: '[EMAIL PROTECTED]' Subject: RE: Wierd Error Is there any way to correct this without removing warnings and strict? -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:14 PM To: 'Balint, Jess' Subject: RE: Wierd Error you have warnings and or use strict in your code on. -Original Message- From: Balint, Jess [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:00 PM To: '[EMAIL PROTECTED]' Subject: Wierd Error Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How Decompose Hash of Arrays
After creating a Hash of Arrays, how can I later access the individual elements of the Array values? Have tried various constructs from Programming Perl, and Perl Cookbook, but can't extrapolate them into code that works - probably because my brain is fossilized. Thanks, Hew Hewlett M. Pickens B I Moyle Associates, Inc. --- From program that creates the DB my %hashStats; my $dbStats = hewDBstats; unless (dbmopen %hashStats, $dbStats, 0666) { print HEW008 - Cannot open $dbStats \n; exit 12; } # this line is part of a loop that writes 6 array entries. # $statsIn[2] is a time stamp. %hashStats =($statsIn[2] = [@statsIn] ); unless (dbmclose %hashStats) { print HEW009 - Cannot close $dbStats \n; } - ls hewDBstats.db shows: 12288 Feb 7 21:33 hewDBstats.db - From program reading the file/database (not all attempts are shown): use Data::Dumper; my $dbStats = hewDBstats; dbmopen my %hashStats, $dbStats, 0666 or die HewTrace002 - cannot open $dbStats for input \n; - print Dumper(%hashStats); # gives the following # key is the time, value is ARRAY ... $VAR1 = '19:45:56'; $VAR2 = 'ARRAY(0x4a68d4)'; $VAR3 = '19:46:40'; $VAR4 = 'ARRAY(0x4a68d4)'; $VAR5 = '19:46:51'; $VAR6 = 'ARRAY(0x4a68d4)'; $VAR7 = '19:46:07'; $VAR8 = 'ARRAY(0x4a68d4)'; $VAR9 = '19:46:18'; $VAR10 = 'ARRAY(0x4a68d4)'; $VAR11 = '19:46:29'; $VAR12 = 'ARRAY(0x4a68d4)'; Y - # this code gives the following (which except for the Y # on the $VAR12, correspondes to Dumper output of values): while ((my $keyStats, my $valueStats) = each(%hashStats)) { print $keyStats has value of $valueStats \n; } HewTrace003 - from while loop at bottom of PP pg 281 19:45:56 has value of ARRAY(0x4a68d4) 19:46:40 has value of ARRAY(0x4a68d4) 19:46:51 has value of ARRAY(0x4a68d4) 19:46:07 has value of ARRAY(0x4a68d4) 19:46:18 has value of ARRAY(0x4a68d4) 19:46:29 has value of ARRAY(0x4a68d4) --- # If I do this, I get a compile time message: while ((my $keyStats, my $valueStats) = each(%hashStats)) { print $keyStats has value of $valueStats \n; print $valueStats[1] \n; } Global symbol @valueStats requires explicit package name at hewtest.pl line 20 # Line 20 is the print $valueStats[1] -- # If I do this, I get a compile time message: while ((my $keyStats, my $valueStats) = each(%hashStats)) { print $keyStats has value of $valueStats \n; my @testArray = @valueStats; print $valueStats[1] \n; } Global symbol @valueStats requires explicit package name at hewtest.pl line 21 - # and, finally, tried this: print $valueStats-{$keyStats}, \n; and got: Global symbol @valueStats requires explicit package name at hewtest.pl line 21 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wierd Error
On Fri, 8 Feb 2002, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. You should probably make those explicitly into 0 values. If you are using the 'strict' pragma, this will throw an error. You can make sure it is a number by doing something like: $fields[$vars[$_] ||= 0; Or, better yet, when creating the array, make 0 the default value, not (both will yield boolean false when used in an expression). -- Brett http://www.chapelperilous.net/ Your password is pitifully obvious. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Copy for Access Tables?
On Fri, 8 Feb 2002, Ned Cunningham wrote: I guess this means nobody knows anyway to do this??? With Perl, you can manipulate Access tables using DBI and the DBD::ODBC driver. But if Access is not loaded on the system, you could have trouble if you don't have the correct ODBC driver for Access available on the target system. -- Brett http://www.chapelperilous.net/ Are we running light with overbyte? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Data conversion
You could probably do it with something like this. my %month = ( Jan = '01', Feb = '02', Mar = '03', Apr = '04', May = '05', Jun = '06', Jul = '07', Aug = '08', Sep = '09', Oct = '10', Nov = '11', Dec = '12', ); # Be sure to quote the numbers, because they have to be # evaluated as a string, otherwise perl will remove the # leading zero. open( LOG, /path/to/logfile ) or die Cannot open log file: $!; flock LOG, 2; while(LOG) { # search string for match. If found print with new format if( /(\w{3}) (\d{1,2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})/ ) { print $6 $month{$1} $2 $3 $4 $5\n; } } close( LOG ) or die Cannot close log file: $!; I hope that gets you on the right track. Comments or suggestions are welcome. Joshua Colson Systems Administrator Giant Industries, Inc. (480) 585-8714 [EMAIL PROTECTED] -Original Message- From: Busse, Rich [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 11:09 AM To: Perl Beginners Subject: Data conversion I'm working with some log file entries that look like: BDE Monitor End - Wed Jan 30 08:36:28 2002 I need to turn the time stamp part of it into: 2002 01 30 08 36 28 Are there modules available for this type of conversion? Would Date::Manip be a good choice? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: change NT password through browser
so, wait, you want to pass a plain text pass. through the internet ? i don't think that's so cool. - Original Message - From: John [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 10:25 AM Subject: change NT password through browser Anyone know if there is a way to do this with Perl? -- 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: change NT password through browser
No, not cool. It's an intranet page, so it shouldn't be so bad. Also I assume I could write javscript or whatever to encrypt, hopefully there is a standard function? At Friday, 8 February 2002, Matthew Peter Lyon [EMAIL PROTECTED] wrote: so, wait, you want to pass a plain text pass. through the internet ? i don't think that's so cool. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
Looks like it. I ran perl -e '$i = 1; $j = undef; print $i + $j, \n' and got 1 then perl -we '$i = 1; $j = undef; print $i + $j, \n' and got Use of uninitialized value in addition (+) at -e line 1. 1 and finally perl -we '$i = 1; $j = undef; no warnings; print $i + $j, \n' and got 1 On Fri, 2002-02-08 at 13:18, Balint, Jess wrote: Will this also stop warnings from undefined values? So maybe I could take out the if..defined line and it would still add 0 if the value is undefined? Thanks. -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:20 PM To: Balint, Jess Cc: '[EMAIL PROTECTED]' Subject: Re: Wierd Error Obviously you have been a good programmer and turend on warning (either with -w or use warnings). What you are seeing is not an error; it is a warning. Warnings are good because they help you find places where you did something wrong, but sometimes you do mean to do a dangerous thing. In those cases you can say something like this no warnings; $freqidx{$key}[$_] += $fields[$vars[$_]]; use warnings; On Fri, 2002-02-08 at 13:00, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Frink! Missle Address: 33:48:3.521N 84:23:34.786W -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Kallisti! Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: print, sleep, print.....
I saw this too and immediately thought of flushing... Try adding this before you go into the while loop: $|++; Jason If memory serves me right, on Friday 08 February 2002 12:50, James Kelty wrote: While looking over the 'print over prior print' thread, I found that, as it should be, perl will print out as fast as it can. Below code #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; } So? Great, right? Well, what if I want to slow if down with a sleep() statement? #!/usr/bin/perl -w $count = 1; while(1) { $count++; print ${count}\r; sleep(1); } From what I have done using perl 5.4.x, I was able to do things like this. But it seems that perl 5.6.0 will just sleep and not print anything out. Can someone explain why? And can some one explain how to slow the while loop down a bit if not using sleep()? Thanks! -James James Kelty Sr. Unix Systems Administrator The Ashland Agency 541.488.0801 [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: directory tree minus certain directories
I would just cower in fear of having to deal with whatever the vendor hands you. :) -Original Message- From: John [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:17 AM To: [EMAIL PROTECTED] Subject: RE: directory tree minus certain directories At Friday, 8 February 2002, Nikola Janceski nikola_janceski@summithq. com wrote: Use File::Find in V5.6.1 of perl or higher. I gotta go with what the vendor ships. This version doesn't seem to have CGI Vars either, which would be really handy. Anyone know what the approximate build date for this would be? Any issues regarding this version I should cower in fear of? C:\iwperl -v This is perl, version 5.005_03 built for MSWin32-x86 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
On Fri, 8 Feb 2002, Balint, Jess wrote: That errors seems to be quieted. THank you. Now, there is this 114: foreach( sort( keys( %freqidx ) ) ) { 115: print( $_| ); 116: print( $_| ) foreach( @{$freqidx{$_}} ); 117: print( \n ); 118: } I get the error: Use of uninitialized value at ../20020128/pasummary.pl line 114. Use of uninitialized value at ../20020128/pasummary.pl line 114. I understand this also may be because I have warnings on, but I am also trying to understand why line 114 is flagged? I recommend not turning warnings on and off in your code -- make the code work with warnings on, that's my philosophy. :-) It seems odd that it is flagging line 114 -- do you have elements in %freqidex such that $freqidx{$_} yields undef? -- Brett http://www.chapelperilous.net/ Sometimes when you look into his eyes you get the feeling that someone else is driving. -- David Letterman -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
That would have been easy, but now here is what I get: Can't locate warnings.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at ../20020128/pasummary.pl line 99. BEGIN failed--compilation aborted at ../20020128/pasummary.pl line 99. Where line 99 is the 'no warnings;' line. Perl -w works fine. Now I really don't understand!? -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:20 PM To: Balint, Jess Cc: '[EMAIL PROTECTED]' Subject: Re: Wierd Error Obviously you have been a good programmer and turend on warning (either with -w or use warnings). What you are seeing is not an error; it is a warning. Warnings are good because they help you find places where you did something wrong, but sometimes you do mean to do a dangerous thing. In those cases you can say something like this no warnings; $freqidx{$key}[$_] += $fields[$vars[$_]]; use warnings; On Fri, 2002-02-08 at 13:00, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Frink! Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
Nope. Not possible. There are array refs stored in each $freqidx{$_}. It is spitting out that error messages tons of times. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:03 PM To: Balint, Jess Cc: 'Chas Owens'; '[EMAIL PROTECTED]' Subject: RE: Wierd Error On Fri, 8 Feb 2002, Balint, Jess wrote: That errors seems to be quieted. THank you. Now, there is this 114: foreach( sort( keys( %freqidx ) ) ) { 115: print( $_| ); 116: print( $_| ) foreach( @{$freqidx{$_}} ); 117: print( \n ); 118: } I get the error: Use of uninitialized value at ../20020128/pasummary.pl line 114. Use of uninitialized value at ../20020128/pasummary.pl line 114. I understand this also may be because I have warnings on, but I am also trying to understand why line 114 is flagged? I recommend not turning warnings on and off in your code -- make the code work with warnings on, that's my philosophy. :-) It seems odd that it is flagging line 114 -- do you have elements in %freqidex such that $freqidx{$_} yields undef? -- Brett http://www.chapelperilous.net/ Sometimes when you look into his eyes you get the feeling that someone else is driving. -- David Letterman -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
On Fri, 8 Feb 2002, Balint, Jess wrote: Nope. Not possible. There are array refs stored in each $freqidx{$_}. It is spitting out that error messages tons of times. Then what about the array elements in @{$freqidx{$_}} -- could uninitialized values be there? -- Brett http://www.chapelperilous.net/ Science may someday discover what faith has always known. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
Only if counts as uninitialized. I would mind making be zero in that case. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:09 PM To: Balint, Jess Cc: '[EMAIL PROTECTED]' Subject: RE: Wierd Error On Fri, 8 Feb 2002, Balint, Jess wrote: Nope. Not possible. There are array refs stored in each $freqidx{$_}. It is spitting out that error messages tons of times. Then what about the array elements in @{$freqidx{$_}} -- could uninitialized values be there? -- Brett http://www.chapelperilous.net/ Science may someday discover what faith has always known. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wierd Error
On Fri, Feb 08, 2002 at 01:00:13PM -0500, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. Why are they weird warnings? They seem normal to me; you're trying to treat as a number, which is usually wrong, so Perl is warning you about it. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Perl does just add as 0, the messages you're seeing are warnings, not errors. To get rid of them default the value: $freqidx{$key}[$_] += $fields[$vars[$_]] || 0; Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: @ARGV and getopts
On Fri, Feb 08, 2002 at 08:13:17AM -0600, Pfeiffer, Richard wrote: My command line looks similar to this: command.pl-rz:\Tech Team -p/Tools Team -fFile Found Today.txt -vRDP 1.2_A What I'm trying to check for is to make sure when people run my script, they have each option surrounded by the double quotes, as you see above. Why is it you need to check for that? Isn't it enough that the arguments have gotten to your program in one piece? See below. To check this, I was at first trying to see what $opt_r as returned by 'getopts' was set to, but it strips off my quotes automatically, so there is no way to see what was actually input vs what is interpreted. getopts doesn't do the stripping, your shell's doing that. It's using the double quotes to determine where arguments begin and end. Your command line above effectively becomes: @ARGV = ( '-rz:\Tech Team', '-p/Tools Team', '-fFile Found Today.txt', '-vRDP 1.2_A' ); [snip] That way, if my command line was bad and looked like this: (Notice missing quote between -rz right after command.pl) command.pl-rz:\Tech Team -p/Tools Team -fFile Found Today.txt -vRDP 1.2_A If this were the case, the shell would complain about unbalanced quoting. command.pl would never be executed. ARGV[0] would return: -rz:\Tech Team and I would be able to catch the missing quote error. Well if that's all you want the ability for, the shell is already handling it for you. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
Your version of Perl is to old for the no warnings trick. You must use the $^W variable. Use it like this: { #going to do some stuff I know is okay local($^W) = 0; really_dangerous_stuff(); } See perldoc perlvar for more info. On Fri, 2002-02-08 at 13:45, Balint, Jess wrote: That would have been easy, but now here is what I get: Can't locate warnings.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at ../20020128/pasummary.pl line 99. BEGIN failed--compilation aborted at ../20020128/pasummary.pl line 99. Where line 99 is the 'no warnings;' line. Perl -w works fine. Now I really don't understand!? -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:20 PM To: Balint, Jess Cc: '[EMAIL PROTECTED]' Subject: Re: Wierd Error Obviously you have been a good programmer and turend on warning (either with -w or use warnings). What you are seeing is not an error; it is a warning. Warnings are good because they help you find places where you did something wrong, but sometimes you do mean to do a dangerous thing. In those cases you can say something like this no warnings; $freqidx{$key}[$_] += $fields[$vars[$_]]; use warnings; On Fri, 2002-02-08 at 13:00, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:} @vars are all numberic values and some values of @fields are . Can $fields[$n] be defined as ? Shouldn't perl just add as 0? The errors are as follows: Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 4258. Argument isn't numeric in add at ../20020128/pasummary.pl line 96, INFILE chunk 17733. Any help would be greatly appreciated. THanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Frink! Missle Address: 33:48:3.521N 84:23:34.786W -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Wibble. Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl, Oracle, and XML (or the three blind mice).
I was wondering if someone could point me in the direction of good documentation on how perl ties in with Oracle and XML. I am developing a work order system for my company which will potentially make extensive use of these technologies (and perhaps more where applicable). Any information would be greatly appreciated. Thanks. Rolau -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wierd Error
On Fri, 8 Feb 2002, Balint, Jess wrote: Only if counts as uninitialized. I would mind making be zero in that case. Nope, counts as a value, one that returns boolean false, but still a value that will return true if you test for definedness. -- Brett http://www.chapelperilous.net/ I don't want to live on in my work, I want to live on in my apartment. -- Woody Allen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dbi modules
Hello, I have perused the archives but can't find an answer to my problem. I have built a perl program, I use DBI.pm in it. Upon running the program I get the following return: Can't locate loadable object for module DBI in @INC (@INC contains: /usr/lib/perl5/site_perl//5.6.0/i586-linux /usr/lib/perl5/site_perl//5.6.0 /usr/lib/perl5/site_perl/ /usr/lib/perl5/5.6.0/i586-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i586-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at ./updatedb.pl line 4 Compilation failed in require at ./updatedb.pl line 4. BEGIN failed--compilation aborted at ./updatedb.pl line 4. I have tried using the pragma use lib '/usr/lib/perl5/site_perl/' use DBI; and various other ideas found but it doesn't work I get different errors and very close to a running program but no joy. Apparently my program can't tell where the DBI.pm mod is even when I tell it specifically where it is. I am using the book Perl for System Administration put out by O'Reilly. ej -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbi modules
On Fri, 8 Feb 2002, Eric Jones wrote: Hello, I have perused the archives but can't find an answer to my problem. I have built a perl program, I use DBI.pm in it. Upon running the program I get the following return: Can't locate loadable object for module DBI in @INC (@INC contains: /usr/lib/perl5/site_perl//5.6.0/i586-linux /usr/lib/perl5/site_perl//5.6.0 /usr/lib/perl5/site_perl/ /usr/lib/perl5/5.6.0/i586-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i586-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at ./updatedb.pl line 4 Compilation failed in require at ./updatedb.pl line 4. BEGIN failed--compilation aborted at ./updatedb.pl line 4. I have tried using the pragma use lib '/usr/lib/perl5/site_perl/' use DBI; and various other ideas found but it doesn't work I get different errors and very close to a running program but no joy. Apparently my program can't tell where the DBI.pm mod is even when I tell it specifically where it is. I am using the book Perl for System Administration put out by O'Reilly. Are you sure DBI is installed on your system? Type 'locate DBI.pm' and see what that tells you. -- Brett http://www.chapelperilous.net/ Tali be vewwy vewwy qwuiet .. I'm huntin wuntime ewwos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: snmpwalk with net::snmp
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *i've gotten to be somewhat comfortable using net::snmp. at the very least *i've used its get_request and set_request methods. however an oid used by *cisco seems to need to be called using 'snmpwalk' rather than a get or set *request. net::snmp has a get_next_request and a get_table, but i'm *confused if these are really the methods that would suit my purposes. is a *true snmpwalk capable with net::snmp? http://cosi-nms.sourceforge.net/nwi-progs.html e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How Decompose Hash of Arrays
what are you doing?!?!? shouldn't it be: for my $hewArray (keys %hashStats) { print @$hewArray @$hashStats{$hewArray} \n; } I was blindly copying from the book (once get something to work, then go back and try to understand why). Plugged in your snippet and get: Global symbol $hashStats requires explicit package name at hewtest.pl line 30 Execution of hewtest.pl aborted due to compilation errors. -- Removed the $ from the @$ variables and In string, @hewArray now must be written as \@hewArray at hewtest.pl line 30, ne ar @hewArray Global symbol @hewArray requires explicit package name at hewtest.pl line 30. Scalar value @hashStats{$hewArray} better written as $hashStats{$hewArray} at hewtest.pl line 30. Execution of hewtest.pl aborted due to compilation errors. -- Made those changes, and now back to where I started. HewTrace004 - from 1st for block at top of PP pg 277 @hewArray ARRAY(0x4a68d4) @hewArray ARRAY(0x4a68d4) @hewArray ARRAY(0x4a68d4) @hewArray ARRAY(0x4a68d4) @hewArray ARRAY(0x4a68d4) @hewArray ARRAY(0x4a68d4) Obviously making a fundamental error somewhere. Will go back to the book and enter the examples exactly as written and work upward from there. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How Decompose Hash of Arrays
That was one of the tries I'd made but not included in my initial post. - print HewTrace004 - from 1st for block at top of PP pg 277 \n; my @hewArray; for $hewArray (keys %hashStats) { print $hewArray @{ $hashStats{$hewArray}} \n; } Global symbol $hewArray requires explicit package name at hewtest.pl line 24. Execution of hewtest.pl aborted due to compilation errors. (Line 24 is the print statement. -- Changed to: for my $hewArray (keys %hashStats) { print $hewArray: @{ $hashStats{$hewArray}} \n; } and got Can't use string (ARRAY(0x4a68d4)) as an ARRAY ref while strict refs in use at hewtest.pl line 25. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date
Mayank [[EMAIL PROTECTED]] quoth: *Hi all * *Is there a module/or some function to do calculations on date e.g. if *today is 1st March, and i want the date for previous day (i.e. 28th or *29th Feb) Date::Calc http://search.cpan.org/search?dist=Date-Calc Date::Manip http://search.cpan.org/search?dist=DateManip If you can be bothered to view the front page of CPAN you'll see several search engines listed to help you in the future or you might consider google. http://www.perlfaq.com/cgi-bin/view?view_by_category=dates%20and%20times may also prove helpful. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: dbi modules
Or if you are one of the unfortunate one of us who doesn't have locate, try perl -e 'use DBI;' Here is my output on a non-DBI system: [jbalint@davinci|rmds02]/qmds/jbalint/20020128% perl -e 'use DBI;' Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 3:48 PM To: [EMAIL PROTECTED] Cc: perl Subject: Re: dbi modules On Fri, 8 Feb 2002, Eric Jones wrote: Hello, I have perused the archives but can't find an answer to my problem. I have built a perl program, I use DBI.pm in it. Upon running the program I get the following return: Can't locate loadable object for module DBI in @INC (@INC contains: /usr/lib/perl5/site_perl//5.6.0/i586-linux /usr/lib/perl5/site_perl//5.6.0 /usr/lib/perl5/site_perl/ /usr/lib/perl5/5.6.0/i586-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i586-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at ./updatedb.pl line 4 Compilation failed in require at ./updatedb.pl line 4. BEGIN failed--compilation aborted at ./updatedb.pl line 4. I have tried using the pragma use lib '/usr/lib/perl5/site_perl/' use DBI; and various other ideas found but it doesn't work I get different errors and very close to a running program but no joy. Apparently my program can't tell where the DBI.pm mod is even when I tell it specifically where it is. I am using the book Perl for System Administration put out by O'Reilly. Are you sure DBI is installed on your system? Type 'locate DBI.pm' and see what that tells you. -- Brett http://www.chapelperilous.net/ Tali be vewwy vewwy qwuiet .. I'm huntin wuntime ewwos -- 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: dbi modules
Yes that is what I am getting. IF the object exists but is unloadable and I have run cpan to load mods what is the best move? uninstall and install cpan or is this possible? or just run CPAN again and make changes to the info? ej Brett W. McCoy wrote: On 8 Feb 2002, Chas Owens wrote: just to prove TMTOWTDI: perl -MDBI '' Actually, I believe the OP's error said that it couldn't load the object module, which may mean that he has a broken installation. Since 'use DBI' in his script is failing, perl -MDBI or perl -e 'use DBI' is just going to give him the same error. -- Brett http://www.chapelperilous.net/ Taxes are not levied for the benefit of the taxed.
Cannot SendMail
Maybe there is a perl solution to this problem.maybe not. I have a distribution list with several hundred names in it (now these names are in the format Perl Beginners not [EMAIL PROTECTED] and I cannot figure out how to tell Outlook to give me the fully qualified adresses - That alone would solve this problem), and we want to add this to a automatic process. Previously we used the code snippet below, but Outlook 2000 will not allow it (it prompts the 'user' with a ARE YOU SURE YOU WANT TO LET ANOTHER PROCESS SEND MAIL THROUGH YOUR OUTLOOK ACCOUNT, Bill Gates is an idiot, I know). We moved onto a program called postie.exe, but it obviously will not recogonize the 'short names' from Outlook. Any thoughts on this? #Using OLE object sub mail { @files = @_; if ( @mailRecipients ) { use Win32::OLE; eval {$outlook = Win32::OLE-GetActiveObject('Outlook.Application')}; unless (defined $outlook) { $outlook = Win32::OLE-new('Outlook.Application', sub {$_[0]-Quit;}) } } if (defined $outlook) { $message = $outlook-CreateItem(0); $message-{BCC} = join(;, @mailRecipients); $attachments = $message-{Attachments}; foreach $att (@files) { $attachments-Add($att); } if (! $subjects ) { $message-{Subject}= join(;, @files); } else { $message-{Subject}= $subjects; } $message-Send; undef $message; undef $att; @files = (); } } #Current version using postie.exe not very perlish anymore @mailRecipients = (Frank McCollum); $sendmail = mail; sub newmail { @files = @_; $mailToolPath = R:/usr/rer/prod/current/Frameworks/NBFoundation.framework/Resources/postie. exe; $mailServer = maracas.ncmi.com; $mailRecipientsStr = join(,, @mailRecipients); $mailSubject = \ .$subjects; $mailSender = frank.mccollum\@bankofamerica.com; $mailStr = ${mailToolPath} -nomsg -host:\${mailServer}\ -to:\${mailRecipientsStr}\ -from:\${mailSender}\ -s:\${mailSubject}\; foreach ( @files ) { $mailStr = $mailStr . -a:\$_\ ; } system($mailStr); print \n$mailStr\n; } Thanks, Frank McCollum Bank Of America Securities, LLC [EMAIL PROTECTED] (704) 388-8894 _ IMPORTANT NOTICES: This message is intended only for the addressee. Please notify the sender by e-mail if you are not the intended recipient. If you are not the intended recipient, you may not copy, disclose, or distribute this message or its contents to any other person and any such actions may be unlawful. Banc of America Securities LLC(BAS) does not accept time sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail. BAS reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the BAS e-mail system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbi modules
On Fri, 8 Feb 2002, Eric Jones wrote: Yes that is what I am getting. IF the object exists but is unloadable and I have run cpan to load mods what is the best move? uninstall and install cpan or is this possible? or just run CPAN again and make changes to the info? I'd try reinstalling first of all. If you can't upgrade directly via the CPAN shell, download the tarball from the CPAN website and install that manually. -- Brett http://www.chapelperilous.net/ QOTD: Talent does what it can, genius what it must. I do what I get paid to do. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dbi modules
Ok that solved the DBI error but a bunch of others cropped up so I have some work to do on my perl install. Running perl -MCPAN -e shell didn't finish everything as I though it would. ej Brett W. McCoy wrote: On Fri, 8 Feb 2002, Eric Jones wrote: Yes that is what I am getting. IF the object exists but is unloadable and I have run cpan to load mods what is the best move? uninstall and install cpan or is this possible? or just run CPAN again and make changes to the info? I'd try reinstalling first of all. If you can't upgrade directly via the CPAN shell, download the tarball from the CPAN website and install that manually. -- Brett http://www.chapelperilous.net/ QOTD: Talent does what it can, genius what it must. I do what I get paid to do.