CPAN module install error... can you guys help?
cpaninstall Net::SSLeay and everyhing went OK until this stuff happened... i had tried a manual install of the module first and received thie error, then i tried using cpan for the first time -- which is cool! -- but got the error again... any advice would be appreciated! --jimmyjames make[1]: Entering directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' mkdir ../blib/lib/Net/SSLeay mkdir ../blib/arch/auto/Net/SSLeay/Handle mkdir ../blib/lib/auto/Net/SSLeay/Handle cp Handle.pm ../blib/lib/Net/SSLeay/Handle.pm Manifying ../blib/man3/Net::SSLeay::Handle.3pm make[1]: Leaving directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' /usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap SSLeay.xs SSLeay.xsc mv SSLeay.xsc SSLeay.c gcc -c -I/usr/include -I/usr/inc32 -fno-strict-aliasing -I/usr/local/include -O -DVERSION=\1.21\ -DXS_VERSION=\1.21\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE -DPERL5 SSLeay.c SSLeay.xs:83:25: openssl/err.h: No such file or directory SSLeay.xs:84:27: openssl/lhash.h: No such file or directory SSLeay.xs:85:26: openssl/rand.h: No such file or directory SSLeay.xs:86:28: openssl/buffer.h: No such file or directory SSLeay.xs:87:25: openssl/ssl.h: No such file or directory SSLeay.xs:88:74: openssl/comp.h: No such file or directory SSLeay.xs:89:93: openssl/md5.h: No such file or directory make: *** [SSLeay.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN module install error... can you guys help?
Do you have openssl installed? It's a prerequisuite. Hence the openssl/... no such file or directory errors hope that helps, sorry it's so vaguejust try to install openssl... -Chris On Sunday 15 December 2002 11:49 pm, james lundeen wrote: cpaninstall Net::SSLeay and everyhing went OK until this stuff happened... i had tried a manual install of the module first and received thie error, then i tried using cpan for the first time -- which is cool! -- but got the error again... any advice would be appreciated! --jimmyjames make[1]: Entering directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' mkdir ../blib/lib/Net/SSLeay mkdir ../blib/arch/auto/Net/SSLeay/Handle mkdir ../blib/lib/auto/Net/SSLeay/Handle cp Handle.pm ../blib/lib/Net/SSLeay/Handle.pm Manifying ../blib/man3/Net::SSLeay::Handle.3pm make[1]: Leaving directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' /usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap SSLeay.xs SSLeay.xsc mv SSLeay.xsc SSLeay.c gcc -c -I/usr/include -I/usr/inc32 -fno-strict-aliasing -I/usr/local/include -O -DVERSION=\1.21\ -DXS_VERSION=\1.21\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE -DPERL5 SSLeay.c SSLeay.xs:83:25: openssl/err.h: No such file or directory SSLeay.xs:84:27: openssl/lhash.h: No such file or directory SSLeay.xs:85:26: openssl/rand.h: No such file or directory SSLeay.xs:86:28: openssl/buffer.h: No such file or directory SSLeay.xs:87:25: openssl/ssl.h: No such file or directory SSLeay.xs:88:74: openssl/comp.h: No such file or directory SSLeay.xs:89:93: openssl/md5.h: No such file or directory make: *** [SSLeay.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form TextArea loading
Hi all, Can sombody tell me how to load the contents of a text file into a textarea of a form in cgi? thanks... oh and also need to to remove blank spaces from a string non realated though Ambrose
Setting up CGI with IIS
Hi, I am trying to get an example working to get me started but all I get is a message: CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process. I am working with IIS on NT. I have installed perl and configured IIS to associate .pl and .cgi with the perl executable. I have also given permissions to the user IIS is running as to the cgi file. The file is: #!h:\perl\bin\perl.exe use CGI ':standard'; print header(); print start_html(); for $i (param()) { print b, $i, /b: , param($i), br\n; } print end_html(); Please help. Thx, Emma. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Search and replace a block of imported text
Hi all, I should be able to do this, but I'm having no success and it's driving me up the wall. I've got a text file made up of ascii and HTML code that I'm dumping into an array in a Perl script. I want to be able to take a specified chunk of this text from the middle of the file between HTML and /HTML (over a number of lines) and simply obliterate it, before reading the array line by line using $_. Can anyone here offer any suggestions as to the best way to do a search and replace over multiple lines of a file? Many thanks, Neil. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Form TextArea loading
Well...I'd do something like this: open(IN,myFile.txt); #by undefining the input separator (below), #we can read the whole file as one scalar undef $/; my $fileContents= IN; close(IN); printeof; HTML BODY FORM Here's my file: textarea name=myTextArea$fileContents/textarea /FORM eof voila! As for your second question, if you wanna strip spaces at the ends you could do this $myString =~ s/^\s+(.+?)\s+$/$1/g; This says, if you see multiple spaces at the beggining or end of a string with any other characters in the middle, replace the whole thing with the non-space stuff in the middle If you just want to remove spaces, do something like this: $myString =~ s/\s+//g; There are many other ways of doing this, too... if you need more help, tell us specifically what you're trying to do... -Peter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 7:50 AM To: [EMAIL PROTECTED] Subject: Form TextArea loading Hi all, Can sombody tell me how to load the contents of a text file into a textarea of a form in cgi? thanks... oh and also need to to remove blank spaces from a string non realated though Ambrose -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested hash
Actually, because you are using hash references, you need to use something like '%{$repeats{$k1}}' rather than '%repeats{$k1}': foreach $k1 (keys %repeats){ foreach $k2 (keys %{$repeats{$k1}}) { foreach $k3( keys %{$repeats{$k1}{$k2}}){ if ($repeats{$k1}{$k2}{$k3} == 1){ print I got it\n; } } } } ---Larry Hi!! I have a CGI that updated a mysql database, I have a nested hash structure in it. something like $repeats{$solID[i]}{$expId[i]}{$elemenet[$i]}=1 If I am to check this hash is the inner loop written as foreach $k1 (keys %repeats){ foreach $k2 (keys %repeats{$k1}) { foreach $k3( keys %repeats{$k1}{$k2}){ if ($repeats{$k1}{$k2}{$k3} ==1){ print I got it\n; } } } } Is this correct ?? Thanks and Cheers always!! Murli ++ | Larry Coffin, G.P.H. Watertown, MA | | http://www.PointInfinity.com/lcoffin/[EMAIL PROTECTED] | ++ Of course there's no reason for it, it's just our policy. - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form TextArea loading
Get the content of the file and store it into a variable, then put into the textarea like this: open (FILE, $file); @content = FILE; close FILE; print eof; form textarea cols=60 rows=10 name=file@content/textarea ... /form eof Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 16, 2002 5:49 PM Subject: Form TextArea loading Hi all, Can sombody tell me how to load the contents of a text file into a textarea of a form in cgi? thanks... oh and also need to to remove blank spaces from a string non realated though Ambrose -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN module install error... can you guys help?
yes, openssl is installed at /usr/bin/openssl ... anything else i should look at? --- Dr. Poo [EMAIL PROTECTED] wrote: Do you have openssl installed? It's a prerequisuite. Hence the openssl/... no such file or directory errors hope that helps, sorry it's so vaguejust try to install openssl... -Chris On Sunday 15 December 2002 11:49 pm, james lundeen wrote: cpaninstall Net::SSLeay and everyhing went OK until this stuff happened... i had tried a manual install of the module first and received thie error, then i tried using cpan for the first time -- which is cool! -- but got the error again... any advice would be appreciated! --jimmyjames make[1]: Entering directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' mkdir ../blib/lib/Net/SSLeay mkdir ../blib/arch/auto/Net/SSLeay/Handle mkdir ../blib/lib/auto/Net/SSLeay/Handle cp Handle.pm ../blib/lib/Net/SSLeay/Handle.pm Manifying ../blib/man3/Net::SSLeay::Handle.3pm make[1]: Leaving directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' /usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap SSLeay.xs SSLeay.xsc mv SSLeay.xsc SSLeay.c gcc -c -I/usr/include -I/usr/inc32 -fno-strict-aliasing -I/usr/local/include -O -DVERSION=\1.21\ -DXS_VERSION=\1.21\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE -DPERL5 SSLeay.c SSLeay.xs:83:25: openssl/err.h: No such file or directory SSLeay.xs:84:27: openssl/lhash.h: No such file or directory SSLeay.xs:85:26: openssl/rand.h: No such file or directory SSLeay.xs:86:28: openssl/buffer.h: No such file or directory SSLeay.xs:87:25: openssl/ssl.h: No such file or directory SSLeay.xs:88:74: openssl/comp.h: No such file or directory SSLeay.xs:89:93: openssl/md5.h: No such file or directory make: *** [SSLeay.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
any idea to solve this problem?
I wrote a very simple cgi to change an IP address of a linux server. First, user will get LOGIN.PL LOGIN.PL will call EDIT_IP.PL if user click 'Save', EDIT_IP.PL will call SAVE_CONFIG.PL SAVE_CONFIG.PL will do these : - modifying ip address configuration (/etc/sysconfig/...) - calling external program (written in C) to restart network card (ifup/ifdown) - Displaying message configuration saved - REDIRECTING back to LOGIN.PL The situation is, all steps are working fine ... except the last 2 steps (displaying message and redirecting). Sometimes it works, sometimes NOT ... I dont know why. Here is the last code of SAVE_CONFIG.PL : if ($a ne $b) { Write_ifcfg (eth0, $NewIPAddress); $ip_addr = $NewIPAddress; } Ok Configuration saved.; system(/var/www/cgi-bin/changeip); Can I flush cgi operation? Because after calling changeip, the IP address of the web server will be changed ... and the user browser SOMETIMES did not get the output of Ok function. Here is the Ok function : sub Ok { my ($msg) = @_; print $cgi-start_html(-head=meta({-http_equiv = 'Refresh', -content = '10; url=http://'.$ip_addr.'/'})); print BRBRBRBRBRBRBRBRBRBR; print TABLE border='0' width=500 align=center bgcolor=#C7D7F3; print TRTH align=center bgcolor=#1E4691font color=#FF nbsp /font; print TRTHnbsp; print TRTH align=center$msg; print TRTHnbsp; print $cgi-end_html; } In the user browser, it will 'stuck' (in progress) ... but if you view source, it will contain the content of that Ok web page. Then we need to press browser STOP button, the message will be displayed, and the rest is normal ... the redirection (Refresh) is executed. I was wondering if I can 'flush' the cgi operation, so in SAVE_CONFIG.PL will be like this : if ($a ne $b) { Write_ifcfg (eth0, $NewIPAddress); $ip_addr = $NewIPAddress; } Ok Configuration saved.; flush_cgi_operation; # so, cgi output is written in the user browser system(/var/www/cgi-bin/changeip); I hope you understand what I meant :) I am not very good in english. Regards, me. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: any idea to solve this problem?
I was wondering if I can 'flush' the cgi operation, so in SAVE_CONFIG.PL will be like this : Ok Configuration saved.; flush_cgi_operation; # so, cgi output is written in the user browser How about just closing STDOUT -- 'close(STDOUT);'? That should close the filehandle and flush the output. Whether that results in the output getting pushed on through to the web client and the connection being closed or not may depend on the server software you are using. ---Larry ++ | Larry Coffin, G.P.H. Watertown, MA | | http://www.PointInfinity.com/lcoffin/[EMAIL PROTECTED] | ++ As the poet said, Only God can make a tree -- probably because it's so hard to figure out how to get the bark on. -- Woody Allen - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies - might be off topic
Assuming you have control of the domains in question, you could have a hidden frame (frameheight=0 or something similar) that loads a script on one of the other domains that then sets it's cookie, and then redirects to the next domain, etc., but even this can be blocked in Mozilla (thank god). http://danconia.org Peter Kappus wrote: AFAIK, browsers will only send cookies back to the domain that set them. So this may not be possible without some sneakerylike somehow spoofing the hostname, etc. It may also be possible if all the domains resolve to the same IP...but even then I'm not sure how you could do it... good luck. -peter -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 15, 2002 1:00 AM To: [EMAIL PROTECTED] Subject: Cookies - might be off topic Hi all, I want to create a script that sets a cookie that will be returned by the visitor's browser when they will visit more domains like: www.mamajob.net www.mamashop.net www.mamabay.net .. etc. Is it possible? If yes, how can I set more domains for a cookie? Thank you. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN module install error... can you guys help?
You need the openssl development stuff, not just the binary package, aka it is looking for the headers, which are included in the source package, or usually in a development package depending on your system. Which distro are you running? http://danconia.org james lundeen wrote: yes, openssl is installed at /usr/bin/openssl ... anything else i should look at? --- Dr. Poo [EMAIL PROTECTED] wrote: Do you have openssl installed? It's a prerequisuite. Hence the openssl/... no such file or directory errors hope that helps, sorry it's so vaguejust try to install openssl... -Chris On Sunday 15 December 2002 11:49 pm, james lundeen wrote: cpaninstall Net::SSLeay and everyhing went OK until this stuff happened... i had tried a manual install of the module first and received thie error, then i tried using cpan for the first time -- which is cool! -- but got the error again... any advice would be appreciated! --jimmyjames make[1]: Entering directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' mkdir ../blib/lib/Net/SSLeay mkdir ../blib/arch/auto/Net/SSLeay/Handle mkdir ../blib/lib/auto/Net/SSLeay/Handle cp Handle.pm ../blib/lib/Net/SSLeay/Handle.pm Manifying ../blib/man3/Net::SSLeay::Handle.3pm make[1]: Leaving directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' /usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap SSLeay.xs SSLeay.xsc mv SSLeay.xsc SSLeay.c gcc -c -I/usr/include -I/usr/inc32 -fno-strict-aliasing -I/usr/local/include -O -DVERSION=\1.21\ -DXS_VERSION=\1.21\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE -DPERL5 SSLeay.c SSLeay.xs:83:25: openssl/err.h: No such file or directory SSLeay.xs:84:27: openssl/lhash.h: No such file or directory SSLeay.xs:85:26: openssl/rand.h: No such file or directory SSLeay.xs:86:28: openssl/buffer.h: No such file or directory SSLeay.xs:87:25: openssl/ssl.h: No such file or directory SSLeay.xs:88:74: openssl/comp.h: No such file or directory SSLeay.xs:89:93: openssl/md5.h: No such file or directory make: *** [SSLeay.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN module install error... can you guys help?
The script should work, but when building the module I believe you will need access to the header files, etc. and possibly even when running it, as the make process is trying to compile SSLeay.c file to use as part of the SSLeay.xs module component. So your script will work, but you won't be able to build the module without the devel package. Which if my understanding is correct you have two options: 1) Download the source for openssl and set the corresponding shell variables (not sure what all you need, LD_LIBRARY_PATH, etc.) so that the make process can find your version of openssl (in your home directory, for instance) or... 2) Build the module on a separate machine, preferably running the same compiler versions, openssl versions, etc. and then upload the module to the server and do a *ton* of testing to see if it still works in all its glory. http://danconia.org (p.s. make sure to group reply so the list can help too) james lundeen wrote: I'm on an OLM server. I think it's RH 7.2 - I updated Perl and the other bacomponentsmponants last night after I put this message out. So I'm running 5.8.0 Perl now... I'm trying to get this to work so that I can communicate with Authorize.Net. The script I use works just fine on my RH 7.3 server. I did an item-by-item comparison w/r/t the versions of OpenSSL, etc between the two servers and everything is the same. That's why I'm s lost here. I'm really running against a deadline too, so I'm starting to panic. Anyone with suggestions, I'd really appreciate them... JimmyJamesp.s. the person who wrote the script said that as long as OpenSSL was installed with SSLeay, the script would work fine. And I am worked with the script enough on other servers that I believe this statement to be true. --- Wiggins d'Anconia [EMAIL PROTECTED] wrote: You need the openssl development stuff, not just the binary package, aka it is looking for the headers, which are included in the source package, or usually in a development package depending on your system. Which distro are you running? http://danconia.org james lundeen wrote: yes, openssl is installed at /usr/bin/openssl ... anything else i should look at? --- Dr. Poo [EMAIL PROTECTED] wrote: Do you have openssl installed? It's a prerequisuite. Hence the openssl/... no such file or directory errors hope that helps, sorry it's so vaguejust try to install openssl... -Chris On Sunday 15 December 2002 11:49 pm, james lundeen wrote: cpaninstall Net::SSLeay and everyhing went OK until this stuff happened... i had tried a manual install of the module first and received thie error, then i tried using cpan for the first time -- which is cool! -- but got the error again... any advice would be appreciated! --jimmyjames make[1]: Entering directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' mkdir ../blib/lib/Net/SSLeay mkdir ../blib/arch/auto/Net/SSLeay/Handle mkdir ../blib/lib/auto/Net/SSLeay/Handle cp Handle.pm ../blib/lib/Net/SSLeay/Handle.pm Manifying ../blib/man3/Net::SSLeay::Handle.3pm make[1]: Leaving directory `/root/.cpan/build/Net_SSLeay.pm-1.21/Net-SSLeay-Handle-0.50' /usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 /usr/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.6.0/ExtUtils/typemap -typemap typemap SSLeay.xs SSLeay.xsc mv SSLeay.xsc SSLeay.c gcc -c -I/usr/include -I/usr/inc32 -fno-strict-aliasing -I/usr/local/include -O -DVERSION=\1.21\ -DXS_VERSION=\1.21\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE -DPERL5 SSLeay.c SSLeay.xs:83:25: openssl/err.h: No such file or directory SSLeay.xs:84:27: openssl/lhash.h: No such file or directory SSLeay.xs:85:26: openssl/rand.h: No such file or directory SSLeay.xs:86:28: openssl/buffer.h: No such file or directory SSLeay.xs:87:25: openssl/ssl.h: No such file or directory SSLeay.xs:88:74: openssl/comp.h: No such file or directory SSLeay.xs:89:93: openssl/md5.h: No such file or directory make: *** [SSLeay.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: again a regex help needed
Marco Centemeri wrote: Hello All, Hello, I'd like to know if a file name is like namefile.ext (only one dot in the name) or namefile.xxx.z.ext (more than one dot in the name). I tried with regex: $file1='doctobepublish.new.pdf'; if ( $file1 =~ /\.{2,}/ ) { print KO filename not properly formatted; } else { print OK filename is good; } This doesn't work and the match is true only if the two dots are consecutive. doctobepublish.new.pdf =~ /\.{2,}/ doesn't match doctobepublish..new.pdf =~ /\.{2,}/ match My idea, probably wrong, is that regex process scan all the string and try to match all the possible so doctobepublish.new.pdf =~ /\.{2,}/should match anotherdoctobepublish.pdf =~ /\.{2,}/ should not match May anybody help me to solve the problem and to understand better how regex works? I've already read perlquik and perlre but some points are still foggy! Instead of a regular expression you can use the transliteration operator to count characters. $ perl -le' my @files = qw/one two.txt three.four.txt/; for my $file ( @files ) { if ( $file =~ tr/.// == 1 ) { print Valid: $file } else{ print NOT Valid: $file } } ' NOT Valid: one Valid: two.txt NOT Valid: three.four.txt John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using pipe
hi everyone, i am a novice to the perl and i want to write a perl program to redirect another program's STDIN STDOUT to pipes, it's possible or there are source examples exist? thanks, maxchen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
picking numbers out of a file and operating on them
How does one tell perl to perform mathematical operations? I have a file with a series of items like this: BLAH1 Length = 500 Identities = 20/100. BLAH2 Length = 400 Identities = 30/70 For each item called BLAH, I want to pick the denominator in Identites and divide by Length and calculate percentage. Eg. for BLAH1: 100/500 * 100 = 20% and later , print all BLAHs for which the value is 50%. I csn write reg exps to find the numbers i am interested in, but am not sure how to go further.. thanks, -nandita -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Uploading files
Hi I know it is not entirely perl, but can anybody esplain me how does i do upload a file using a browser (can i use perl to do this)? Thanks
Installed Modules don't run Properly
Hello All! I have searched Google, but it turned up nothing useful on this, so I figured that this would be a good place to ask next. I just installed the DBD::mysql through the Debian package manager, but it doesn't seem to bode well with the compiled version of Perl I installed on the machine . . . ;o| Here is the error that gets returned when trying to run the module : perl: relocation error: /usr/lib/perl5/auto/DBD/mysql/mysql.so: undefined symbol: perl_get_sv Any thoughts? thanks in advance! scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mail::POP3Client errors, not working
Ok, this is very frustrating, 2 days and many hours worth! I have used this module/lib (libwww) before with ease. The only thing i can think of is i could be my linux distro? (Debian Woody 3.0), or the pop-servers encrytion methods?. The following is the exact script i am trying to run, (except with my personal info removed) and below is the Debugging info i'm getting. All my supplied data is correct, (i.e. username and password, i use the exact same info for ~/.fetchmailrc and it works fine. I am including a Microsoft pop-server and a 'unknown' although probably some form of *NIX server. I was also reciveing some MD5.pm error's although they seem be gone. I would appreciate any info, guidance or help anyone could provide. thank you. -mUs. script #!/usr/bin/perl -w use Mail::POP3Client; use strict; use warnings; my($pop,$usr,$passwd,$host,$i); $usr = '[EMAIL PROTECTED]'; $passwd = 'clear_text'; $host = 'pop.me.com'; $pop = new Mail::POP3Client( USER = $usr, PASSWORD = $passwd, DEBUG = 1, HOST = $host); for ($i = 1; $i = $pop-Count(); $i++) { foreach ( $pop-Head( $i ) ) { (/^(From|Subject):\s+/i) print $_, \n; } print \n; } $pop-Close(); /script - debug output POP3 - +OK at ./J_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./J_mail_client line 15 POP3 - +OK at ./J_mail_client line 15 POP3 - PASS clear_text at ./J_mail_client line 15 POP3 - -ERR at ./J_mail_client line 15 POP3 - QUIT at ./J_mail_client line 26 Use of uninitialized value in join or string at /usr/share/perl/5.6.1/Carp/Heavy.pm line 145, GEN0 line 3. POP3 - at ./J_mail_client line 26 Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 828, GEN0 line 3. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 313. /debug output debug output on msserver POP3 - +OK Microsoft POP3 Server Version: 5.5.1877.747.74 ready 23423423.34454545me.me.com at ./N_mail_client line 15 POP3 - APOP [EMAIL PROTECTED] erierj24353245ksdfj4534k4j5k45j at ./N_mail_client line 15 POP3 - -ERR APOP not supported. at ./N_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./N_mail_client line 15 POP3 - +OK Waiting for password at ./N_mail_client line 15 POP3 - PASS clear_text at ./N_mail_client line 15 POP3 - -ERR Permission denied at ./N_mail_client line 15 POP3 - QUIT at ./N_mail_client line 27 POP3 - +OK at ./N_mail_client line 27 /debug msserver -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mail::POP3Client faliure,...?
Ok, this is very frustrating, 2 days and many hours worth! I have used this module/lib (libwww) before with ease. The only thing i can think of is i could be my linux distro? (Debian Woody 3.0), or the pop-servers encrytion methods?. The following is the exact script i am trying to run, (except with my personal info removed) and below is the Debugging info i'm getting. All my supplied data is correct, (i.e. username and password, i use the exact same info for ~/.fetchmailrc and it works fine. I am including a Microsoft pop-server and a 'unknown' although probably some form of *NIX server. I was also reciveing some MD5.pm error's although they seem be gone. I would appreciate any info, guidance or help anyone could provide. thank you. -mUs. script #!/usr/bin/perl -w use Mail::POP3Client; use strict; use warnings; my($pop,$usr,$passwd,$host,$i); $usr = '[EMAIL PROTECTED]'; $passwd = 'clear_text'; $host = 'pop.me.com'; $pop = new Mail::POP3Client( USER = $usr, PASSWORD = $passwd, DEBUG = 1, HOST = $host); for ($i = 1; $i = $pop-Count(); $i++) { foreach ( $pop-Head( $i ) ) { (/^(From|Subject):\s+/i) print $_, \n; } print \n; } $pop-Close(); /script - debug output POP3 - +OK at ./J_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./J_mail_client line 15 POP3 - +OK at ./J_mail_client line 15 POP3 - PASS clear_text at ./J_mail_client line 15 POP3 - -ERR at ./J_mail_client line 15 POP3 - QUIT at ./J_mail_client line 26 Use of uninitialized value in join or string at /usr/share/perl/5.6.1/Carp/Heavy.pm line 145, GEN0 line 3. POP3 - at ./J_mail_client line 26 Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 828, GEN0 line 3. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 313. /debug output debug output on msserver POP3 - +OK Microsoft POP3 Server Version: 5.5.1877.747.74 ready 23423423.34454545me.me.com at ./N_mail_client line 15 POP3 - APOP [EMAIL PROTECTED] erierj24353245ksdfj4534k4j5k45j at ./N_mail_client line 15 POP3 - -ERR APOP not supported. at ./N_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./N_mail_client line 15 POP3 - +OK Waiting for password at ./N_mail_client line 15 POP3 - PASS clear_text at ./N_mail_client line 15 POP3 - -ERR Permission denied at ./N_mail_client line 15 POP3 - QUIT at ./N_mail_client line 27 POP3 - +OK at ./N_mail_client line 27 /debug msserver -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
glob subtlety question
Is there a better way to say: my @input_files = glob (join , @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there because otherwise... if there are no file arguments, @input_files ends up having an element [0] And the foreach loop tries to run anyway. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: glob subtlety question
OOPS. I meant unless $#ARGV == -1 David Eason [EMAIL PROTECTED] wrote in message news:... Is there a better way to say: my @input_files = glob (join , @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there because otherwise... if there are no file arguments, @input_files ends up having an element [0] And the foreach loop tries to run anyway. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mail::POP3Client failures,...
Ok, this is very frustrating, 2 days and many hours worth! I have used this module/lib (libwww) before with ease. The only thing i can think of is i could be my linux distro? (Debian Woody 3.0), or the pop-servers encrytion methods?. The following is the exact script i am trying to run, (except with my personal info removed) and below is the Debugging info i'm getting. All my supplied data is correct, (i.e. username and password, i use the exact same info for ~/.fetchmailrc and it works fine. I am including a Microsoft pop-server and a 'unknown' although probably some form of *NIX server. I was also reciveing some MD5.pm error's although they seem be gone. I would appreciate any info, guidance or help anyone could provide. thank you. -mUs. script #!/usr/bin/perl -w use Mail::POP3Client; use strict; use warnings; my($pop,$usr,$passwd,$host,$i); $usr = '[EMAIL PROTECTED]'; $passwd = 'clear_text'; $host = 'pop.me.com'; $pop = new Mail::POP3Client( USER = $usr, PASSWORD = $passwd, DEBUG = 1, HOST = $host); for ($i = 1; $i = $pop-Count(); $i++) { foreach ( $pop-Head( $i ) ) { (/^(From|Subject):\s+/i) print $_, \n; } print \n; } $pop-Close(); /script - debug output POP3 - +OK at ./J_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./J_mail_client line 15 POP3 - +OK at ./J_mail_client line 15 POP3 - PASS clear_text at ./J_mail_client line 15 POP3 - -ERR at ./J_mail_client line 15 POP3 - QUIT at ./J_mail_client line 26 Use of uninitialized value in join or string at /usr/share/perl/5.6.1/Carp/Heavy.pm line 145, GEN0 line 3. POP3 - at ./J_mail_client line 26 Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 828, GEN0 line 3. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 313. /debug output debug output on msserver POP3 - +OK Microsoft POP3 Server Version: 5.5.1877.747.74 ready 23423423.34454545me.me.com at ./N_mail_client line 15 POP3 - APOP [EMAIL PROTECTED] erierj24353245ksdfj4534k4j5k45j at ./N_mail_client line 15 POP3 - -ERR APOP not supported. at ./N_mail_client line 15 POP3 - USER [EMAIL PROTECTED] at ./N_mail_client line 15 POP3 - +OK Waiting for password at ./N_mail_client line 15 POP3 - PASS clear_text at ./N_mail_client line 15 POP3 - -ERR Permission denied at ./N_mail_client line 15 POP3 - QUIT at ./N_mail_client line 27 POP3 - +OK at ./N_mail_client line 27 /debug msserver -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Net::SFTP causes script to exit if connection can't be made
Zentara is right about what you need to do, but a fuller explanation of the solution would have been: Net::SFTP is throwing an exception when it cannot make the connection. If the exception is not caught, it will cause your program to exit. The way you catch exceptions in Perl is to wrap the code that throws them in an eval block. After the eval block, the exception will be stuffed into the $@ variable, so you can examine that variable to see if there is some kind of useful information there about what the exact problem was. --Dks On Sat, Dec 14, 2002 at 09:50:33AM -0500, zentara wrote: On Fri, 13 Dec 2002 11:10:54 -0500, [EMAIL PROTECTED] (Ian Zapczynski) wrote: Unfortunately, using the || as below doesn't change the behavior. Once my script tries to make the connection and can't, it exists with a connection failed to $host, etc. etc. message, whether I use warnings or diagnostics or neither. If anyone can help me understand why this may be or if they experience the same, this would be terribly helpful. As I mentioned, I need to be able to trap this error and continue processing if a connection fails. Wrap it in an eval statement. ##3 #!/usr/bin/perl -w use strict; use Net::SFTP; my $sftp = undef; eval{ $sftp = Net::SFTP-new(localhost, user=zzztester, password=zzztest, ); }; if ($@) { print Sftp connection failed:\n $@\n; } if (! $sftp) { print I can't connect!\n; }else{ print SUCCESS!\n; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why does this code fail? - Sorry here are the line numbers..
On Sat, Dec 14, 2002 at 12:51:50PM -0500, [EMAIL PROTECTED] wrote: Can somebody tell what is wrong with this. I tried single quote (') in place of double quote() neither of them work. 184 for ($i = 0; $i @clm_types; $i++) 185 { 186@temp_str = grep (/$_/,@env_desc); 187@fields = split (/,/,$temp_str[@temp_str - 1],4); 188$env_final[$i] = join (/,/,$fields[1],$fields[2],@temp_str - 1); 189 } /,/ should probably be written as , at loadstats1.pl line 188. Unlike split, join() takes a string as its first argument, not a regex. What you want is this: $env_final[$i] = join (,,$fields[1],$fields[2],@temp_str - 1); | Notice--no '/'s here However, I'm not really sure that that's what you want either. As written, this line will join three elements into a string and assign it to $env_findal[$i]. The three elements it will join are: $fields[1] $fields[2] @temp_str - 1 The problem is that last one...I suspect that you want it to be the last element of @temp_str, but what it is actually going to be is the number that you get by subtracting 1 from the number of elements in @temp_str. Try this instead: $env_final[$i] = join(,,$fields[1],$fields[2],$temp_str[-1]); --Dks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: String to Array
Not sure if you want to keep the commas in your array, i.e. $array[$0] = 1, But, if you don't, you can do this; $string = 1, 2, 3, 4, 5; @array = split /,/ , $string; print @array\n; If you want to keep the commas, simply replace /,/ with /\s/ Regards, Danny -Original Message- From: Kurt Asdal [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 15, 2002 6:11 PM To: [EMAIL PROTECTED] Subject: String to Array Hello all, If I have a string, such as: $string=1, 6, 8, 10, 15; How could I convert it to an array, such as: @array(1, 6, 8, 10, 15); Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
picking numbers out of a file and operating on them (fwd)
How does one tell perl to perform mathematical operations? I have a file with a series of items like this: BLAH1 Length = 500 Identities = 20/100. BLAH2 Length = 400 Identities = 30/70 For each item called BLAH, I want to pick the denominator in Identites and divide by Length and calculate percentage. Eg. for BLAH1: 100/500 * 100 = 20% and later , print all BLAHs for which the value is 50%. I csn write reg exps to find the numbers i am interested in, but am not sure how to go further.. thanks, -nandita -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Extracting keys and variables, HowTo?
Hi, I have a line in a script my ($class, %args) = @_; and I would like to know how to extract the values of @_ and also how to explicatly state them so that they don't have to be parsed to the script. Thanks. David. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Extracting keys and variables, HowTo?
Hi, I would like to know how to extract the keys and variables from this line of code that are being parsed by @_ my ($class, %args) = @_; Also how would I set then so that they wouldn't have to be parsed to the script. Thanks. David. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
parsing an excel formula
hi guys, i have found that Excel::Parser and other parsing excel modules very usefull in parseing all excel data except the formula data, so how can i extract the formula from a cell ?? thx v.much -- Hytham Shehab
array iteration references
Hi all, I want to iteract through a array with a step = 2. Meaning, that, with a array of (1,2,3,4,5,6,7,8,9,0) I want to have 5 interactions with 2elements available in each one. (1,2), (3,4), etc. Not knowing if there is something OOTB within perl, I just: sub optionsInitialize{ my ($ref)=@_; Logit(ref is $ref, size is $#{$ref}); return [$ref,0, $#{$ref}+1]+1; } sub optionsNextItem{ my ($ref)=@_; my @ref_arr=@{$ref}; my $count=$ref_arr[1]; my $max=$ref_arr[2]; my @arr=@{$ref_arr[0]}; $count+=2; return undef if ($count$max); $ref_arr[1]=$count; return ($arr[$count],$arr[$count+1]); } sub optionsIsEnd{ my ($ref)=@_; my @ref_arr=@{$ref}; my $count=$ref_arr[1]; my $max=$ref_arr[2]; return ($count = $max); } And I would do something like: my $parameters=[par1, [sjsj,djdj], par2, [fjkdj,dkdj]; my $options=optionsInitialize($parameters); while(!optionsIsEnd($options)){ ($key, $default)=optionsNextItem($options); .. } Now, the two questions: 1 - Is there a better (working) way to do this ? 2 - Thinking of other languages, I thought (my first error I know :P ) that passing a reference to a array would allow me to change the array inside a sub. But $count is always 0 inside optionsNextItem(); Thanks in advance, Duarte Cordeiro -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: array iteration references
I'll answer my own question: Inside optionsNextItem I'm making a copy of @{$ref}, so setting any value in that copy won't change the array (stupid me). -Original Message- From: Duarte Cordeiro Sent: Monday, December 16, 2002 9:53 AM To: '[EMAIL PROTECTED]' Subject: array iteration references Hi all, I want to iteract through a array with a step = 2. Meaning, that, with a array of (1,2,3,4,5,6,7,8,9,0) I want to have 5 interactions with 2elements available in each one. (1,2), (3,4), etc. Not knowing if there is something OOTB within perl, I just: sub optionsInitialize{ my ($ref)=@_; Logit(ref is $ref, size is $#{$ref}); return [$ref,0, $#{$ref}+1]+1; } sub optionsNextItem{ my ($ref)=@_; my @ref_arr=@{$ref}; my $count=$ref_arr[1]; my $max=$ref_arr[2]; my @arr=@{$ref_arr[0]}; $count+=2; return undef if ($count$max); $ref_arr[1]=$count; return ($arr[$count],$arr[$count+1]); } sub optionsIsEnd{ my ($ref)=@_; my @ref_arr=@{$ref}; my $count=$ref_arr[1]; my $max=$ref_arr[2]; return ($count = $max); } And I would do something like: my $parameters=[par1, [sjsj,djdj], par2, [fjkdj,dkdj]; my $options=optionsInitialize($parameters); while(!optionsIsEnd($options)){ ($key, $default)=optionsNextItem($options); .. } Now, the two questions: 1 - Is there a better (working) way to do this ? 2 - Thinking of other languages, I thought (my first error I know :P ) that passing a reference to a array would allow me to change the array inside a sub. But $count is always 0 inside optionsNextItem(); Thanks in advance, Duarte Cordeiro -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
couple questions about refs
hello again, all my c instincts tell me i shouldn't write a function like this: sub myfunc(){ my $aref = []; if ( some_cond ){ return undef; } else{ #populate @{$aref} return $aref; } } but its cool, right? i know what i really should do is this: sub myfunc(){ my @array; if ( some_cond ){ return undef; } else{ #populate @array return [ @array ]; } } anyways, second question: how do i create/invoke a function ref? i wanna do something like this: sub myfunc(){ #blah blah } my $fref = \myfunc(); # is this right? {$fref}($arg1, $arg2); #is this right? are there any shortcuts like $fref-($arg1, $arg2)? i know this is the syntax for invoking a method, but i don't wanna go thru the hassle of making a class thanks for the tips, christopher -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: picking numbers out of a file and operating on them
Hi, # == # # Perl Source File -- Created with SAPIEN Technologies PrimalSCRIPT(TM) # # NAME: Nandita.pl # # AUTHOR: Aman Thind , Quark Inc # DATE : 12/16/2002 # # PURPOSE: comment # # == $file = 'C:\Documents and Settings\athind\Desktop\nandita.txt'; open FILE , $file; while(FILE) { if(/Length *= *([0-9]*)/) { push @Ln , $1; } if(/Identities.*\/ *([0-9]*)/) { push @Dn , $1; } } for($i=0 ; $i scalar(@Ln) ; $i++) { if(@Ln[$i]!= 0) { $percentage = @Dn[$i]*100/@Ln[$i]; } else { print Length = 0 in Blah; print $i+1; print !\n; die; } push @Blah,$percentage; if(@Blah[$i] 50) { print BLAH; print $i+1; print \n } } # This should do the job. Please adapt it to your liking. -aman. -Original Message- From: Nandita Mullapudi [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 14, 2002 3:31 AM To: [EMAIL PROTECTED] Subject: picking numbers out of a file and operating on them How does one tell perl to perform mathematical operations? I have a file with a series of items like this: BLAH1 Length = 500 Identities = 20/100. BLAH2 Length = 400 Identities = 30/70 For each item called BLAH, I want to pick the denominator in Identites and divide by Length and calculate percentage. Eg. for BLAH1: 100/500 * 100 = 20% and later , print all BLAHs for which the value is 50%. I csn write reg exps to find the numbers i am interested in, but am not sure how to go further.. thanks, -nandita -- 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]
Matching and Filling Arrays
I have a dummy list: Dog, A, B, C Dog, 1, 2, 3 Cat, A, 2, 3 I have a unique list of the first record, Dog and Cat...I want to look through the unique list, and then match all the records from the main list (as above)-matching the unique list value (Dog/Cat) with the main list...then if there are duplicate matches, as above, fill the array will the info... e.g. Dog array will contain A,B,C,1,2,3 and Cat will contain A,2,3...the following subroutine isn't working...I know the list will be x cols wide, so I can parse the final array quite easily...I'm dumping the values into a hash with the unique list name as the key...so I can take each key...and have the array as it's data...then parse it...why doesn't the following code work??? cheers sub HoA { my @temparray; my $arb; foreach $arb ( @uniqueroadname ) { foreach my $arb2 ( @contents ) { my $count; if ($arb2 =~ m/^$arb/) { push @temparray, $arb2; } } $hasharray{$arb} = [ @temparray ]; @temparray=(); } } __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Uploading files
Yes You can. 1st part print form method=post name=forandre; print input type=file name=filetoupload; print input type=submit name=save value=Save; print /form; select file from local machine using file field. field name is filetoupload. afeter submiting you get value of file field at server side using $filename=$q-param(filetoupload); if(!open(OUTFILE, $SAVE_DIRECTORY$Filename)) { print Can't open the file; } binmode(OUTFILE); while ($Bytes = read($filename,$Buffer,1024)) {$BytesRead += $Bytes; print OUTFILE $Buffer; } printing $BytesRead you get size of uploaded file rgds shine - Original Message - From: Andre [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 13, 2002 12:49 PM Subject: Uploading files Hi I know it is not entirely perl, but can anybody esplain me how does i do upload a file using a browser (can i use perl to do this)? Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
get COOKIES with 'HTTP_COOKIE' ??
Hello! what am I doing wrong with these co-operating perl-scripts? the first script sets a cookie, but I cant retrieve them when running the 2nd.. Something wrong with the $cookies=$ENV{'HTTP_COOKIE'}; ? thanks in advanced! Erik the first script with cookies: -- #!/usr/bin/perl -w alarm(30);#processen dödar sig själv efter 30 sek $POST_MAX=5000;# max 5000 bytes für uploadas use CGI::Carp qw(fatalsToBrowser);# fel-rapporter - Browsern use CGI qw(:standard); $cookie1=cookie(-name='erik', -value='test_cookie', -expire='+3h'); print header(-cookie=[$cookie1]); # END script 1 the second script with cookies: - #!/usr/bin/perl -w alarm(30);#processen dödar sig själv efter 30 sek $POST_MAX=5000;# max 5000 bytes für uploadas use CGI::Carp qw(fatalsToBrowser);# fel-rapporter - Browsern use CGI qw(:standard); print Content-type: text/plain\n\n; $cookies=$ENV{'HTTP_COOKIE'}; if ($cookies=~/name=/){ $cookie1=$cookies; $cookie1=~s/name=//; $cookie1=~s/:.*//; print Cookie 1: $cookie1\n; } else { print it doesnt exist any cookie!; } # END script 2 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DB_File to read Berkeley db
Hello All I think my question is slightly misplaced in this newsgroup I have been using DB_File.pm to read Berkely db files Is there a similar library for C ( not C++ ) I have been trying google search but could get one Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spreadsheet::ParseExcel date problem (year is being reformatted)
If I use $osheetCR-{Val} the value is in incremental serial numbers from 1 jan 1900 (or 1 jan 1904 for Apple users). Example: 12-1-1946 is 16814 I can convert 16814 back to the real date with the date::calc but there must be some way to extract the year in the right format ( and not yy). Max NYIMI Jose (BMB) wrote: $oSheetCR-Value #formatted value $oSheetCR-{Val} #original value José. -Original Message- From: Max [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 4:50 PM To: [EMAIL PROTECTED] Subject: Spreadsheet::ParseExcel date problem (year is being reformatted) When I read an Excel file in, ParseExcel reformates the year to dd-mm-*yy* (for example 10 dec 2002 is 10-12-*02*). I don't want this to happen, the format should stay the way it was dd-mm-** (10-12-*2002*). Here is the code: use Spreadsheet::ParseExcel; # Spread-ParseExcel [0.26] my $oExcel = new Spreadsheet::ParseExcel; my $oBook = $oExcel-Parse('mail/file.xls'); my($iRow, $iColom, $oWorkSheet, $oSheetCR); my $iSheet=0; my @string; $oWorkSheet = $oBook-{Worksheet}[$iSheet]; for (my $iRow = $oWorkSheet-{MinRow}; defined $oWorkSheet-{MaxRow} $iRow = $oWorkSheet-{MaxRow} ; $iRow++){ for(my $iColom = $oWorkSheet-{MinCol} ; defined $oWorkSheet-{MaxCol} $iColom = $oWorkSheet-{MaxCol} ; $iColom++) { $oSheetCR = $oWorkSheet-{Cells}[$iRow][$iColom]; push @string,$oSheetCR-Value if ($oSheetCR); } } Any help is appreciated, Max DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent.
Re: Uploading files
On Fri, 13 Dec 2002 05:19:08 -0200, [EMAIL PROTECTED] (Andre) wrote: Hi I know it is not entirely perl, but can anybody esplain me how does i do upload a file using a browser (can i use perl to do this)? Thanks Here's a really simple method using CGI::Simple ### #!/usr/bin/perl use warnings; use strict; use CGI::Simple; my $maxsize = 1024 * 100; #max 100K my $upload_dir='uploads'; my $q = new CGI::Simple; print $q-header(); if($ENV{CONTENT_LENGTH} $maxsize){ print file too large - must be less than $maxsize bytes; exit; } my $files= $q-upload();# number of files uploaded; my @files= $q-upload(); # names of all uploaded files my $filename = $q-param('upload_file');# filename of uploaded file my $mime = $q-upload_info($filename,'mime'); # MIME type of uploaded file my $size = $q-upload_info($filename,'size'); # size of uploaded file # short and sweet upload my $ok = $q-upload( $q-param('upload_file'),$upload_dir/$filename); print Uploaded .$q-param('upload_file'). and wrote it OK!\n if $ok; print total files = $filesbr filenames = @filesbr filename = $filenamebr mimetype= $mimebr size=$sizebr; ## -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [PHP] to php or to perl, that is the question
Folks, even if perhaps not intended as a troll, the effect will be the same. Please refrain from cross-posting dozens of messages. David, pick whichever language you are more comfortable with. There is pretty much nothing in one that can't be done in the other. It's like asking the Beef and Pork industries what to have for dinner tonight. -Rasmus On Sun, 15 Dec 2002, David T-G wrote: Hi, all -- I am starting a project that will have a web front end and mysql back end and handle staff input (eg not general web surfers, though an Internet face may come about one day)and updating for client records and scheduling. I am comfortable with both perl and php (and expect to be much more so with at least one of them by the project's maturity :-) In general, is there a checklist of when to use perl and when to use php in a web site design? Perhaps a comparison of the two languages, like I think I've seen long ago for C, Pascal, assembler, perl, and python? I read both lists (as I'm able, anyway; Hi perl guys!) and so you can reply to either or both of the lists or just to me as you see fit. I'll be happy to post a summary of any answers or directions I get. TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl Cgi/ Why?
Additional thought I've apprecitiated See ==ARCHIVE José. ==ARCHIVE -Original Message- From: Nigel Wetters [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 23, 2002 6:19 PM To: [EMAIL PROTECTED] Subject: Re: Perl vs. PHP? PHP is a good templating language, similar to ASP, JSP, etc. The problem with templating languages is that they're too good. It's always tempting for the programmer to introduce yet another small piece of logic into a page. It extremely difficult with these templating languages to abstract the various layers of a moderately complex application. Many applications can be split into three layers (model, view, and controller). The model is the underlying structure of your data, which won't differ whether you're accessing the data through the web, the command line, or a GUI. The view is a thin skin which presents the model on a particular platform (HTML, text, Tk, etc.). The controller validates user input, and decides what happens next. Templating languages are excellent for building the view layer Using mod_perl and template toolkit, or servlets and JSP, or COM and ASP, it's easy to write applications with clear boundaries between layers. With only the templating language, the model and controller are forced into the view layer, which soon becomes unmaintainable. However, PHP is fine for building quick and dirty webpages, which is what most people want. -- Nigel Wetters, Senior Programmer, Development Group Rivals Digital Media Ltd, 151 Freston Road, London W10 6TH Tel. 020 8962 1346 (direct line), Fax. 020 8962 1311 http://www.rivalsdm.com/ [EMAIL PROTECTED] ==ARCHIVE DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: getting defunct message
-Original Message- From: A. Johnson Jeba Asir [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 11:05 PM To: [EMAIL PROTECTED] Subject: getting defunct message hello people, When I'm trying to server which listens on tcp port and forking child process i'm getting lot of defunct process when the server gets lots of requests . Can any body explains why this happens in general ? When a child process terminates, the OS releases all the resources used by the process, but keeps the process entry in the process table. This is so the parent can read the child's exit status (this is called reaping). Processes that have terminated, but whose exit status has not yet been reaped are defuct or zombies. Two basic ways to handle this: 1. Catch SIGCHLD and call wait() from the signal handler to reap the exit status. 2. set $SIG{CHLD} = 'IGNORE' in the parent before forking. This tells the OS you don't care about the child exit status and it doesn't need to hold on to the process table entry. (Note: this does not work on all systems.) (The defunct/zombies will also go away when the parent terminates) See also: perldoc -q 'How do I avoid zombies on a Unix system?' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: couple questions about refs
From: christopher j bottaro [EMAIL PROTECTED] hello again, all my c instincts tell me i shouldn't write a function like this: sub myfunc() { my $aref = []; if ( some_cond ) { return undef; } else { #populate @{$aref} return $aref; } } but its cool, right? Yes this is fine in Perl. Perl simply does the right thing :-) i know what i really should do is this: sub myfunc() { my @array; if ( some_cond ) { return undef; } else { #populate @array return [ @array ]; } } Well ... I would use return \@array; it's a bit more Perlish and actually I expect it to be quicker. (Benchmarking is left to the reader) anyways, second question: how do i create/invoke a function ref? i wanna do something like this: sub myfunc() { #blah blah } my $fref = \myfunc(); # is this right? without the (): my $fref = \myfunc; {$fref}($arg1, $arg2); #is this right? are there any shortcuts like $fref-($arg1, $arg2)? i know this is the syntax for invoking a method, but i don't wanna go thru the hassle of making a class Both these syntaxes are OK. No need for any classes or whatever. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Die horribly ?
From: John W. Krahn [EMAIL PROTECTED] Mystik Gotan wrote: Hi there, Hello, another basic Perl question up here. The last time I've seen quite some code using die horribly;. Actually, I've never seen this before. Is this a new built-in for 5.8.0? What I want to know, is wat it does. I'm sure it can't be some text, I have an idea, but I'm not sure. Please, I just wanna know what it is, I don't think any duscussions are needed. Thanks :-) It is pseudo-code, not actual Perl code (at least when I've seen it used.) John You're right. Though it could easily be proper Perl code ;-) You'd just have to define function (or constant) horribly: use constant horribly = 'Something horrible happened!'; ... open FILE, ' data.dat' or die horribly; Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: couple questions about refs
Chris, I'll take a stab at this to see if my understanding of Perl is correct. Your first subroutine is acceptable under Perl, but it wouldn't be under C++. The reason is that Perl has automatic reference counting and garbage collection. Perl counts the number of references there are to data elements. When you create $aref, the reference count of the anonymous array is set to 1. When the subroutine ends and you would expect the array to disappear, Perl checks the array's reference count. Since the reference count is 1, the array is kept in memory. If the variable into which the reference is stored in the calling program goes out of scope, the reference count on the array will go to zero, and Perl will be free to release the array whenever it wants to, but I think I read that you can't influence the moment when the array will actually go away. Gurus, am I correct? Rob __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: glob subtlety question
-Original Message- From: David Eason [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 14, 2002 9:53 PM To: [EMAIL PROTECTED] Subject: glob subtlety question Is there a better way to say: my @input_files = glob (join , @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there because otherwise... if there are no file arguments, @input_files ends up having an element [0] And the foreach loop tries to run anyway. Right, so you still need the unless clause. I prefer to write it as: unless @ARGV Also, the join can be simplified to @ARGV(see perldoc perlvar, search for the $ variable) So that would be: my @input_files = glob @ARGV unless @ARGV; But, if your running under a UNIX shell, the arg list has already been globbed, no? Are you running under Win32? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Die horribly ?
Ahh, that explains. But what exactly is pseudo-code? -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: Jenda Krynicky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Die horribly ? Date: Mon, 16 Dec 2002 15:50:39 +0100 From: John W. Krahn [EMAIL PROTECTED] Mystik Gotan wrote: Hi there, Hello, another basic Perl question up here. The last time I've seen quite some code using die horribly;. Actually, I've never seen this before. Is this a new built-in for 5.8.0? What I want to know, is wat it does. I'm sure it can't be some text, I have an idea, but I'm not sure. Please, I just wanna know what it is, I don't think any duscussions are needed. Thanks :-) It is pseudo-code, not actual Perl code (at least when I've seen it used.) John You're right. Though it could easily be proper Perl code ;-) You'd just have to define function (or constant) horribly: use constant horribly = 'Something horrible happened!'; ... open FILE, ' data.dat' or die horribly; Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Ontvang je Hotmail Messenger berichten op je mobiele telefoon met Hotmail SMS http://www.msn.nl/jumppage/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regexpr
How can I grab a numeric string that contains commas. String -- POINTPoint Health Centers 19,466.79 0.00 401.20 0.00 19,867.99 My Expr --- if (/(^POINT)\s+ Point Health Centers\s+([\d\,]*)\s+.*/){ print $1 $2\n; } What it returns --- POINT Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regexpr
On Dec 16, Paul Kraus said: How can I grab a numeric string that contains commas. ... that ALSO contains periods in it. POINTPoint Health Centers 19,466.79 0.00 401.20 0.00 19,867.99 if (/(^POINT)\s+ Point Health Centers\s+([\d\,]*)\s+.*/){ print $1 $2\n; } The [\d\,]* matches 19,466, but then \s+ can't match because the next character is a ., so eventually, [\d\,]* matches NO characters at all (since * means zero or more). Try: if (/^POINT\s+Point Health Centers\s+([\d.,]+)/) { $val = $1; } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ 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: couple questions about refs
#!/usr/bin/perl use strict; use Benchmark; sub using_aref{ my $aref=[]; @$aref=(1,2,3,4,5); return $aref; } sub using_array{ my @array=(); @array=(1,2,3,4,5); return \@array; } And the winner is : timethese (100,{ using_aref = \using_aref,using_array = \using_array}); Benchmark: timing 100 iterations of using_aref, using_array... using_aref: 9 wallclock secs ( 7.99 usr + 0.00 sys = 7.99 CPU) @ 125125.13/s (n=100) using_array: 5 wallclock secs ( 5.20 usr + 0.00 sys = 5.20 CPU) @ 192381.69/s (n=100) José. -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 3:51 PM To: [EMAIL PROTECTED] Subject: Re: couple questions about refs From: christopher j bottaro [EMAIL PROTECTED] hello again, all my c instincts tell me i shouldn't write a function like this: sub myfunc(){ my $aref = []; if ( some_cond ) { return undef; } else { #populate @{$aref} return $aref; } } but its cool, right? Yes this is fine in Perl. Perl simply does the right thing :-) i know what i really should do is this: sub myfunc(){ my @array; if ( some_cond ) { return undef; } else { #populate @array return [ @array ]; } } Well ... I would use return \@array; it's a bit more Perlish and actually I expect it to be quicker. (Benchmarking is left to the reader) anyways, second question: how do i create/invoke a function ref? i wanna do something like this: sub myfunc(){ #blah blah } my $fref = \myfunc(); # is this right? without the (): my $fref = \myfunc; {$fref}($arg1, $arg2); #is this right? are there any shortcuts like $fref-($arg1, $arg2)? i know this is the syntax for invoking a method, but i don't wanna go thru the hassle of making a class Both these syntaxes are OK. No need for any classes or whatever. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Excel
Is it possible to insert data into an excel file using Perl? If so can you point me to some info. Thanks. Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Excel
Have you checked CPAN ? http://search.cpan.org/ José. -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 5:52 PM To: 'Perl' Subject: Excel Is it possible to insert data into an excel file using Perl? If so can you point me to some info. Thanks. Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: using pipe
Forwarded Message Message-ID:[EMAIL PROTECTED]To:[EMAIL PROTECTED]:maxchen [EMAIL PROTECTED]Subject:using pipeDate:Sat, 14 Dec 2002 02:11:10 +0800 hi everyone,i am a novice to the perl and i want towrite a perl program to redirect anotherprogram's STDIN STDOUT to pipes,it's possible or there are source examplesexist?thanks,maxchen to redirect STDOUT: open IN,programname | or die $!; you can then read from it as any other normal filehandle. to redirect from STDIN: open OUT,| programname or die $!; you can then write to it using print OUT,what you want to wrtite; In both cases, note the use of |. perldoc perlopentut for more. cheers Image by FlamingText.com - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
re: using pipe
Forwarded Message Message-ID:[EMAIL PROTECTED]To:[EMAIL PROTECTED]:maxchen [EMAIL PROTECTED]Subject:using pipeDate:Sat, 14 Dec 2002 02:11:10 +0800 hi everyone,i am a novice to the perl and i want towrite a perl program to redirect anotherprogram's STDIN STDOUT to pipes,it's possible or there are source examplesexist?thanks,maxchen to redirect STDOUT: open IN,programname | or die $!; you can then read from it as any other normal filehandle. to redirect from STDIN: open OUT,| programname or die $!; you can then write to it using print OUT,what you want to wrtite; In both cases, note the use of |. perldoc perlopentut for more. cheers Image by FlamingText.com - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
RE: Excel
I found a couple modules. But they all seem to either for getting data from excel or creating a new excel worksheet. I need to insert data into an excel spreadsheet that already contains data,and several worksheets. -Original Message- From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 12:02 PM To: Paul Kraus; Perl Subject: RE: Excel Have you checked CPAN ? http://search.cpan.org/ José. -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 5:52 PM To: 'Perl' Subject: Excel Is it possible to insert data into an excel file using Perl? If so can you point me to some info. Thanks. Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com DISCLAIMER This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- 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: Excel
--- Paul Kraus [EMAIL PROTECTED] wrote: I found a couple modules. But they all seem to either for getting data from excel or creating a new excel worksheet. I need to insert data into an excel spreadsheet that already contains data,and several worksheets. Hi Paul, If you go to http://www.perlmonks.org/ and type 'Excel' into the search box in the upper left corner, you'll find a variety of results that appear to deal with this issue. http://www.perlmonks.org/index.pl?node_id=207945 http://www.perlmonks.org/index.pl?node_id=220111 http://www.perlmonks.org/index.pl?node_id=215093 Cheers, Ovid = Ovid on http://www.perlmonks.org/ Web Programming with Perl: http://users.easystreet.com/ovid/cgi_course/ Silence Is Evil: http://users.easystreet.com/ovid/philosophy/decency.txt __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: get COOKIES with 'HTTP_COOKIE' ??
what am I doing wrong with these co-operating perl-scripts? the first script sets a cookie, but I cant retrieve them when running the 2nd.. Something wrong with the $cookies=$ENV{'HTTP_COOKIE'}; $cookies=$ENV{'HTTP_COOKIE'}; if ($cookies=~/name=/){ ... } else { print it doesnt exist any cookie!; } Erik, I think your problem is not that HTTP_COOKIE isn't being set, but that the format isn't what you are expecting. You are testing to see if cookies contains 'name=' and if that fails, just assuming that HTTP_COOKIE is empty. Did you try simply printing HTTP_COOKIE to see what value it actually has? I don't believe cookies are returned to the server as 'name=erik' and 'value=test_cookie', but rather as 'erik=test_cookie'. So you should be testing: if ($cookies =~ /erik=/) { ---Larry ++ | Larry Coffin, G.P.H. Watertown, MA | | http://www.PointInfinity.com/lcoffin/[EMAIL PROTECTED] | ++ Of course there's no reason for it, it's just our policy. - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
script to download a file. Script to
Hello, I was wondering is anyone will be willing to share a Perl script to download a file with me. I tried the example on CGI::Simple, but I do not know how to make reference to my proxy server xyx in the script. What I ended up doing is to set the http_server variable outside at the shell. Thank you, William -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Outputting to a file.
I am trying to modify a Perl script that was written by an ex employee. The script is supposed to extract customer details from our database so that the details can be transferred using sendmail to another database. The test data on the database consists of 7 customers from 1 to 7. I have managed to get the script to print all but one customer (7) to the output file (test.xml) also each customer is being added to the file several times before the loop moves on to the next customer. Can have a look at the script and shed some light on why this might be happening. Thanks Caroline mcp.pl Description: Perl program -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regex help
Thanks everyone for the help. It worked like a charm. Not actually sure how it works. Never used \G b4. My regex books says its not used very much. Thanks again. -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 6:38 PM To: [EMAIL PROTECTED] Subject: Re: regex help Danny Grzenda wrote: DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,4,503,1,801,80 5 Trying to create a regex to substitute comas with pipes, except for the commas between the double quotes. can't get one to work. You have to parse the data. Here is some code modified from the perlop manpage: $ perl -e' $_ = qq[DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,4,503,1,801 ,80 5\n]; print; LOOP: { redo LOOP if /\G[^]*/gc; # bypass quoted strings redo LOOP if s/\G,/|/gc;# change commas to pipes redo LOOP if /\G[^,]/gc;# ignore other characters } print; ' DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,4,503,1,801,80 5 DB4515C|625.25|378|327|382|352|805|163|513.5|699|257.88|||4,503|1,801|80 5 John -- use Perl; program fulfillment -- 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: Outputting to a file.
This line: # Loop through all of these customers for (my $i = 0; $i $#data; $i++) where you are doing the $#data needs to be changed to scalar(@data) or change the $#data to = $#data Wags ;) -Original Message- From: Caroline Warnock [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 08:06 To: [EMAIL PROTECTED] Subject: Outputting to a file. I am trying to modify a Perl script that was written by an ex employee. The script is supposed to extract customer details from our database so that the details can be transferred using sendmail to another database. The test data on the database consists of 7 customers from 1 to 7. I have managed to get the script to print all but one customer (7) to the output file (test.xml) also each customer is being added to the file several times before the loop moves on to the next customer. Can have a look at the script and shed some light on why this might be happening. Thanks Caroline ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
regex
What is the difference between: $arg = foo \(bar\); and $arg = 'foo \(bar\)'; when using like: s/$arg/bleah/; One works, one doesn't. Why? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: glob subtlety question
David Eason wrote: Is there a better way to say: my @input_files = glob (join , @ARGV) unless $#ARGV = -1; foreach my $doc ( @input_files ) { ... __code goes here___ } I put the unless clause in there because otherwise... if there are no file arguments, @input_files ends up having an element [0] And the foreach loop tries to run anyway. That will break if there are any file names with whitespace in them. $ perl -le' @ARGV = ( file one.txt, file two.txt, 0 ); my @input_files = glob (join , @ARGV) unless $#ARGV == -1; print Number of files: . @input_files; ' Number of files: 5 Better to do it this way instead: $ perl -le' @ARGV = ( file one.txt, file two.txt, 0 ); my @input_files = @ARGV; $_ = glob for @input_files; print Number of files: . @input_files; ' Number of files: 3 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: regex
When you use the double quotes: $arg looks like foo (bar) But when you use single quotes, there is no expansion just what you enter is what you get, so the $arg looks like foo \(bar\) Obviously the second is not what you want. SO using single quotes, you set $arg like 'foo (bar)' Wags ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 11:33 To: [EMAIL PROTECTED] Subject: regex What is the difference between: $arg = foo \(bar\); and $arg = 'foo \(bar\)'; when using like: s/$arg/bleah/; One works, one doesn't. Why? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: couple questions about refs
Nyimi Jose wrote: From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] From: christopher j bottaro [EMAIL PROTECTED] #populate @array return [ @array ]; } } Well ... I would use return \@array; it's a bit more Perlish and actually I expect it to be quicker. (Benchmarking is left to the reader) use Benchmark; sub using_aref{ my $aref=[]; @$aref=(1,2,3,4,5); return $aref; } sub using_array{ my @array=(); @array=(1,2,3,4,5); return \@array; } Christopher was asking about return [ @array ] which returns a reference to a _copy_ of the array (very slow) and Jenda correctly pointed out that return \@array is faster because there is no copying involved however your benchmark doesn't compare these two methods. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Matching and Filling Arrays
Ben Crane wrote: I have a dummy list: Dog, A, B, C Dog, 1, 2, 3 Cat, A, 2, 3 I have a unique list of the first record, Dog and Cat...I want to look through the unique list, and then You should probably be using a hash instead of an array for the unique list. match all the records from the main list (as above)-matching the unique list value (Dog/Cat) with the main list...then if there are duplicate matches, as above, fill the array will the info... e.g. Dog array will contain A,B,C,1,2,3 and Cat will contain A,2,3...the following subroutine isn't working...I know the list will be x cols wide, so I can parse the final array quite easily...I'm dumping the values into a hash with the unique list name as the key...so I can take each key...and have the array as it's data...then parse it...why doesn't the following code work??? You probably want something like this: my %uniqueroadname = ( Dog = 1, Cat = 1 ); my %hasharray; while ( DATA ) { my ( $arb, @contents ) = split /\s*,\s*/; push @{$hasharray{$arb}}, @contents if exists $uniqueroadname{$arb}; } __DATA__ Dog, A, B, C Dog, 1, 2, 3 Cat, A, 2, 3 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DB_File to read Berkeley db
Ramprasad A Padmanabhan wrote: Hello All Hello, I think my question is slightly misplaced in this newsgroup I have been using DB_File.pm to read Berkely db files Is there a similar library for C ( not C++ ) http://www.sleepycat.com/ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
remote hard drive stat
Is there away that I can get remote hard drive stat from windows box? Thomas
RE: Full Screen
Windows probably won't see it as a DOS app so that'll be why. Have you tried alt and enter (together) to get it off full screen, then right click on the top left and properties, change the properties, click ok, then save setting for future windows with same title. HTH Nigel MIS Web Design http://www.miswebdesign.com/ -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: 16 December 2002 20:54 To: Perl Subject: Full Screen When I run a Perl app in windows by double clicking on it the app opens full screen. I do not want it to run like this. I tried right clicking on it to set properties like you would for a dos app but I do not get any options. Any Ideas? Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: remote hard drive stat
Try this module: http://search.cpan.org/author/MBLAZ/Win32-DriveInfo-0.06/DriveInfo.pm I don't know what experience you have so if that's still confusing ask again. HTH Nigel MIS Web Design http://www.miswebdesign.com/ -Original Message- From: Thomas Browner [mailto:[EMAIL PROTECTED]] Sent: 16 December 2002 21:37 To: 'Nigel Peck - MIS Web Design' Subject: RE: remote hard drive stat I have 10 windows nt and 2000 server that I want disk info on. The info that I would like is free space and used space. Thomas Browner Digidyne, Inc Technical Engineer (251)479-1637 -Original Message- From: Nigel Peck - MIS Web Design [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 3:33 PM To: Thomas Browner Subject: RE: remote hard drive stat When you say remote hard drive stat, what information do you want? Take a look at the Win32 modules on CPAN. Nigel MIS Web Design http://www.miswebdesign.com/ -Original Message- From: Thomas Browner [mailto:[EMAIL PROTECTED]] Sent: 16 December 2002 21:19 To: [EMAIL PROTECTED] Subject: remote hard drive stat Is there away that I can get remote hard drive stat from windows box? Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why does this code fail? - Sorry here are the line numbers..
Thanks to all those guys who answered my question As you guys pointed out the join worked without //s. But the code also had some correction to be made (eg. line number 34) and would look really like this(and not as I initially sent you folks). There are still has some issues with line 11 and I am debugging it. Sorry I am not very good at PERL but any suggestions to improve performance are greatly appreciated. my @str_start = qw ( 1 0 28 27 34 ); my @str_length = qw ( 8 9 10 9 2 ); my @search_key = qw (FILETYPE.ZIP RBZ RBZ Bytes Errors); my @search_out = qw( \@env_start \@env_end \@env_files \@env_bytes \@env_errors ); #Open the Modem Log and get Start time, End time, File Information, Bytes received #Errors observed during dail up my $MonthDay = shift(); print $Monthday; open (MODEMLOG, /opt/cleo/envoy/log/calenvoy.$MonthDay ) or die (Can not open MODEMLOG); my @modem_log = MODEMLOG; close (MODEMLOG ) or die ( Cannot close file: MODEMLOG); for ($i = 0; $i @search_key; $i++) { ${search_out[$i]} = grep (/$search_key[$i]/,@modem_log); for ($j = 0; $j ${search_out[0]}; $j++) { ${search_out[$i]} = substr ($search_out[$i][$j],$str_start [$j].$str_length[$j]); } } for ($i = 0; $i @env_errors; $i++) { ${env_desc[$i]} = join (',',${env_files[$i]},${env_start[$i]}, ${env_end[$i]}, ${env_bytes[$i]}, ${env_errors[$i]}, \n); } my @fields; my @clm_types = qw ( PHC.ZIP PMC.ZIP ); for ($i = 0; $i @clm_types; $i++) { @temp_str = grep (/${clm_types[$i]}/,@env_desc); @fields = split (/,/,$temp_str[@temp_str - 1],4); $env_final[$i] = join (',',$fields[1],$fields[2],@temp_str - 1); } } # End of the procModemLog() ### Sincerely, Satya Devarakonda IS - EDI Tufts Health Plan Tel: 617-923-5587 X 3413 Fax: 617-923- Dave Storrs [EMAIL PROTECTED] To: [EMAIL PROTECTED] gpanda.com cc: Subject: Re: Why does this code fail? - Sorry here are the line numbers.. 12/15/2002 02:25 PM On Sat, Dec 14, 2002 at 12:51:50PM -0500, [EMAIL PROTECTED] wrote: Can somebody tell what is wrong with this. I tried single quote (') in place of double quote() neither of them work. 184 for ($i = 0; $i @clm_types; $i++) 185 { 186@temp_str = grep (/$_/,@env_desc); 187@fields = split (/,/,$temp_str[@temp_str - 1],4); 188$env_final[$i] = join (/,/,$fields[1],$fields[2],@temp_str - 1); 189 } /,/ should probably be written as , at loadstats1.pl line 188. Unlike split, join() takes a string as its first argument, not a regex. What you want is this: $env_final[$i] = join (,,$fields[1],$fields[2],@temp_str - 1); | Notice--no '/'s here However, I'm not really sure that that's what you want either. As written, this line will join three elements into a string and assign it to $env_findal[$i]. The three elements it will join are: $fields[1] $fields[2] @temp_str - 1 The problem is that last one...I suspect that you want it to be the last element of @temp_str, but what it is actually going to be is the number that you get by subtracting 1 from the number of elements in @temp_str. Try this instead: $env_final[$i] = join(,,$fields[1],$fields[2],$temp_str[-1]); --Dks -- 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]
Getting a variable back
I have a program that gets an EXE file using a regex pattern and puts it into a file variable: foreach(@list) { if(m/\d{8}.*x86.exe/) { push(@match,$_) } } I then download the matching file: if(scalar(@match)) { $file=$match[$#match]; print Downloaded file $file\n; $ftp-binary(); $ftp-get($file); } I now want to run the downloaded EXE with some command line switches. I have tried it with system but it doesn't seem to like using the variable $file plus switches so I was wondering about how to get the filename out of the $file variable. If that makes sense. Bob
RE: Full Screen
Worked like a charm. I am used to running in unix/linux. Thanks!! -Original Message- From: Nigel Peck - MIS Web Design [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 4:32 PM To: Paul Kraus; Perl Subject: RE: Full Screen Windows probably won't see it as a DOS app so that'll be why. Have you tried alt and enter (together) to get it off full screen, then right click on the top left and properties, change the properties, click ok, then save setting for future windows with same title. HTH Nigel MIS Web Design http://www.miswebdesign.com/ -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: 16 December 2002 20:54 To: Perl Subject: Full Screen When I run a Perl app in windows by double clicking on it the app opens full screen. I do not want it to run like this. I tried right clicking on it to set properties like you would for a dos app but I do not get any options. Any Ideas? Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting a variable back
--- Bob H [EMAIL PROTECTED] wrote: Bob, What are you trying to accomplish? Perhaps we can help you find a more secure way of doing this. if(scalar(@match)) { $file=$match[$#match]; print Downloaded file $file\n; $ftp-binary(); $ftp-get($file); } I now want to run the downloaded EXE with some command line switches. FTP is probably the least secure protocol available. Grabbing a remote executable and trying to run it would be a security nightmare. I would suggest that, at the very least, you switch to a more secure protocol or have a *local* set of MD5 digests that you can match against the downloaded code (that's not perfect, but it's better than nothing). Preferable, though, would be outlining the overall problem that you're trying to solve so we can perhaps brainstorm with you better methods of approaching this situation. Cheers, Ovid = Ovid on http://www.perlmonks.org/ Web Programming with Perl: http://users.easystreet.com/ovid/cgi_course/ Silence Is Evil: http://users.easystreet.com/ovid/philosophy/decency.txt __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
NET::SMTP sometimes loses From: line
Hello, I have a perl program that sends out mail. It has been in production since 1998. It works fine in most installations. I recently changed ISPs (new: ISP outgoing mail server is mail.megapath.net) The messages are now losing the From: line. In the expanded header, the Return-Path: line is fine. This occurs on Solaris, Perl 5.005 and RedHat 7.2, Perl 5.6.1. The problem goes away when I change the outgoing mail server to my internal SMTP server. (An Internet appliance). I guess the right answer is to run my own SMTP server. Do not want to do that since I do not know much about SMTP. Is there any way to get NET::SMTP to work with the ISPs like mail.megapath.net? Is there a tool that might work? TIA Robert Monical [EMAIL PROTECTED] (mailing list stuff) [EMAIL PROTECTED] (everything else) www.restek.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
german umlauts - how to cope with
A friendly hello to all of you! As I'm posting first time here, I'd like to introduce myself as a bloody perl-newbie ;( My problem: I tried to use a regexp in a word counting program and encountered that any word with a 'german umlaut' is ignored when using the following m// : $word =~ m/^[a-zA-Z]+([-']+|([-'][a-zA-Z]+))*$/; How do I have to modify the pattern [a-zA-Z] to include aediaresis, oediaresis and uediaresis? TIA have a nice day ;) -- M.f.G. Georg Koss mailto: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Looking for the attachments
Hi people .. I'm using the Mail::Box modules to manipulate e-mail... but I still don't know how to obtain the names of the files attached to an e-mail...I need it to validate the type of file and its name...could somebody help me ? Thanks a lot .. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: german umlauts - how to cope with
Georg Koss wrote: A friendly hello to all of you! Hello, As I'm posting first time here, I'd like to introduce myself as a bloody perl-newbie ;( My problem: I tried to use a regexp in a word counting program and encountered that any word with a 'german umlaut' is ignored when using the following m// : $word =~ m/^[a-zA-Z]+([-']+|([-'][a-zA-Z]+))*$/; How do I have to modify the pattern [a-zA-Z] to include aediaresis, oediaresis and uediaresis? Put this line near the top of your program: use locale; Then this should work: $word =~ m/^[[:alpha:]]+([-']+|([-'][[:alpha:]]+))*$/; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting a variable back
Bob, Consider: cls.pl use strict; my @switches = @ARGV; foreach(@switches) { print$_\n; } $ perl -e ' my @clss = (cls.pl, one, two, three); system @clss;' output: one two three Takes the first element treats it as an executable and the rest of the list as arguments. HTH Bob H [EMAIL PROTECTED] wrote in message 002d01c2a54c$c7c94870$a4203118@home5j8ddwdscw">news:002d01c2a54c$c7c94870$a4203118@home5j8ddwdscw... I have a program that gets an EXE file using a regex pattern and puts it into a file variable: foreach(@list) { if(m/\d{8}.*x86.exe/) { push(@match,$_) } } I then download the matching file: if(scalar(@match)) { $file=$match[$#match]; print Downloaded file $file\n; $ftp-binary(); $ftp-get($file); } I now want to run the downloaded EXE with some command line switches. I have tried it with system but it doesn't seem to like using the variable $file plus switches so I was wondering about how to get the filename out of the $file variable. If that makes sense. Bob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why does this code fail? - Sorry here are the line numbers..
Satya Devarakonda wrote: Thanks to all those guys who answered my question As you guys pointed out the join worked without //s. But the code also had some correction to be made (eg. line number 34) and would look really like this(and not as I initially sent you folks). There are still has some issues with line 11 and I am debugging it. Sorry I am not very good at PERL but any suggestions to improve performance are greatly appreciated. my @str_start = qw ( 1 0 28 27 34 ); my @str_length = qw ( 8 9 10 9 2 ); my @search_key = qw (FILETYPE.ZIP RBZ RBZ Bytes Errors); Since search_key is used in a regular expression it might be better to create one. my $search_key = qr/FILETYPE.ZIP|RBZ|RBZ|Bytes|Errors/; my @search_out = qw( \@env_start \@env_end \@env_files \@env_bytes \@env_errors ); You are using qw() so this is the same as: my @search_out = ('\@env_start', '\@env_end', '\@env_files', '\@env_bytes', '\@env_errors'); #Open the Modem Log and get Start time, End time, File Information, Bytes received #Errors observed during dail up my $MonthDay = shift(); print $Monthday; open (MODEMLOG, /opt/cleo/envoy/log/calenvoy.$MonthDay ) or die (Can not open MODEMLOG); You should include the $! variable in the error message so you know why it failed. my @modem_log = MODEMLOG; close (MODEMLOG ) or die ( Cannot close file: MODEMLOG); for ($i = 0; $i @search_key; $i++) { ${search_out[$i]} = grep (/$search_key[$i]/,@modem_log); You are assigning a list to a scalar here which is probably not what you want. Also, why you are overwriting the current values in the @search_out array? for ($j = 0; $j ${search_out[0]}; $j++) { ${search_out[$i]} = substr ($search_out[$i][$j],$str_start [$j].$str_length[$j]); } } for ($i = 0; $i @env_errors; $i++) ^^^ Where did this come from? { ${env_desc[$i]} = join (',',${env_files[$i]},${env_start[$i]}, ${env_end[$i]}, ${env_bytes[$i]}, ${env_errors[$i]}, \n); } my @fields; my @clm_types = qw ( PHC.ZIP PMC.ZIP ); Again, why not just create a regular expression? my $clm_types = qr/P[HM]C.ZIP/; for ($i = 0; $i @clm_types; $i++) { @temp_str = grep (/${clm_types[$i]}/,@env_desc); @fields = split (/,/,$temp_str[@temp_str - 1],4); $env_final[$i] = join (',',$fields[1],$fields[2],@temp_str - 1); } } # End of the procModemLog() ### John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting a variable back
Bob H wrote: I have a program that gets an EXE file using a regex pattern and puts it into a file variable: foreach(@list) { if(m/\d{8}.*x86.exe/) { push(@match,$_) } } I then download the matching file: if(scalar(@match)) { $file=$match[$#match]; print Downloaded file $file\n; $ftp-binary(); $ftp-get($file); } Ah, another person getting the latest AV file from ftp.symantec.com. I now want to run the downloaded EXE with some command line switches. I have tried it with system but it doesn't seem to like using the variable $file plus switches so I was wondering about how to get the filename out of the $file variable. If that makes sense. my @switches = qw( -t -h -f ); system( $file, @switches ) == 0 or die system $file failed: $? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: getting defunct message
Hello , Thanks for the help.. the info which who have provided is very helpful for me..thanks Regards, A.Johnson ! -Original Message- ! From: A. Johnson Jeba Asir [mailto:[EMAIL PROTECTED]] ! Sent: Friday, December 13, 2002 11:05 PM ! To: [EMAIL PROTECTED] ! Subject: getting defunct message ! ! ! hello people, ! ! When I'm trying to server which listens on ! tcp port and ! forking child process i'm getting lot of defunct process when ! the server ! gets lots of requests . Can any body explains why this happens in ! general ? ! !When a child process terminates, the OS releases all the resources used by !the process, but keeps the process entry in the process table. This is so !the parent can read the child's exit status (this is called reaping). !Processes that have terminated, but whose exit status has not yet been !reaped are defuct or zombies. ! !Two basic ways to handle this: ! !1. Catch SIGCHLD and call wait() from the signal handler to reap the exit !status. ! !2. set $SIG{CHLD} = 'IGNORE' in the parent before forking. This tells the OS !you don't care about the child exit status and it doesn't need to hold on to !the process table entry. (Note: this does not work on all systems.) ! !(The defunct/zombies will also go away when the parent terminates) ! !See also: ! ! perldoc -q 'How do I avoid zombies on a Unix system?' ! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: localtime question - zero padding - mnth discrepancy
Toby Stuart [EMAIL PROTECTED] writes: Check the length of second, minute and hour. If the length == 1 then add a leading zero eg. $sec = 0 . $sec Maybe there is some other magical way of doing this, if there is i'm not aware of it :) Good idea... thanks. John W. Krahn [EMAIL PROTECTED] writes: printf %02d/%02d/%04d %02d:%02d:%02d\n, $lta[4] + 1, $lta[3], $lta[5] + 1900, @lta[2,1,0]; Thanks.. the tips work good. And I overlooked the part about mnths being 0-11. I get the idea from your posted printf line and learned a new trick with the @ar[2,4,7] syntax you used but couldn't really understand why it gave a screwball year in my script until I noticed the `=' missing in $lta[5] + 1900. Still not sure I understand why it needs to be there. cat test2 #!/usr/local/bin/perl -w $now = time; $date_spec = ($now - 86400); # local time adjusted @lta = localtime($date_spec); $mnth = ($lta[4] + 1); print $mnth/$lta[3]/ . ($lta[5] += 1900) . $lta[2]:$lta[1]:$lta[0]\n; print localtime() . \n; printf %02d/%02d/%04d %02d:%02d:%02d\n, $lta[4] + 1, $lta[3], $lta[5] + 1900, @lta[2,1,0]; OUTPUT: $ ./test2 12/15/2002 20:16:38 Mon Dec 16 20:16:38 2002 12/15/3902 20:16:38 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: script to download a file. Script to
How about lwp-download.bat comes with the installation of ASPerl(on Windows)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 17 December 2002 5:09 AM To: [EMAIL PROTECTED] Subject: script to download a file. Script to Hello, I was wondering is anyone will be willing to share a Perl script to download a file with me. I tried the example on CGI::Simple, but I do not know how to make reference to my proxy server xyx in the script. What I ended up doing is to set the http_server variable outside at the shell. Thank you, William -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: couple questions about refs
Christopher J Bottaro wrote: hmm, something is going off in my head that says this is scary. Calm down Christopher. :-) @array is local to the function (lexically scoped as you would say in perl??) and you are returning a reference to it. Yes, that is correct. well when the function goes out of scope, isn't @array deallocated (popped off the stack) and now that reference you returned is pointing to garbage? No, as long as there is still a reference to the array the data is available. or is perl's garbage collection sophisticated enough to realize the difference between: myfunc(); and my $ref = myfunc(); and not deallocate @array in the second example? Yes, that is correct. also, i do understand that [ @array ] constructs and anonymous array, copies @array into it, then returns a reference to to the new anonymous array. as opposed to \@array which merely returns a reference to something that already exists. Yes, that is correct. but i guess my questions is...well, i asked it above...about whether or not @array will still be in existance when the function ends... If you assign the reference to a scalar, then yes. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: couple questions about refs
cool beans, thanks. wow, perl is neat, but i fear it will make me a bad c programmer...;) so i guess there is no concept of stack and heap space when dealing with perl? just that memory will stay allocated as long as there is a way to reach it? hehe, i can't wait to abuse that fact;) christopher On Tuesday 17 December 2002 12:21 am, John W. Krahn wrote: Christopher J Bottaro wrote: hmm, something is going off in my head that says this is scary. Calm down Christopher. :-) @array is local to the function (lexically scoped as you would say in perl??) and you are returning a reference to it. Yes, that is correct. well when the function goes out of scope, isn't @array deallocated (popped off the stack) and now that reference you returned is pointing to garbage? No, as long as there is still a reference to the array the data is available. or is perl's garbage collection sophisticated enough to realize the difference between: myfunc(); and my $ref = myfunc(); and not deallocate @array in the second example? Yes, that is correct. also, i do understand that [ @array ] constructs and anonymous array, copies @array into it, then returns a reference to to the new anonymous array. as opposed to \@array which merely returns a reference to something that already exists. Yes, that is correct. but i guess my questions is...well, i asked it above...about whether or not @array will still be in existance when the function ends... If you assign the reference to a scalar, then yes. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]