help about perl -pi -e
Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi But this command only erase one line at once. And I want to erase all the lines in one time. Is there anybody who can help? Thanks a lot Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
On Thursday 25 April 2002 15:10, you wrote: | I'm not quite sure what you're trying to do with this... but from what | you've provided, the regular expression you wrote will only remove text | matching sub html_base on a single line -- and not even the | newline at the end. The '-pi' switches will grab a single line at a time | from the currently open file to compare to the expression. | | It sounds like you've got a subroutine you're trying to remove from some | files: | sub html_base { | ... | } exact, that's it. but i've got the solution to that problem (i forgot to put the trailing 's' in my post, but i used it and it did not work) the solution is: perl -p0i -e 's/sub html_base.*//s' *.cgi it does exactly what i need, and is very fast. thanks for your answer Alain Scieur | yes? If so, it might make more sense to make a quick-and-dirty perl | script that will take the fileglob (*cgi), read one file at a time, and | read that entire file into a single string, and then run the regexp you | wrote against it, with the following addition: | s/sub html_base[\s\S]*//s | The trailing 's' will allow the regexp to look over newlines (\n) when | matching. | | --Matthew | | On Thu, 25 Apr 2002 04:10:58 -0400, Alain wrote: | Hello all, | | I've the following problem: | I need to erase about 150 lines (always the same lines) at the end of a | serie of files. | What I have done in the shell is: | #perl -pi -e s/sub html_base[\s\S]*// *cgi | | But this command only erase one line at once. And I want to erase all | the lines in one time. Is there anybody who can help? | | Thanks a lot | | Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
Hi, Am Donnerstag, 25. April 2002 15:20 hast Du geschrieben: exact, that's it. but i've got the solution to that problem (i forgot to put the trailing 's' in my post, but i used it and it did not work) the solution is: perl -p0i -e 's/sub html_base.*//s' *.cgi and it happily removes from everything that starts with html_base to the end of the file. This is wrong. sub html_baseball { better you write perl -p0i -e 's/sub html_base\s*{.*//s' *.cgi it does exactly what i need, and is very fast. -- cu boris Atomkraft, strahlender Glanz ohne Abtrocknen. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
Sorry for my previous post, my answer is below On Thursday 25 April 2002 15:41, Boris Zentner wrote: | Hi, | | Am Donnerstag, 25. April 2002 15:20 hast Du geschrieben: | exact, that's it. | but i've got the solution to that problem (i forgot to put the trailing | 's' in my post, but i used it and it did not work) | the solution is: | perl -p0i -e 's/sub html_base.*//s' *.cgi | | and it happily removes from everything that starts with html_base to the | end of the file. This is wrong. | | sub html_baseball { | | better you write | perl -p0i -e 's/sub html_base\s*{.*//s' *.cgi | | it does exactly what i need, and is very fast. of course you're right, in the case that some functions start with the same name, but this was not the case. so it worked and that problem is over now. thanks for your answer Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
history.back() does not work in IE
Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } This works on Netscape, but not on IE. IE looses all of it's params, while Netscape remembers them. The application needs to work on both browsers, does anyone have an idea ? I searched the web for a difference in syntax, but couldn't find it. Is it IE in combination with Perl ?? Thanks for your help in advance !! Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
I'm not quite sure what you're trying to do with this... but from what you've provided, the regular expression you wrote will only remove text matching sub html_base on a single line -- and not even the newline at the end. The '-pi' switches will grab a single line at a time from the currently open file to compare to the expression. It sounds like you've got a subroutine you're trying to remove from some files: sub html_base { ... } yes? If so, it might make more sense to make a quick-and-dirty perl script that will take the fileglob (*cgi), read one file at a time, and read that entire file into a single string, and then run the regexp you wrote against it, with the following addition: s/sub html_base[\s\S]*//s The trailing 's' will allow the regexp to look over newlines (\n) when matching. --Matthew On Thu, 25 Apr 2002 04:10:58 -0400, Alain wrote: Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi But this command only erase one line at once. And I want to erase all the lines in one time. Is there anybody who can help? Thanks a lot Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: history.back() does not work in IE
On Thursday, April 25, 2002, at 08:17 , David vd Geer Inhuur tbv IPlib wrote: I am writing a CGI-script (using Perl of course! :). is there anything else worth doing it in??? Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } Since you already have a POST method going here, I presume. What you need to do is put a 'hidden field' in that tells you who you were called by Hence you can in essence 'go back' to that function and rebuild a new 'back page' as it were. It would have been nice if IE did that. The other trick I have seen that may help get around the Feature in IE is to put an 'id' tag into the URI that is 'time based' so that each page looks Unique to IE - and hence it will be able to 'go back' to the prior page. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: history.back() does not work in IE
Hi, Looked good, but wasn't effective unfortunetly :( Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; # As I used it frequently Here is where I use it : #--- sub check_input { if (!($icname)) { print tabletrtdYou have to choose an IC-name, else I cannot create a new IC for you/td ${submit}/tr/table; $exit =on; } if (!($icname =~ /^[A-Za-z0-9_]+$/)) { print trtdSorry your IC-name cannot contain special characters/td${submit}/tr; $exit =on; } if (!($feature)) { print trtdYou did not fill in a feature !! /td${submit} tdinput type=submit value=Ignore name=ifeat/td/tr; $exit =on; } if ( $exit eq on ) { print /form/html; exit; } } # End sub check_input # --- And this is the source of my final page with my history.back(); button : head/headbody bgcolor=#99 text=#00 link=#FF vlink=green form method=gettrtdYou did not fill in a feature !! /tdtd input type=submit value=Back name=needm Onclick=javascript:history.back();/td tdinput type=submit value=Ignore name=ifeat/td/tr/form/html I know it's a lot, but thanks for your help in advance !! Regs David -- The javascript function should br written like so: input type=button name=needmoreinfo value=Go back and correct it Onclick=javascript:history.back(); -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: history.back() does not work in IE Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } This works on Netscape, but not on IE. IE looses all of it's params, while Netscape remembers them. The application needs to work on both browsers, does anyone have an idea ? I searched the web for a difference in syntax, but couldn't find it. Is it IE in combination with Perl ?? Thanks for your help in advance !! Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: history.back() does not work in IE
-Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 12:32 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE .. Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; I'm no HTML expert, but aren't type=submit and onclick=javascript:history.back() mutually exclusive? I mean, do you want the button to submit the form, or go back? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: history.back() does not work in IE
I have always just used the history.back action ( e.g., a href=javascript:history.back() ) as part of a hyperlink to return to the previous page, not as a submit action of the form. This seems to work fine in IE, Netscape, and Opera. When you use a submit button, you are either posting data or getting data, that's why it exists. Using a hyperlink reference, you can simply link to the last page instance in your browser's history, which may be static HTML or the results of a CGI call. Worst case scenario is that your browser asks to repost the data and you have to click OK. Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:43 AM To: 'David vd Geer Inhuur tbv IPlib'; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 12:32 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE .. Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; I'm no HTML expert, but aren't type=submit and onclick=javascript:history.back() mutually exclusive? I mean, do you want the button to submit the form, or go back? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: history.back() does not work in IE
Thanks Both Bob and Scot are right !! You can only use it in an a href, not in a submit. I will create my own Back button as an immage now :) Regs David I have always just used the history.back action ( e.g., a href=javascript:history.back() ) as part of a hyperlink to return to the previous page, not as a submit action of the form. This seems to work fine in IE, Netscape, and Opera. When you use a submit button, you are either posting data or getting data, that's why it exists. Using a hyperlink reference, you can simply link to the last page instance in your browser's history, which may be static HTML or the results of a CGI call. Worst case scenario is that your browser asks to repost the data and you have to click OK. Scot Robnett inSite Internet Solutions [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:43 AM To: 'David vd Geer Inhuur tbv IPlib'; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 12:32 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE .. Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; I'm no HTML expert, but aren't type=submit and onclick=javascript:history.back() mutually exclusive? I mean, do you want the button to submit the form, or go back? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Database: 196 - Release Date: 4/17/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: history.back() does not work in IE
If you just wat a 'back' button, you ca just use a 'button' element instead of a submit element: input type=button value=Back name=needm Onclick=history.back(); If you actually do want to submit a form *and* return to previous page in the history, you just need to use javascript to do the submit also: input type=button value=Submit and Go Back name=needm Onclick=document.form.submit();history.back(); The trick is you need to do the 'history.back()' after the 'form.submit()', because the last operation is what ends up in the browser. IE and Netscape aren't consistent about what happens when you use an onClick with a type='submit' -- Netscape does not even seem to do the submit if the onClick navigates away. It sounds like from your followup post that all you want is a back button, so the first example is what you could use if you don't want a link or image. - Original Message - From: Bob Showalter [EMAIL PROTECTED] To: 'David vd Geer Inhuur tbv IPlib' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 12:42 PM Subject: RE: history.back() does not work in IE -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 12:32 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE .. Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; I'm no HTML expert, but aren't type=submit and onclick=javascript:history.back() mutually exclusive? I mean, do you want the button to submit the form, or go back? -- 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: history.back() does not work in IE
Doh! i can't believe I missed it... Change the type to button... It will work then... type=submit causes browsers to run the form action. If you change it to type=button... it will work like hitting the back button on the browser. Sorry, -Mike -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 12:32 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE Hi, Looked good, but wasn't effective unfortunetly :( Here is what I did in the script : $submit = tdinput type=submit value=Back name=\needm\ Onclick=\javascript:history.back();\/td; # As I used it frequently Here is where I use it : #--- sub check_input { if (!($icname)) { print tabletrtdYou have to choose an IC-name, else I cannot create a new IC for you/td ${submit}/tr/table; $exit =on; } if (!($icname =~ /^[A-Za-z0-9_]+$/)) { print trtdSorry your IC-name cannot contain special characters/td${submit}/tr; $exit =on; } if (!($feature)) { print trtdYou did not fill in a feature !! /td${submit} tdinput type=submit value=Ignore name=ifeat/td/tr; $exit =on; } if ( $exit eq on ) { print /form/html; exit; } } # End sub check_input # --- And this is the source of my final page with my history.back(); button : head/headbody bgcolor=#99 text=#00 link=#FF vlink=green form method=gettrtdYou did not fill in a feature !! /tdtd input type=submit value=Back name=needm Onclick=javascript:history.back();/td tdinput type=submit value=Ignore name=ifeat/td/tr/form/html I know it's a lot, but thanks for your help in advance !! Regs David -- The javascript function should br written like so: input type=button name=needmoreinfo value=Go back and correct it Onclick=javascript:history.back(); -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: history.back() does not work in IE Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } This works on Netscape, but not on IE. IE looses all of it's params, while Netscape remembers them. The application needs to work on both browsers, does anyone have an idea ? I searched the web for a difference in syntax, but couldn't find it. Is it IE in combination with Perl ?? Thanks for your help in advance !! Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: history.back() does not work in IE
try input type=Button value=back onclick=history.back() popusers [EMAIL PROTECTED] wrote: Try history.back() On Thu, 25 Apr 2002, David vd Geer Inhuur tbv IPlib wrote: Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } This works on Netscape, but not on IE. IE looses all of it's params, while Netscape remembers them. The application needs to work on both browsers, does anyone have an idea ? I searched the web for a difference in syntax, but couldn't find it. Is it IE in combination with Perl ?? Thanks for your help in advance !! Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Aquello que puedes hacer o sueñas que puedes hacer... Comiénzalo. La audacia tiene genio, poder y magia... Comiénzalo ahora. - Goethe - __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http headers
hi again, i was actually looking for modules that split the following into name/value pairs. the following is a typical request header from a web browser(eg.IE/netscape). more details on what i'm doing: i'm doing a simple proxy server. the web browser sends the request, the server uses sysread() (eg. sysread($client_socket, $buffer, 4096) )to read in the request into $buffer. thus $buffer contains the below string. i need to split it into name/value pairs or any other form which would be easier to process the request. GET http://doramaworks.tripod.com/lyrics/sissel01.html HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* Accept-Language: en-us Cookie: CookieStatus=COOKIE_OK User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461) Host: doramaworks.tripod.com Proxy-Connection: Keep-Alive --- Conan Chai [EMAIL PROTECTED] wrote: hi, are there any perl modules that splits the http request headers into name/value pairs? Conan It Will Come To Us !!! [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = It Will Come To Us !!! [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Messenger - Instant Messaging, Instant Gratification. (Now with new emoticons!) http://messenger.yahoo.com.sg/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help about perl -pi -e
Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi But this command only erase one line at once. And I want to erase all the lines in one time. Is there anybody who can help? Thanks a lot Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FIFO handeling
Hi All, I've got a small problem with a FIFO. Using the following code snippet #!/bin/perl my $fifo=/tmp/tp9100; open(IN,$fifo) || die Can not open $fifo; while(IN) { print $_; } Now if I do something like cat /tmp/tp9100 and pass characters this works. However when I send ^D the script exists. Is there anyway to avoid this and keep the file handel open Rdgs Rus Foster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
On Thu, Apr 25, 2002 at 10:25:18AM +0200, Alain wrote: Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi 2 options: A. perl -p0i -e 's/sub html_base.*//s' *.cgi reads the whole file in one (-0 means $/ = \000), then the '/s' at the end of the regexp treats the whole $_ that now contains the complete file as a *single line*. Problems: -0 only works with text files, since binaries might contain 0-bytes. use -00777 to be absolutely safe, since there's no character 256. Due to the '/s' you can't match on beginning or end of line anymore. B. perl -li -ne '$x = 1 if /^sub_html_base/; print unless $x' *.cgi The '-n' does mostly the same as -p, except it doesn't print. That's up to you, so now you have the option not to print. I usually use the '-l' since I don't need to care for the '\n' when replacing text, but that's not necessary here. Problems: Longer to type and most probably slower. For both versions read 'perldoc perlrun' and look up the details of '-0' and '-n', and eventually '-l'. -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FIFO handeling
On Thu, Apr 25, 2002 at 10:04:38AM +0100, Rus Foster wrote: Hi All, I've got a small problem with a FIFO. Using the following code snippet #!/bin/perl simple but valid code snipped ... Now if I do something like cat /tmp/tp9100 and pass characters this works. However when I send ^D the script exists. Is there anyway to avoid this and keep the file handel open Not when typing into the fifo :-) Create a binary file that contains all possible byte values with the following command: perl -e 'print chr($_) foreach (0 .. 255)' bin.dat Then start your script with myscript fifoed_bin.dat and cat bin.dat /tmp/my_fifo Then 'diff bin.dat fifoed_bin.dat'. There should be no difference. The Ctrl-D character is the End-Of-File command for the input handler of your *shell*, so hitting Ctrl-D tells your shell to close the output filehandle into the fifo and thus your script stops since it gets an appropriate response from it's input filehandle. Try it with the binary data files, it really should work as expected. If you need to keep your program running, wrap all of it in a while (1) { ... } # --- I can't wait for that yadda-yadda-yadda operator in perl 6 :-) block, so you reopen the fifo whenever it gets closed. -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting a Variable to String with \n? -- Perl 6
This evidently is going to be addressed in Perl6 (with respect to here-docs). cf. http://dev.perl.org/perl6/apocalypse/2 Pretty entertaining stuff. Something uncanny about it. Cool to watch a programming language being designed or influence it. ... we won't make the mistake of reintroducing a syntax that drives highlighting editors nuts. We'll try to make different mistakes this time. ... that Perl programmers must learn to write @foo[1] where they used to write $foo[1]. I think most Perl 5 people will be able to get used to this, since many of them found the current syntax a bit weird in the first place. $#foo is gone. If you want the final subscript of an array, and [-1] isn't good enough, use @foo.end instead. Envy the beginners then, who won't have to care something changed. Everybody will be a beginner on points here and there. /g -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
Michael Lamertz wrote: A. perl -p0i -e 's/sub html_base.*//s' *.cgi reads the whole file in one perldoc perlrun [snip] -0[digits] specifies the input record separator (`$/') as an octal number. If there are no digits, the null char acter is the separator. Other switches may precede or follow the digits. For example, if you have a version of find which can print filenames terminated by the null character, you can say this: find . -name '*.orig' -print0 | perl -n0e unlink The special value 00 will cause Perl to slurp files in paragraph mode. The value 0777 will cause Perl to slurp files whole because there is no legal character with that value. (-0 means $/ = \000), \000 is a reference to a numeric literal, \000 is the null character which doesn't reads the whole file in one then the '/s' at the end of the regexp treats the whole $_ that now contains the complete file as a *single line*. Problems: -0 only works with text files, since binaries might contain 0-bytes. use -00777 to be absolutely safe, since there's no character 256. Octal 0777 is not equal to 256. $ perl -le'print 0777' 511 Due to the '/s' you can't match on beginning or end of line anymore. If you use the /m modifier then ^ will match the beginning of a line and $ will match the end of a line. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Net::SNMP module example failing
Hey Ted, My MUA believes you used (X-Mailer not set) to write the following on Wednesday, April 24, 2002 at 9:56:09 PM. TH Hello, TH I'm executing the 1st example (get sysUpTime) in the TH Net::SNMP module at TH http://search.cpan.org/doc/DTOWN/Net-SNMP-4.0.1/lib/Net/SNMP.pm TH The example is failing with the error TH ERROR: Expected OBJECT IDENTIFIER in dotted notation TH this is occurring because the $result is undefined. I copied Example 1 and changed the 'localhost' and 'public' strings to be appropriate, and it worked just fine. my ($session, $error) = Net::SNMP-session( -hostname = shift || 'localhost', #=== Change -community = shift || 'public',#=== Change -port = shift || 161 ); output: sysUpTime for host '10.11.145.1' is 94 days, 17:03:54.95 This was a Cisco switch/router. Does this help? -- [EMAIL PROTECTED] MUA = TB! v1.53d (www.RitLabs.com/The_Bat) Windows NT 5.0.2195 (Service Pack 2) MS-DOS: celebrating ten years of obsolescence -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
XS and Perl version
I am using a XS wrapper with Perl 5.004. I am planning to go for Perl 5.6.1. Do I have to plan modifications within the XS code ? Thanks, Vincent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problems with split
hi, i have a data file test1.txt as follows: 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 .. my code should open test1.txt, read in the data, convert it an print it into test2.txt : open(FILEONE, test1.txt) or die Could not open File: $!\n; open(FILETWO, test2.txt) or die Could not open File: $!\n; while ($line = FILEONE) { ($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split (|, $line); print FILETWO P|,$longitude, |,$latitude,||; } close FILEONE; close FILETWO; the result in rtest2.txt is: P|3|5|| P|3|5|| actually i expect this : P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| hope sb can help me. thank you in advance habi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple greps in if()
Hi anyone have any ideas on how example 2 or 3 below should correctly be written ??? Thanks for any help that can be given if(grep /Handicap|Help/, $source) { this seems to work } if(grep /(Handicap Help)/, $source) { this does not work } ideally I would like multiple grep pairs ie.. if(grep /(Handicap Help) || (Friend Foe)/, $source) { this does not work } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problems with split
hi, try escaping the | split (\|, $line); hope this works sgb. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 6:04 PM Subject: problems with split hi, i have a data file test1.txt as follows: 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 551356835||1|7684940|47534900|0 ... my code should open test1.txt, read in the data, convert it an print it into test2.txt : open(FILEONE, test1.txt) or die Could not open File: $!\n; open(FILETWO, test2.txt) or die Could not open File: $!\n; while ($line = FILEONE) { ($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split (|, $line); print FILETWO P|,$longitude, |,$latitude,||; } close FILEONE; close FILETWO; the result in rtest2.txt is: P|3|5|| P|3|5|| . actually i expect this : P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| . hope sb can help me. thank you in advance habi -- 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: problems with split
On Thu, Apr 25, 2002 at 02:34:55PM +0200, [EMAIL PROTECTED] wrote: hi, i have a data file test1.txt as follows: 551356835||1|7684940|47534900|0 .. my code should open test1.txt, read in the data, convert it an print it into test2.txt : ($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split (|, $line); THAT ^^^ is your problem. -- perldoc -f split -- split /PATTERN/,EXPR,LIMIT split /PATTERN/,EXPR split /PATTERN/ ... -- perldoc -f split -- See the '/' around PATTERN? That means that we're dealing with a regular expression, and '|' is a special char for regexps. Your split says Split at NOTHING OR NOTHING, since that '|' basically means OR. Since NOTHING can't be matched you split after each character. If you write it like split /\|/, $line it'll work. More information can be found in perldoc perlrequick or perldoc perlretut The section you're looking for starts with 'Matching this or that' in both documents. Take a look at 'perldoc -f quotemeta' if you're running into similar problems when using more complex matching and generated search expressions. -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
On Thu, Apr 25, 2002 at 05:02:10AM -0700, John W. Krahn wrote: Michael Lamertz wrote: A. perl -p0i -e 's/sub html_base.*//s' *.cgi reads the whole file in one (-0 means $/ = \000), \000 is a reference to a numeric literal, \000 is the null character which doesn't reads the whole file in one Yepp, that wasn't intended to be a proper perl expression but more kind of symbolic. I used the C notation where \nnn puts raw characters into strings %-) Sorry, that was unclear. -0 only works with text files, since binaries might contain 0-bytes. use -00777 to be absolutely safe, since there's no character 256. Octal 0777 is not equal to 256. $ perl -le'print 0777' 511 Again you're right. That'll teach me to not only type but also think when I post next time @-) Due to the '/s' you can't match on beginning or end of line anymore. If you use the /m modifier then ^ will match the beginning of a line and $ will match the end of a line. Yepp, but this isn't what he needed. He wanted to match up to EOF. I only mentioned it so he was aware of the, hmmm, side effect. -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multiple greps in if()
on Thu, 25 Apr 2002 12:54:53 GMT, [EMAIL PROTECTED] (Steven Massey) wrote: ideally I would like multiple grep pairs ie.. if(grep /(Handicap Help) || (Friend Foe)/, $source) { this does not work } Put the '' outside of the pattern: #! perl -w use strict; my @strings = ( 'Handicap and Help', 'Friend and Foe', 'Handicap and Friend', 'Help and Foe' ); for my $s (@strings) { if (grep { (/Handicap/ /Help/) || (/Friend/ /Foe/) } $s ) { print '$s' passed the test\n; } } -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Solved: sort regex trouble!
hi i finally got it to work. it was very simple ... _if_ you remember that its not td but td align=foo you are trying to match! martin On Wed, Apr 24, 2002 at 11:04:42AM -0400, David Gray wrote: May I suggest: (my $A = $a) =~ s/^trtd(\d+)\/td/$1/; (my $B = $b) =~ s/^trtd(\d+)\/td/$1/; That's not what he's doing. He's doing: my ($A) = $a =~ m{^trtd(\d+)/td}; my ($B) = $b =~ m{^trtd(\d+)/td}; Yours leaves everything after the /td tacked onto the end of $A; mine and his only store the number in $A. Argh, good catch. I usually do that kind of thing like: my $A = $1 if $a =~ m{^trtd(\d+)/td}; But I didn't that time :) Let us know if any of this fixes your problem, Martin... -dave -- 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]
web automation - where to read?
hi im trying to write a scipt that crawls a website. however, with only the documentation from the perl cookbook and some no_good manpages from the LWP modules, im stuck! where can i find som documentation (pref. online) ? or even some examples ? regards martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multiple greps in if()
On Thu, Apr 25, 2002 at 01:54:53PM +0100, [EMAIL PROTECTED] wrote: Hi anyone have any ideas on how example 2 or 3 below should correctly be written ??? Actually your code can be interpreted in different ways. I guess you'll need the following: -- perldoc -f grep -- grep BLOCK LIST grep EXPR,LIST This is similar in spirit to, but not the same as, grep(1) and its relatives. In particular, it is not limited to using regular expressions. Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value consisting of those ele- ments for which the expression evaluated to true. In scalar context, returns the number of times the expression was true. -- perldoc -f grep -- if(grep /Handicap|Help/, $source) { this seems to work Then we'll leave it alone :-) I will however nag about using grep to match on a single string. grep should be used to filter lists of strings. For the single string, just use a normal regexp. if(grep /(Handicap Help)/, $source) { this does not work Hmm, I suppose you want only lines that contain both words regardless of their order? if (grep { /Handicap/ /Help/ } @sources) { ... } Should do what you want. ideally I would like multiple grep pairs ie.. if(grep /(Handicap Help) || (Friend Foe)/, $source) { this does not work Same as above. The BLOCK can be as complex as you wish. if (grep { (/Handicap/ /Help/) || (/Friend/ /Foe/) } @sources) { ... } See 'perldoc -f sort' for similar uses of the BLOCK style of filter functions. -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Parsing a line - part 2
@keys{ qw/P ST U SL D/ } = \( $Proc, $Start, $Url, $Sleep, $Drive ); This is a shortcut for defining the values of a hash -- it creates $keys{P} == $Proc, $keys{ST} == $Start, etc. $keys{P} = \$Proc, $keys{ST} = \$Start, etc. Okay... Fair enough. Maybe I'm missing something, but why in the world would you want to make something a hash of references to scalars when a hash of scalars would work just as well? From the OP's post, the data is: q[P=IcwRcsm D=D: SL=20 ST=d:\icw\rcsm\StartSv.bat Parm1 Parm2 U=http://uslv...]; /(\S+)=(.+?)(?=\s+\S+=|\z)/g will match: (P)=(IcwRcsm)(?= D=) (D)=(D:)(?= SL=) (SL)=(20)(?= ST=) (ST)=(d:\icw\rcsm\StartSv.bat Parm1 Parm2)(?= U=) And finally: (U)=(http://uslv...)(?=\z) The (?=\s+\S+=) pattern ensures that the data captured in $2 has no trailing whitespace. Alright, thanks for that explanation, I see how that would work for every case but the last one - what if there was trailing whitespace after the value for U and before the end of the string? (?=\s+\S+=) seems like it would pick up the trailing whitespace in that case because it needs a non-whitespace character to complete the match for the group. How about: /(\S+)=(.+?)(?=\s+\S+=|\s+|\z)/g To catch trailing whitespace at the end of the line of data? After the code is executed, you'd end up with: $P == 'IcwRcsm D=D:' $SL == '20 ST=d:\icw\rcsm\StartSv.bat' Wrong. Run the code I posted and see for yourself. Yeah, my mistake, I just typed that wrong :) Cheers, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help about perl -pi -e
-Original Message- From: Alain [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 4:25 AM To: [EMAIL PROTECTED] Subject: help about perl -pi -e Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi But this command only erase one line at once. And I want to erase all the lines in one time. Is there anybody who can help? What do you mean by erase all the lines? The command you have written will change all of the matching lines in each file. Do you want to delete all the lines in each file that follow sub html_base[sS]? If so, try this: perl -n -i.bak -e 'print unless /sub html_base[sS]/ .. eof' That prints each line unless it lies between the line containing sub html_base[sS] and the end of the current file. perldoc perlop (search for Range Operators) perldoc -f eof -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help about perl -pi -e
-Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 9:46 AM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: help about perl -pi -e ... Do you want to delete all the lines in each file that follow sub html_base[sS]? If so, try this: perl -n -i.bak -e 'print unless /sub html_base[sS]/ .. eof' Oops, I forgot to put some files on there. Should be: perl -n -i.bak -e 'print unless /sub html_base[sS]/ .. eof' *.cgi or similar. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: web automation - where to read?
im trying to write a scipt that crawls a website. however, with only the documentation from the perl cookbook and some no_good manpages from the LWP modules, im stuck! Would you care to explain what is 'no_good' about the LWP manpages? where can i find som documentation (pref. online) ? Do you know 'The Web Robot Pages' at http://www.robotstxt.org/wc/robots.html? Here you will find a lot of info about all kind of webrobots (or crawlers). If you want more documentation, why not type 'web crawling Perl LWP' in the google.com search box, and find out? Last time I tried it listed about 390 hits. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
On Thursday 25 April 2002 15:52, Bob Showalter wrote: | -Original Message- | From: Bob Showalter [mailto:[EMAIL PROTECTED]] | Sent: Thursday, April 25, 2002 9:46 AM | To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] | Subject: RE: help about perl -pi -e | | ... | | Do you want to delete all the lines in each file | that follow sub html_base[sS]? If so, try this: | | perl -n -i.bak -e 'print unless /sub html_base[sS]/ .. eof' | | Oops, I forgot to put some files on there. Should be: | |perl -n -i.bak -e 'print unless /sub html_base[sS]/ .. eof' *.cgi | | or similar. thanks a lot for helping. someone gave me the solution: perl -p0i -e 's/sub html_base.*//s' *.cgi it did exactly what i wanted: remove all the lines below sub html_base thanks again Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unix to dos; dos to unix...
There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj...
RE: Parsing a line - part 2
How about: /(\S+)=(.+?)(?=\s+\S+=|\s+|\z)/g To catch trailing whitespace at the end of the line of data? Actually, I meant: /(\S+)=(.+?)(?=\s+\S+=|\s*\z)/g ^^^ -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unix to dos; dos to unix...
unix2dos and dos2unix is what you are looking for. I tried with perl also and was unsucessful also for same reason. -Original Message- From: Ron Powell [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 10:08 AM To: '[EMAIL PROTECTED]' Subject: Unix to dos; dos to unix... There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj... The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unix to dos; dos to unix...
-Original Message- From: Ron Powell [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 10:08 AM To: '[EMAIL PROTECTED]' Subject: Unix to dos; dos to unix... There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? tr/// doesn't do what you mean it to be doing here. Read the docs again on tr///. Also look at s///. Both found in: perldoc perlop -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
On Thursday 25 April 2002 15:41, you wrote: | Hi, | | Am Donnerstag, 25. April 2002 15:20 hast Du geschrieben: | exact, that's it. | but i've got the solution to that problem (i forgot to put the trailing | 's' in my post, but i used it and it did not work) | the solution is: | perl -p0i -e 's/sub html_base.*//s' *.cgi | | and it happily removes from everything that starts with html_base to the | end of the file. This is wrong. | | sub html_baseball { | | better you write | perl -p0i -e 's/sub html_base\s*{.*//s' *.cgi | | it does exactly what i need, and is very fast. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unix to dos; dos to unix...
hi Ron, another unix command is flip. i've written a small perl script that converts a dos file to a unix one. as you can see, i've just substituted the \r\n with a \n. the reverse can easily be done. this is a working example. it's not fast, but workable. i'd welcome any suggestions. hth, -tir #!/usr/bin/perl -w use strict; use POSIX; # Convert a file from a DOS to a UNIX format. sub help { printf Converts a DOS formatted file to UNIX format. Useful for converting data from Prowess, or any other Windows database, for use in UNIX software, like SAS. Instructions: Do chmod 500 $0 Restrictions: No binary files, no file above 50 MB. Usage: $0 filename\n; exit 1; } help if ($#ARGV == -1); my($TMPFILE) = /tmp/; my(@Files) = @ARGV; my(@R); foreach (@Files){ my($File) = $_; if ( -B $File){ printf $File is a binary file. Could get damaged. Not processed.\n; next; } open(TMP,$TMPFILE) || die could not open TMPFILE: $!; open(IN,$File) || die could not open $File: $!; while(IN){ my($line) = $_; $line =~ s/\r\n$/\n/; print TMP $line; } close(IN); close(TMP); system (mv $TMPFILE $File); printf STDERR $File done.\n; } exit; On Thu, 25 Apr 2002, Ron Powell wrote: There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj... -- Tirthankar, IGIDR. +91-22-8400919 x275 (r), x593(o), x542(CFL). http://www.igidr.ac.in/~tir ACADEME, n. An ancient school where morality and philosophy were taught. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unix to dos; dos to unix...
Ron Powell wrote: There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj... If your file is already in the DOS file format (each line ends with CR and LF), your script will replace the LF with CR and LF; which means your lines will end with CR + CR + LF. And, that's why they had inappropriate line breaks. -- Ahmed Moustafa http://pobox.com/~amoustafa -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unix to dos; dos to unix...
on Thu, 25 Apr 2002 14:08:12 GMT, [EMAIL PROTECTED] (Ron Powell) wrote: The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here You need 'binmode': perldoc -f binmode I'm not asking for the answer per se, but perhaps a pointer? See http://www.perl.com/language/ppt/src/nlcvt/index.html for a Perl implementation of unix2dos (and many others). -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: web automation - where to read?
On Thu, Apr 25, 2002 at 01:57:07PM -, Felix Geerinckx wrote: im trying to write a scipt that crawls a website. however, with only the documentation from the perl cookbook and some no_good manpages from the LWP modules, im stuck! Would you care to explain what is 'no_good' about the LWP manpages? no good for beginners. where can i find som documentation (pref. online) ? Do you know 'The Web Robot Pages' at thanks, ill have a look :) http://www.robotstxt.org/wc/robots.html? Here you will find a lot of info about all kind of webrobots (or crawlers). If you want more documentation, why not type 'web crawling Perl LWP' in the google.com search box, and find out? Last time I tried it listed about 390 hits. yes, but here i was hoping for some recommendated reading ... -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: web automation - where to read?
Martin A. Hansen [[EMAIL PROTECTED]] quoth: *hi * *im trying to write a scipt that crawls a website. however, with only the documentation from the perl cookbook and some no_good manpages from the LWP modules, im stuck! * *where can i find som documentation (pref. online) ? * *or even some examples ? I don't know if any examples are online as robots can be a dangerous menace when done poorly or incorrectly but you'll want to have a look at the RobotUA module in the LWP distribution, http://search.cpan.org/search?dist=libwww-perl Also the book Perl and LWP, http://www.amazon.com/exec/obidos/ASIN/0596001789, should be out soon which has a whole chapter on spiders and includes a working example. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Advice and suggestions needed for difftree script
***Okay this is the situation: I have a main directory tree which has similar directories branch from the trunk but links back to other branches or the main tree. I want to know what files are different between two branches or a branch and the tree. ***What I have so far: I have written a perlscript to do this already, but I want to make it smarter and faster. I am using File::Find to recurse the first tree. Foreach file: stat file for device number, and inode number ($dev1, $inode1) it checks if a file by the same name/path exists in the second tree (using -f $file) If it exists... stat second file (using stat _ since I did a -f on it already) for device number, and inode number ($dev2, $inode2) if $dev1 != $dev2 and $inode1 != $inode2 do a qx/diff -h -w $file1 and $file2/ and if something is returned there is a difference. else one or both files are linked to the same file so no difference. If it doesn't exist... oh well store missing files in an array print later. Recurse second tree just looking for files that are missing from the first tree. ***Questions: Good algorithm? or is there something better? you can just correct above. Is there a way just to look for diff (ignoring whitespace) in the file better than using qx/diff -w -h/? Nikola Janceski I feel like an outsider... on the inside. -- Nicky J. from da' Bronx The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to find module dependencies
sharan [[EMAIL PROTECTED]] quoth: * *How to find the module dependencies? I have used many modules in my tool *development, and i given all the modules used with my tool package. But when *the tool is installed on Windows at the customer places they are getting *problems as some of the module use some depenedent modules. Is there any way *to find out what are all the modules that are dependent. http://language.perl.com/misc/pmtools-1.00.tar.gz has a number of module tools you might find useful or http://search.cpan.org/search?dist=Module-Dependency which is pretty darn cool. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Advice and suggestions needed for difftree script
Oops... if $dev1 != $dev2 and $inode1 != $inode2 should be: if not $dev1 == $dev2 $inode1 == $inode2 -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 10:33 AM To: Beginners (E-mail) Subject: Advice and suggestions needed for difftree script ***Okay this is the situation: I have a main directory tree which has similar directories branch from the trunk but links back to other branches or the main tree. I want to know what files are different between two branches or a branch and the tree. ***What I have so far: I have written a perlscript to do this already, but I want to make it smarter and faster. I am using File::Find to recurse the first tree. Foreach file: stat file for device number, and inode number ($dev1, $inode1) it checks if a file by the same name/path exists in the second tree (using -f $file) If it exists... stat second file (using stat _ since I did a -f on it already) for device number, and inode number ($dev2, $inode2) if $dev1 != $dev2 and $inode1 != $inode2 do a qx/diff -h -w $file1 and $file2/ and if something is returned there is a difference. else one or both files are linked to the same file so no difference. If it doesn't exist... oh well store missing files in an array print later. Recurse second tree just looking for files that are missing from the first tree. ***Questions: Good algorithm? or is there something better? you can just correct above. Is there a way just to look for diff (ignoring whitespace) in the file better than using qx/diff -w -h/? Nikola Janceski I feel like an outsider... on the inside. -- Nicky J. from da' Bronx -- -- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to find module dependencies
Michael Lamertz [[EMAIL PROTECTED]] quoth: * *PS: I've made the mistake to install quite a handful of modules via *Debian packages instead of CPAN and they are *NOT* installed in *'site_perl' but somewhere in '/usr/local/share' and are also *NOT* *registered in perllocal. That's *NOT* funny, Debians! Do they turn up with CPAN.pm or ExtUtils::Installed? Not being in perllocal isn't that awful since it's, more or less, an internal accounting file for Perl that is hard to manage if you remove the packages and leave the perllocal intact. e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unix to dos; dos to unix...
Hi There, Just a small addition on the remarks : I don't know if you realy want this to automate, but vi can do it as well. Just type : :1,$s/[Ctrl + v] [Ctrl + m]//g The [Ctrl + v] makes you able to type in an escape character. Most of all the [Ctrl + m] (^M) is bothering you. :) I know, I know. It's beginners@perl and not beginners@unix. Just want to help. Good Luck !! Regs David - There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj... - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help about perl -pi -e
I'm not quite sure what you're trying to do with this... but from what you've provided, the regular expression you wrote will only remove text matching sub html_base on a single line -- and not even the newline at the end. The '-pi' switches will grab a single line at a time from the currently open file to compare to the expression. It sounds like you've got a subroutine you're trying to remove from some files: sub html_base { ... } yes? If so, it might make more sense to make a quick-and-dirty perl script that will take the fileglob (*cgi), read one file at a time, and read that entire file into a single string, and then run the regexp you wrote against it, with the following addition: s/sub html_base[\s\S]*//s The trailing 's' will allow the regexp to look over newlines (\n) when matching. --Matthew On Thu, 25 Apr 2002 04:10:58 -0400, Alain wrote: Hello all, I've the following problem: I need to erase about 150 lines (always the same lines) at the end of a serie of files. What I have done in the shell is: #perl -pi -e s/sub html_base[\s\S]*// *cgi But this command only erase one line at once. And I want to erase all the lines in one time. Is there anybody who can help? Thanks a lot Alain Scieur -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to find module dependencies
On Thu, Apr 25, 2002 at 09:36:16AM -0500, Elaine -HFB- Ashton wrote: Michael Lamertz [[EMAIL PROTECTED]] quoth: * *PS: I've made the mistake to install quite a handful of modules via *Debian packages instead of CPAN and they are *NOT* installed in *'site_perl' but somewhere in '/usr/local/share' and are also *NOT* *registered in perllocal. That's *NOT* funny, Debians! Do they turn up with CPAN.pm or ExtUtils::Installed? Nope: -- snip -- nijushiho:~$ perl -MExtUtils::Installed -le 'print foreach ExtUtils::Installed-new()-modules()' Apache::XML2Template Data::FormValidator Data::FormValidator::Tutorial Perl Regexp::Common Term::ANSIColor nijushiho:~$ -- snip -- but -- snip -- nijushiho:~$ perldoc Template Template(3)User Contributed Perl DocumentationTemplate(3) NAME Template - Front-end module to the Template Toolkit SYNOPSIS use Template; ... -- snip -- It's definitely *not* in the list ExtUtils knows about. It's no problem since I know what I installed and at least Debian offers a consistent naming scheme. dpkg -l 'lib*-perl' does the job, but I still consider that behaviour unfriendly and non-standard. Just why couldn't they use site-perl?!? Sigh, I'm ranting again... -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Improving the Quality of Our Beginners was Re: Write permissions and other rights
Sorry Michael. I was not clear there. I was not saying that *you* flamed *me*. That did not happen. I was speaking in a general sense to the flamers on this board. Please accept my apology for creating this misconception. As for Unix file permissions, have a look at the cover of Learning Perl. At the top of mine it says UNIX Programming. I do agree that the mysteries of the *NIX OS should not be covered in a list like this, but some issues (like having to set the proper permissions to enable a script to run and security concerns as regards .htaccess/.htpasswd files and proper directory formation) do need to be discussed with on a beginner's list. If nothing else, to provide that beginner with a springboard to find the more in depth documentation he/she will need to be an effective programmer. However, the point of this response is, again, to apologize to you, Michael, for inadvertently implying that you had flamed me and I had words for you. This was not the case at all. Peace In Christ - Ron Goral [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -Original Message- From: Michael Lamertz [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 5:52 AM To: Ron Goral Cc: Michael Lamertz Subject: Re: Improving the Quality of Our Beginners was Re: Write permissions and other rights Aye, Sorry, I'll reverse your quotes, because the following sentence struck me: If my questions are too remedial, then ignore them. But don't open fire on me simply because I've asked a question. Where have I flamed you? My response was completely *pro* your request. %-) Let me quote the two last paragraphs of my own mail to you: -- snip -- However, an appropriate answer on *this* *list* should have been a pointer to at least one or two introductory Unix books and perhaps some webpages (and although I dare to post this long rand I'm actually not able to provide you with any one, since I never read one %-) It's always hard to bootstrap oneself on a new platform, to get a grip on the system and a feeling for where to look for more information... Keep going, and keep on posting stuff here, you'll see, it'll get better, and you most probably wont get flamed by a kid with too much thestosterone everyday... -- snip -- The only thing I didn't agree with was that topics like Unix file permissions should be covered in the perl documentation. I explained my reasons for that at length, and I think they stand. But then again I agreed with you that the request *IS* valid for the beginners list, and that somebody who had good information on the topic should have replied to it instead of some zealot flaming around. We're completely in line I think. On Wed, Apr 24, 2002 at 08:28:08PM -0500, Ron Goral wrote: Well, I didn't get flamed, another potential coder did. For the sake of brevity, the point of my message was simply this: A beginner's list is for beginners. Not folks with an intermediate knowledge of the subject. It is for those of us who do not know what we are doing. This is the place we should be able to go and ask the stupid questions and hope for an answer. Yepp, I completely agree, although I'm not for cutting out the intermediate level questions to another list. Where will you draw the line between a beginner and an intermediate? If you fragment the lists you also fragment the community and eventually the more advanced users will stay away from the absolute-beginners list since they don't find it interesting or challenging enough. It is an incredible bonus that more knowledgeable coders actually take the time to patiently answer our questions. But don't you underestimate the value that these questions have for us who answer. This is both give and take! I'm programming perl since about 1994 or 1995, but *explaining* stuff to other folks makes me think not twice but trice about topics that I thought I had fully grasped years ago, and quite often I get a new insight by that process. I like that, and that's why I lurk on the list! But when the knowledgeable can no longer be patient, then they need to move on to a place where they are behind the curve and leave us alone. Agreed, and in that next sentence... I'm not on this list so that some kid can look down his nose at me. ...You describe exactly what kind of person we're talking about here. Don't take these kids serious, although they can be annoying some times, they tend to get bored and go away, but there will always be others who answer appropriately. Well, I'm getting long winded again and ya'll have better things to do than listen to me rant...again. Actually, yes and no. I may be busy, but this topic is interesting and important, so keep on talking ... -- If we fail, we will lose the war. Michael Lamertz| +49 221
starting a java bytecode off a server via html code
Hello, Is there a way one could startup a server-side Java applet without logging into the server?. So say I have a Java bytecode sitting at: http://www.rsma.frb.gov/fof/cgi-bin/JAVA/DigitalClock.class; How do I start this via an html file? Here is my html code which does not work - HTML HEAD TITLEHello Testing/TITLE /HEADBODY PThe java applet says: APPLET CODE=http://www.rsma.frb.gov/fof/cgi-bin/JAVA/DigitalClock.class; Width=400 HEIGHT=60/APPLET /BODY /HTML -- Java code: (a digital clock) (See attached file: DigitalClock.java) __ William DigitalClock.java Description: Binary data -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
About Asking Stupid Questions Myself Included.
Although this made me laugh it has some relevance to how questions should/shouldn't be asked. http://perl.plover.com/Questions.html Harry * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Improving the Quality of Our Beginners was Re: Write permissions and other rights
On Thu, Apr 25, 2002 at 10:45:31AM -0500, Ron Goral wrote: Sorry Michael. I was not clear there. I was not saying that *you* flamed *me*. That did not happen. I was speaking in a general sense to the flamers on this board. Please accept my apology for creating this misconception. No, no, no! No need to apologize. I only replied since I was afraid I didn't make myself clear and sounded as if I attacked you %-) As for Unix file permissions, have a look at the cover of Learning Perl. At the top of mine it says UNIX Programming. Aha, sorry, never read that one, but I agree that with that sentence in the title these topics should be covered, either as a standalone chapter or near the corresponding functions. I do agree that the mysteries of the *NIX OS should not be covered in a list like this, but some issues Oink, objection your honor. One's mystery is the other's daily work. I've written quite my share of daemons and server programs, but that might be black magick for others, so even if it's way over the head of a complete beginner, for the average Unix-Joe this is still basic knowledge and is IMO appropriate to be explained here too. A perl beginner will post this kind of questions here, since he cannot decide if this is an advanced topic or a standard problem, so things like that should be posted here as long as they relate to the person's perl code. However, the point of this response is, again, to apologize to you, Michael, for inadvertently implying that you had flamed me and I had words for you. This was not the case at all. Again, no reason for this! :-) I think we're about as much in sync concerning the topic of this thread as we can be. Take care - Mike -- If we fail, we will lose the war. Michael Lamertz| +49 221 445420 / +49 171 6900 310 Nordstr. 49| [EMAIL PROTECTED] 50733 Cologne | http://www.lamertz.net Germany| http://www.perl-ronin.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fwd: problems with split
I think Stefan provided an Elegant query - since he had a good sample of data, and a specific test case of code for use to look at. while ($line = FILEONE) { ($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split (|, $line); that regular expression interpolates to /''|''/ which if you had done by hand with say split(/''|''/, $line); # with -w and strict would have noted the use of unitialized value in concatination the '|' also gets to the same logical space, hence what you have is a split('',$line) and you wind up catching the fourth and fifth characters in the line print FILETWO P|,$longitude, |,$latitude,||; } I presume you wanted output like: P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| P|7684940|47534900|| hence wanted to be reminded of { drieux Gets Orthodox } a) use -w and strict b) | is a reserved token c) foo - allows for interpolation of foo between the quotes hence split(/\|/, $line); # my prefered or split('\|', $line); depending upon your orthodoxy while (my $line = FILEONE) { my ($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split (|, $line); print FILETWO P|,$longitude, |,$latitude,||; } ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
authentication and user management
i am building a perl/cookie members system for my site using SSI to check if a cookie is present (set at login), if not, to redirect to an error page. This is my plan: 1. login page. check that the username and password match that in the database. 2. if yes then set a cookie with the users's ID from the database 3. when the restricted page is called then the script attempts to retrieve the cookie. How do i say if ($cookievalue eq || cookie does not exist){ redirect to an error page } I know how to retrieve a cookie and redirect but how do i get the script to tell the difference between an incorrect cookie value (one that doesn't match any IDs in the database) and no cookie at all. If anyone can suggest anything about the cookies or any tips on this subject in general please help Thanks in Advance -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CPAN?
This is the beginners list, right? I heard that you could find code for almost anything at CPAN. How do you go about this? For example, say I want to recurse through a directory and all subdirectories creating an index text file in each directory containing a list of the text files in that directory. Can CPAN help with that task? TIA. - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CPAN?
You should be able to use the standard perl to accomplish this task. Look for File::Find with in your doc and this should be a starting place for you. If you want you can go to CPAN and there are a number of different ways to search and go from there. Wags ;) -Original Message- From: Bryan R Harris [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 10:41 To: Perl Beginners Subject: CPAN? This is the beginners list, right? I heard that you could find code for almost anything at CPAN. How do you go about this? For example, say I want to recurse through a directory and all subdirectories creating an index text file in each directory containing a list of the text files in that directory. Can CPAN help with that task? TIA. - B -- 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: CPAN?
On Thursday, April 25, 2002, at 10:41 , Bryan R Harris wrote: you heard right: I heard that you could find code for almost anything at CPAN. How do you go about this? http://www.cpan.org but I have the search book marked: http://search.cpan.org/ where I rummage around for known modules... For example, say I want to recurse through a directory and all subdirectories creating an index text file in each directory containing a list of the text files in that directory. Can CPAN help with that task? yes, File::Find, an illustration of it's use: http://www.wetware.com/drieux/CS/lang/Perl/Beginners/findModules.txt what you need to sort out is how to write the 'callback' function eg: sub wants { ... } to do the majik you want it to do ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN?
On 04/25, drieux said something like: On Thursday, April 25, 2002, at 10:41 , Bryan R Harris wrote: you heard right: I heard that you could find code for almost anything at CPAN. How do you go about this? what you need to sort out is how to write the 'callback' function eg: sub wants { ... } to do the majik you want it to do The thing to do here might be to play with find2perl and look at its output given various options. Try executing find2perl / -name *.txt -print The exec option makes things a little hairy, tho... -- Shawn Leas [EMAIL PROTECTED] I was in the first submarine. Instead of a periscope, they had a kaleidoscope. We're surrounded. -- Stephen Wright -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: authentication and user management
On Thursday, April 25, 2002, at 10:58 AM, Mat Harrison wrote: i am building a perl/cookie members system for my site using SSI to check if a cookie is present (set at login), if not, to redirect to an error page. This is my plan: 1. login page. check that the username and password match that in the database. 2. if yes then set a cookie with the users's ID from the database 3. when the restricted page is called then the script attempts to retrieve the cookie. How do i say if ($cookievalue eq || cookie does not exist){ redirect to an error page } I know how to retrieve a cookie and redirect but how do i get the script to tell the difference between an incorrect cookie value (one that doesn't match any IDs in the database) and no cookie at all. when you ask for a cookie for a given key, if it doesn't exist it will be empty. as in code above. I don't think you want to worry about the cookie existing with an empty value. That wouldn't be a valid login. Then if the cookie exists, you could do a db query to make sure the id is actually in the database. If anyone can suggest anything about the cookies or any tips on this subject in general please help Thanks in Advance -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unix to dos; dos to unix...
In emacs: Esc-% C-q C-j ret C-q C-m C-q C-j ret! Where ret is either ENTER or RETURN. I just wanted to help also Joe -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:03 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Unix to dos; dos to unix... Hi There, Just a small addition on the remarks : I don't know if you realy want this to automate, but vi can do it as well. Just type : :1,$s/[Ctrl + v] [Ctrl + m]//g The [Ctrl + v] makes you able to type in an escape character. Most of all the [Ctrl + m] (^M) is bothering you. :) I know, I know. It's beginners@perl and not beginners@unix. Just want to help. Good Luck !! Regs David - There is a utility out there that will convert unix-style end-of-lines (LF) to dos-style (CR/LF)... Just for giggles, I'm trying to write a perl script to do this... Here's what I've tried... while (INFILE) { $line = $_; $line=~tr/\012/\015\012/; print OUTFILE ($line\n); } The problem is that the output, when viewed with notepad, contains inappropriate line breaks... The same input file, when converted using the unix utility unix2dos, converts properly. This leads me to believe that I'm missing something obvious here I'm not asking for the answer per se, but perhaps a pointer? -- Ron Powell Senior IT Analyst Network Administrator gomembers, Inc. (Baltimore Office) [EMAIL PROTECTED] 410-494-1600 x4058 ...OLE_Obj... - -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: setruid?
I am very new to Perl and to computer programming in general, but have been amazed at all the cool stuff that it can do. Recently I've been working on a program to run loops of S-plus scripts. I can get the program to run 1 s-plus batch script but when it attempts to run multiple scripts in loops I get a message that says: Hang on... did I miss something... what exactly is a S-plus script? Maybe you should allow for the I've never heard program X problem by providing a link. I'm sorry, but I have no idea what it is, but on this occasion google helped: http://www.google.com/search?hl=enq=%2B%22S-plus%22 Now, it looks too complicated to approach it from a Lets see how it works prespective - so we move onto the error message. setruid( ) not implemented at sdos.pl lone 10. I'm not sure what this means The script is broken hearted as some vital OS feature (?) is missing. Now lets try and find the cause of the pain. If I'm not mistaken, you should ask them to fix the typo too. and I couldn't find it in any of the Perl books that I have. perldoc perl perldoc -f open gets you there faster! Okay, not book replacements but they really help. Neither my unix manpages nor perl's documentation, so it's back to google for a last ditch effort: http://www.google.com/search?hl=enq=%2Bsetruid and you'll notice that it is a Unix program/function... I'm running ActivePerl 5.6 on a Windows 98 system. and that's probably the problem. Is S-PLUS a Perl program? Check the supported platforms for the version you have, it appears to be a language with multiple implementations. You need a Windows one, or learn Unix too by reinstalling your box without M$ Windoze. Anyway, find out if it's a Perl program first! I think it isn't, as not even the 5.6 series implements that command - so it's the binary that is falling over. Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Debugging and 'uninitialized value in concatenation' question
Judging from the subject lines coming across the list today, I think I'm gonna toss this question out there and then duck and cover... :-) I have 2 actual questions. I'll try to be as specific as possible.. :-) Question #1. When I'm writing code, I want to be able to view as much output as possible so I can trace through everything and ensure that it is, indeed, running correctly. I've gone as far as writing my own debug module that uses levels and outputs everything in color. (Term::ANSIColor is a lot of fun to play with)... One major side effect of this is that my code will begin to run slower due to all of the debugging... So, the obvious answer is to turn off the debugging. However, even with my magic debug off switch (see below for a better explanation), the calls to the debug routines are still being made. Is there any sort of #IFDEF that can be done in perl, or do I actually have to comment out (or remove) each call? My magic debug off switch is nothing more than a simple if/then statement. It works on the principle that if $IDebugLevel is a positive integer greater than 0, then I want to debug. Question #2. Relating to the debugging, there are several instances where I have variables that are only defined based on the definition of other variables that exist elsewhere. Kind of like : sub dummy { if ($a == 10) { my $b = 0; } } $b is a local variable, so whenever the subroutine is exited, $b vanishes into the ether. The problem is that I have $b in several debug statements because I want to see it when it's used, but I don't want to have to create a huge if/then structure to determine what variables are being used. So, the general question becomes, how should variables like this be handled? Should I be initializing them every iteration even if they go unused, or should I be using some sort of defined() statement? What is the proper way to handle this in perl? If this was C, I would have to say that the variables are declared each time... I'm just curious if there's a better way to handle this in perl... TIA, --- Jason H. Frisvold Senior ATM Engineer Engineering Dept. Penteledata CCNA Certified - CSCO10151622 [EMAIL PROTECTED] --- I love deadlines. I especially like the whooshing sound they make as they go flying by. -- Douglas Adams [1952-2001]
Re: Net::SNMP module example failing
Tim, Thanks for replying. The error occurred after I did the same thing you did. I found out I'm running the 3.6 version of the module. I trying to get the 4.0.1 via CPAN. I'll let you know what happens. Thanks again Ted --- Tim Musson [EMAIL PROTECTED] wrote: Hey Ted, My MUA believes you used (X-Mailer not set) to write the following on Wednesday, April 24, 2002 at 9:56:09 PM. TH Hello, TH I'm executing the 1st example (get sysUpTime) in the TH Net::SNMP module at TH http://search.cpan.org/doc/DTOWN/Net-SNMP-4.0.1/lib/Net/SNMP.pm TH The example is failing with the error TH ERROR: Expected OBJECT IDENTIFIER in dotted notation TH this is occurring because the $result is undefined. I copied Example 1 and changed the 'localhost' and 'public' strings to be appropriate, and it worked just fine. my ($session, $error) = Net::SNMP-session( -hostname = shift || 'localhost', #=== Change -community = shift || 'public', #=== Change -port = shift || 161 ); output: sysUpTime for host '10.11.145.1' is 94 days, 17:03:54.95 This was a Cisco switch/router. Does this help? -- [EMAIL PROTECTED] MUA = TB! v1.53d (www.RitLabs.com/The_Bat) Windows NT 5.0.2195 (Service Pack 2) MS-DOS: celebrating ten years of obsolescence -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: authentication and user management
On Thursday, April 25, 2002, at 11:57 AM, Mat Harrison wrote: what about some clever person (such as the people on this list) faking the cookie? now, you are talking about the general issue of authorization. a fake cookie would have to know a valid user id. this might not to be too difficult to find. That is why i use an encrypted value of the password in a cookie for checking against. That would be a little harder to find out unless a hacker had access to a valid user's cookies. There is only so much you can do. Makes it hard to fake, but not impossible. There is no absolute guarantee. -Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 7:26 PM To: [EMAIL PROTECTED] Subject: Re: authentication and user management On Thursday, April 25, 2002, at 10:58 AM, Mat Harrison wrote: i am building a perl/cookie members system for my site using SSI to check if a cookie is present (set at login), if not, to redirect to an error page. This is my plan: 1. login page. check that the username and password match that in the database. 2. if yes then set a cookie with the users's ID from the database 3. when the restricted page is called then the script attempts to retrieve the cookie. How do i say if ($cookievalue eq || cookie does not exist){ redirect to an error page } I know how to retrieve a cookie and redirect but how do i get the script to tell the difference between an incorrect cookie value (one that doesn't match any IDs in the database) and no cookie at all. when you ask for a cookie for a given key, if it doesn't exist it will be empty. as in code above. I don't think you want to worry about the cookie existing with an empty value. That wouldn't be a valid login. Then if the cookie exists, you could do a db query to make sure the id is actually in the database. If anyone can suggest anything about the cookies or any tips on this subject in general please help Thanks in Advance -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- 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]
Thanks - Re: multiple greps in if()
Excellent thanks felix and michael. Felix Geerinckx [EMAIL PROTECTED] on 04/25/2002 02:12:17 PM To: [EMAIL PROTECTED] cc: Subject: Re: multiple greps in if() on Thu, 25 Apr 2002 12:54:53 GMT, [EMAIL PROTECTED] (Steven Massey) wrote: ideally I would like multiple grep pairs ie.. if(grep /(Handicap Help) || (Friend Foe)/, $source) { this does not work } Put the '' outside of the pattern: #! perl -w use strict; my @strings = ( 'Handicap and Help', 'Friend and Foe', 'Handicap and Friend', 'Help and Foe' ); for my $s (@strings) { if (grep { (/Handicap/ /Help/) || (/Friend/ /Foe/) } $s ) { print '$s' passed the test\n; } } -- felix -- 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: authentication and user management
On Thursday, April 25, 2002, at 12:15 PM, Mat Harrison wrote: also, what is the best way to include the cookie-checker in the restricted pages, ExecCGI or IncludeVirtual? i use CGI::Cookie in a package of my subroutines. I put 'use utils;' and call the checking subroutine at start of each of my cgi files. -Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 7:26 PM To: [EMAIL PROTECTED] Subject: Re: authentication and user management On Thursday, April 25, 2002, at 10:58 AM, Mat Harrison wrote: i am building a perl/cookie members system for my site using SSI to check if a cookie is present (set at login), if not, to redirect to an error page. This is my plan: 1. login page. check that the username and password match that in the database. 2. if yes then set a cookie with the users's ID from the database 3. when the restricted page is called then the script attempts to retrieve the cookie. How do i say if ($cookievalue eq || cookie does not exist){ redirect to an error page } I know how to retrieve a cookie and redirect but how do i get the script to tell the difference between an incorrect cookie value (one that doesn't match any IDs in the database) and no cookie at all. when you ask for a cookie for a given key, if it doesn't exist it will be empty. as in code above. I don't think you want to worry about the cookie existing with an empty value. That wouldn't be a valid login. Then if the cookie exists, you could do a db query to make sure the id is actually in the database. If anyone can suggest anything about the cookies or any tips on this subject in general please help Thanks in Advance -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- 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: Debugging and 'uninitialized value in concatenation' question
on Thu, 25 Apr 2002 18:49:16 GMT, Jason Frisvold wrote: Question #1. [...] One major side effect of this is that my code will begin to run slower due to all of the debugging... See Sean M. Burke's Constants in Perl article in The Perl Journal, which is available online. Especially the section 'Optimizing with use constant DEBUG = 0' might be of interest to you: http://www.samag.com/documents/s=1337/sam05050002/tpj0505-0002.htm -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Debugging and 'uninitialized value in concatenation' question
From: Jason Frisvold [EMAIL PROTECTED] Judging from the subject lines coming across the list today, I think I'm gonna toss this question out there and then duck and cover... :-) We do not shoot at people here. Even if they do provide the missile address. ;-) Question #1. When I'm writing code, I want to be able to view as much output as possible so I can trace through everything and ensure that it is, indeed, running correctly. I've gone as far as writing my own debug module that uses levels and outputs everything in color. (Term::ANSIColor is a lot of fun to play with)... One major side effect of this is that my code will begin to run slower due to all of the debugging... So, the obvious answer is to turn off the debugging. However, even with my magic debug off switch (see below for a better explanation), the calls to the debug routines are still being made. Is there any sort of #IFDEF that can be done in perl, or do I actually have to comment out (or remove) each call? My magic debug off switch is nothing more than a simple if/then statement. It works on the principle that if $IDebugLevel is a positive integer greater than 0, then I want to debug. You may mark them somehow and then process your script with something that'll comment them out or strip them entirely. Like http://Jenda.Krynicky.cz/perl/mversion.pl.txt Question #2. Relating to the debugging, there are several instances where I have variables that are only defined based on the definition of other variables that exist elsewhere. Kind of like : sub dummy { if ($a == 10) { my $b = 0; } } $b is a local variable, so whenever the subroutine is exited, $b vanishes into the ether. In this case the difference is not visible, but still ... please keep in mind that the scope of a variable is a block, not a subroutine! So sub foo { if (1 2) { my $x = 1; } print \$x=$x\n; } foo(); will NOT print $x=1 I hope you DO use strict; The problem is that I have $b in several debug statements because I want to see it when it's used, but I don't want to have to create a huge if/then structure to determine what variables are being used. No you cannot acces a lexical variable (declared with my()) outside its scope. The only kind-of exception are closures ... subroutines defines inside the variable's scope and thus able to access it later. But that's not what you want. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pinging
I need some help I wrote a perl script which runs on win NT and pings the other server to ensure its availability in the network In case if ping fails it responds with email and page If I need to ping a specific port on that server, how I can accomplish that I can check that port thru a url in the intranet using the browser Is it possible to check for port availability by using url thru perl script if not thru command line Any help will be great Thanks in advance junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pinging
You can't 'ping a specific port' ping is an IP tool, and ports do not show up until the TCP/UDP level of your seven layer dip. Do some research on ICMP for more info. If you want to know if a service that uses a specific port is responding, you will have to make some valid request using whatever protocol is operating on that port and determine if you received an appropriate response. Probably you are talking about protocols that run on TCP/IP, and you might want to use LWP::Socket for this. - Original Message - From: Najamuddin, Junaid [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 25, 2002 4:32 PM Subject: Pinging I need some help I wrote a perl script which runs on win NT and pings the other server to ensure its availability in the network In case if ping fails it responds with email and page If I need to ping a specific port on that server, how I can accomplish that I can check that port thru a url in the intranet using the browser Is it possible to check for port availability by using url thru perl script if not thru command line Any help will be great Thanks in advance junaid -- 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: Debugging and 'uninitialized value in concatenation' question
Ok, shoot me now... I tried to provide an example and I blew it.. *grin* I realize that the locals are block scope.. I know what I meant, just didn't say it.. :) I understand that you cannot access a local variable outside it's scope.. Hrm.. ok, try this : sub dummy { my $a; if ($b == 1) { $a = 2; } print $a\n; } Now.. If $b is 1, then $a gets set to 2 and everything is great. However, if not, $a stays unintialized (which I believe is null) and I get that 'uninitialized value' error... I think I'm answering my own question, though... always initialize the variable and stupid stuff like this won't happen... --- Jason H. Frisvold Senior ATM Engineer Engineering Dept. Penteledata CCNA Certified - CSCO10151622 [EMAIL PROTECTED] --- Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world. -- Albert Einstein [1879-1955] -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 4:17 PM To: [EMAIL PROTECTED] Subject: Re: Debugging and 'uninitialized value in concatenation' question From: Jason Frisvold [EMAIL PROTECTED] Judging from the subject lines coming across the list today, I think I'm gonna toss this question out there and then duck and cover... :-) We do not shoot at people here. Even if they do provide the missile address. ;-) Question #1. When I'm writing code, I want to be able to view as much output as possible so I can trace through everything and ensure that it is, indeed, running correctly. I've gone as far as writing my own debug module that uses levels and outputs everything in color. (Term::ANSIColor is a lot of fun to play with)... One major side effect of this is that my code will begin to run slower due to all of the debugging... So, the obvious answer is to turn off the debugging. However, even with my magic debug off switch (see below for a better explanation), the calls to the debug routines are still being made. Is there any sort of #IFDEF that can be done in perl, or do I actually have to comment out (or remove) each call? My magic debug off switch is nothing more than a simple if/then statement. It works on the principle that if $IDebugLevel is a positive integer greater than 0, then I want to debug. You may mark them somehow and then process your script with something that'll comment them out or strip them entirely. Like http://Jenda.Krynicky.cz/perl/mversion.pl.txt Question #2. Relating to the debugging, there are several instances where I have variables that are only defined based on the definition of other variables that exist elsewhere. Kind of like : sub dummy { if ($a == 10) { my $b = 0; } } $b is a local variable, so whenever the subroutine is exited, $b vanishes into the ether. In this case the difference is not visible, but still ... please keep in mind that the scope of a variable is a block, not a subroutine! So sub foo { if (1 2) { my $x = 1; } print \$x=$x\n; } foo(); will NOT print $x=1 I hope you DO use strict; The problem is that I have $b in several debug statements because I want to see it when it's used, but I don't want to have to create a huge if/then structure to determine what variables are being used. No you cannot acces a lexical variable (declared with my()) outside its scope. The only kind-of exception are closures ... subroutines defines inside the variable's scope and thus able to access it later. But that's not what you want. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Debugging and 'uninitialized value in concatenation' question
From: Jason Frisvold [EMAIL PROTECTED] Ok, shoot me now... I tried to provide an example and I blew it.. *grin* I realize that the locals are block scope.. I know what I meant, just didn't say it.. :) I see. You never know where does the other guy come from. In VB (yes I am forced to use THAT) the scope is either whole subroutine or whole file or whole application. Arr. I understand that you cannot access a local variable outside it's scope.. Hrm.. ok, try this : sub dummy { my $a; if ($b == 1) { $a = 2; } print $a\n; } Now.. If $b is 1, then $a gets set to 2 and everything is great. However, if not, $a stays unintialized (which I believe is null) and I get that 'uninitialized value' error... I think I'm answering my own question, though... always initialize the variable and stupid stuff like this won't happen... Yes, you can do it that way. What I ended up doing though is start my scriptsmodules with use strict; use warnings; no warnings 'uninitialized'; cause I simply hate that warning. Having to write stuff like: if (defined $foo and $foo) Nay thanks. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
associative array not looking like I thought it would
I have some perl script (shown below) and I am wondering why the associative array being built ends up looking like the printout of the array as shown after the code. I would have assumed the array entries would have been shown in the same order they are put into the array but that is not happening. %Error=( Error=[$ciTDF{'#errval_V'}]: $ciTDF{'#errtext_V'}, Document Name=$ciTDF{'DOC_NAME_V'}, Revision=$ciTDF{'DOC_REV_V'}, Desc=Issuing-could not index to vault, Notes=Clean Vault Log); DB3 p %Error Document NamePARRYTESTERR12NotesClean Vault LogError[142]: BCI Err : More than one match for a record in the BEF input fileDescIssuing-could not index to vaultRevision1 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: associative array not looking like I thought it would
That's not the way associative arrays work. They are stored differently. If you want them to be printed in a certain order, then you must do it explicitly. I think it is really better to think of it as a hash instead of an associative array for that reason. Not all of the rules apply. I commonly use a snippet of code like this when I'm printing hashes: foreach(sort keys %hash){ print $hash{$_}; } -Original Message- From: P. S. Starkey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: associative array not looking like I thought it would I have some perl script (shown below) and I am wondering why the associative array being built ends up looking like the printout of the array as shown after the code. I would have assumed the array entries would have been shown in the same order they are put into the array but that is not happening. %Error=( Error=[$ciTDF{'#errval_V'}]: $ciTDF{'#errtext_V'}, Document Name=$ciTDF{'DOC_NAME_V'}, Revision=$ciTDF{'DOC_REV_V'}, Desc=Issuing-could not index to vault, Notes=Clean Vault Log); DB3 p %Error Document NamePARRYTESTERR12NotesClean Vault LogError[142]: BCI Err : More than one match for a record in the BEF input fileDescIssuing-could not index to vaultRevision1 -- 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]
error log message
what does this mean in my apache error log? i get it A LOT. someone said that it was something to do with windows/linux line ending compatibility probs. log snippet [Thu Apr 25 23:48:59 2002] [error] (2)No such file or directory: exec of /web/cgi-bin/genestate/check_login.cgi failed [Thu Apr 25 23:48:59 2002] [error] [client 192.168.0.1] Premature end of script headers: /web/cgi-bin/genestate/check_login.cgi /log snippet now the script that is being executed cannot have sent a premature end of script header, have a look at the WHOLE of the script: script snippet #!/usr/bin/perl use CGI qw/:standard/; $url = http://www.perl.com/CPAN/;; print Location: $url\n\n; exit; /script snippet what is goin on? it isn't jsut my web server that gives me this, but also all three of my apache dev servers and an IIS 5.0 dev server on win2k -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN?
Is File::Find a standard module? (It is a module, right?) I don't know anything really about modules except that they exist. Is this method better than using opendir/readdir/closedir? And back to the original question, is CPAN good for questions like this? What do people usually use it for? - B __ On Thursday, April 25, 2002, at 10:41 , Bryan R Harris wrote: you heard right: I heard that you could find code for almost anything at CPAN. How do you go about this? http://www.cpan.org but I have the search book marked: http://search.cpan.org/ where I rummage around for known modules... For example, say I want to recurse through a directory and all subdirectories creating an index text file in each directory containing a list of the text files in that directory. Can CPAN help with that task? yes, File::Find, an illustration of it's use: http://www.wetware.com/drieux/CS/lang/Perl/Beginners/findModules.txt what you need to sort out is how to write the 'callback' function eg: sub wants { ... } to do the majik you want it to do ciao drieux --- -- 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: error log message
On Thursday, April 25, 2002, at 03:56 , Mat Harrison wrote: what does this mean in my apache error log? i get it A LOT. someone said that it was something to do with windows/linux line ending compatibility probs. log snippet [Thu Apr 25 23:48:59 2002] [error] (2)No such file or directory: exec of /web/cgi-bin/genestate/check_login.cgi failed [Thu Apr 25 23:48:59 2002] [error] [client 192.168.0.1] Premature end of script headers: /web/cgi-bin/genestate/check_login.cgi /log snippet the alternative silly is where is the 'perl' really is installed - if it really is at /usr/bin/perl then your sheBang would be ok... this looks like the problem: [Thu Apr 25 16:03:51 2002] [error] [client IP_ADDR] file permissions deny server execution: /drieux/CS/cgi/dumb.cgi this was the one without the execute permissions [Thu Apr 25 16:09:47 2002] [error] (2)No such file or directory: exec of /drieux/CS/cgi/d2.cgi failed this is for the same script but as: ### #!/usr/bin/joeBobperl ### ### use CGI qw/:standard/; ### ### $url = http://www.perl.com/CPAN/;; ### print Location: $url\n\n; ### exit; so it looks like you need to have the shebang point to where there is a perl - or put a symbolic link at /usr/bin/perl - wherePerlIsInstalled disky: 101:] ls -ld /usr/bin/perl /usr/local/bin/perl -rwxr-xr-x2 root root 718844 Sep 12 2000 /usr/bin/perl lrwxrwxrwx1 root root 13 Dec 17 00:10 /usr/local/bin/perl - /usr/bin/perl disky: 102:] or as a hard link ala vladimir: 60:] ls -li /usr/bin/perl /usr/local/bin/perl 558805 -rwxr-xr-x 3 root other1175680 Mar 19 15:31 /usr/bin/ perl 558805 -rwxr-xr-x 3 root other1175680 Mar 19 15:31 /usr/local/bin/perl vladimir: 61:] ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Improving the Quality of Our Beginners was Re: Write permissions and other rights
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 25 April 2002 08:45 am, Ron Goral wrote: I do agree that the mysteries of the *NIX OS should not be covered in a list like this, but... I'm still a blithering tyro where perl is concerned, but one of the most daunting aspects of my earliest learning efforts was the unix-centric nature of most perl material. Correct me if I'm wrong, but aren't perl's roots are in unix system admin, isn't that what Mr. Wall wrote it for? To folks lacking the context of unix much of perl is simply impossible to figure out. Willingness to help out in that realm is of great service to we newbies. (Personally, I only began to get perl *after* I started running a linux box.) One thought is that perhaps beginners is more heterogeneous a collection than some might expect. Seems to me the term will entice folks who have never written a hello world in any language as well as seasoned programmers who are only beginners in the context of perl. The list emphasis seems to be more toward this latter group, but the former is the one most in need of a friendly place to be naive and ignorant and slow. If this isn't the place for such perhaps someone can point to a similar resource that *is* for the absolute beginner? - -- Beau -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8yJDlbMtNI7KvfxQRAr8rAKDFve03++oS+anQciILvaSF/IltOwCfR8sb cL3lkyVs5PhlYwZPS1wcLbA= =Jo65 -END PGP SIGNATURE- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error log message
On 4/25/02 6:56 PM, Mat Harrison [EMAIL PROTECTED] wrote: what does this mean in my apache error log? i get it A LOT. someone said that it was something to do with windows/linux line ending compatibility probs. log snippet [Thu Apr 25 23:48:59 2002] [error] (2)No such file or directory: exec of /web/cgi-bin/genestate/check_login.cgi failed [Thu Apr 25 23:48:59 2002] [error] [client 192.168.0.1] Premature end of script headers: /web/cgi-bin/genestate/check_login.cgi /log snippet [snip] Actually, I encountered the same problem as you and the exact same error log message two hours ago, running Apache on Mac OS X. The problem was that my script had DOS line endings, but the line endings needed to be Unix . When I made the change, the script worked fine. - geoff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: CPAN?
Is File::Find a standard module? (It is a module, right?) I don't know anything really about modules except that they exist. Is this method better than using opendir/readdir/closedir? And back to the original question, is CPAN good for questions like this? What do people usually use it for? File::Find is a standard module. I haven't used it, but it looks pretty robust. You can find out more about it using: perldoc File::Find I know that _Learning_Perl_ has a chapter on modules, but I've only used a couple of the standard ones. Does anyone else out there have pointers to other useful tutorials? I don't know how the functions within File::Find compare to the non-module functions. CPAN is a repository for perl modules. If you're trying to do something difficult in perl, it's a place to look so that you don't reinvent the wheel. On the other side, it's a place to post modules that you've written that you think will be useful for others to reuse. /\/\ark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CPAN?
On Thursday, April 25, 2002, at 04:14 , Bryan R Harris wrote: Is File::Find a standard module? on my darwin box - where I have made only module change - it was standard as of 5.6.0 (It is a module, right?) perldoc -m File::Find {perldoc is your friend! start with perldoc perl read all of that } # end of autonomous function will let you peek into the full text - and not merely the POD. I don't know anything really about modules except that they exist. this is actually a second step forward. That you know they exist - means that all you need to do is resolve if you wish to write the code that has already been written or use the modules that exist already. Is this method better than using opendir/readdir/closedir? depends on why you want to read directory blocks to begin with. If all you are doing is converting a 'find trick' to perl then doing the legWork of opendir/readdir/closedir - may not be what you want - but if you all you need to do is my $dir = 'stuffPlaceSomeWhere'; opendir(DIR_FH, $dir) or die can not opendir $dir: $!; my @allfiles = grep { /^\./ -f $some_dir/$_ } readdir(DIR_FH); closedir DIR_FH; foreach my $file (@allfiles) { #long hiddeous sequence of dark malevolent evil } you came, you peeked, you moved on and did not need to use the 'use File::Find; And back to the original question, is CPAN good for questions like this? the CPAN is omniscient, but it also is not likely to talk to you. good morning computer... - Scottie there are a lot of documents there worth reading, after you have finished reading the list in perldoc perl What do people usually use it for? deciding that we really have to get a life, rather than recode something we could have just downloaded from the CPAN Oh, you meant what 'normal people' usually use it for. I don't know, I only know codeMonkies 8-) ciao drieux - See the Crown, Beee The Crown. - Miss Congeniality -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Improving the Quality of Our Beginners was Re: Write permissions and other rights
On Thursday, April 25, 2002, at 04:27 , Robert Beau Link wrote: On Thursday 25 April 2002 08:45 am, Ron Goral wrote: I do agree that the mysteries of the *NIX OS should not be covered in a list like this, but... [..] but aren't perl's roots are in unix system admin, isn't that what Mr. Wall wrote it for? unix sysAdds took to it because they were 'wimps' and did not have the 'big stones' to master 'sed' and 'awk' and 'grep' and do complex, esoteric and arcane convolutions in /bin/sh that come with a flat name space management problem - in the days before /bin/sh had 'functions' as an archetype... { ok, so invoking mknod to make a named pipe to talk between two shell scripts may not have been a good idea } { ok, so the CERN 'losers' did that http/html thing because ftp/telnet was 'hard' - the whiners... } 8-) RealMen[tm] Code in Perl because it's just simpler. To folks lacking the context of unix much of perl is simply impossible to figure out. part of it is that the 'unix freaks' come from 'the network IS the solution' - approach - and hence want our code to do for us, that which we need done, but otherwise interrupts our flaming our friends and enemies on 'the net'. So depending on how much of that 'system' like background you already have - that is a part of what you are kvetching about. It is not always the 'kernel internals' - but much of the basic 'unix context' that is just weird Unix remains one of the most backward at the 'user interface layer' - but at Oh Dark Squat, all you have is an accoustic coupler for that modem, a dial up connection and that Admiral Terminal - Kick It Down, Who Cares, we can get a tty line and ROCK! Mouse What??? [..] One thought is that perhaps beginners is more heterogeneous a collection than some might expect. [..] you ain't just whistling dixie there those of us who have coded but not had the time to study come back and learn new tricks I mean I just learned that I can use bbedit on my OS X box as a Perl IDE - so... it's all trades here... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wipe out elements in an array
I have another question that Learning Perl doesn't seem to address: I'd like to remove all elements in an array that meet a certain criteria without changing their order. I'm sure this gets done all the time, but I'm not sure how to do it... Help? My guess (this is just an example): @myarray = (1,2,3,4,5,6,7,8,9,10); foreach (@myarray) { if ($_ == 3 || $_ == 5) { undef($_); } } But I don't think it's working right... - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GoryDetails on: error log message
On Thursday, April 25, 2002, at 04:16 , drieux wrote: [Thu Apr 25 23:48:59 2002] [error] (2)No such file or directory: exec of /web/cgi-bin/genestate/check_login.cgi failed [Thu Apr 25 23:48:59 2002] [error] [client 192.168.0.1] Premature end of script headers: /web/cgi-bin/genestate/check_login.cgi /log snippet wow - just used unix2dos and I can generate the similar error case on our linux box. [Thu Apr 25 16:58:46 2002] [error] (2)No such file or directory: exec of /drieux/CS/cgi/dumbDos.cgi failed [Thu Apr 25 16:58:46 2002] [error] [client IPADDR] Premature end of script headers: /drieux/CS/cgi/dumbDos.cgi this occurs because of the 'dos' two byte ending: 000 # ! / u s r / b i n / p e r l \r 020 \n \r \n u s e C G I q w / : s 040 t a n d a r d / ; \r \n \r \n $ u r 060 l = h t t p : / / w w w . 100 p e r l . c o m / C P A N / ; 120 \r \n p r i n t L o c a t i o 140 n : $ u r l \ n \ n ; \r \n e 160 x i t ; \r \n the comedy here is that the killer is that your linux machine is reading the 'shebang' there not as #!/usr/bin/perl but as #!/usr/bin/perl^M and there is no such file of that type. fix that one line and your code will work now of course had you put that line as #!/usr/bin/perl -w then the 'shebang' would have worked because the formating would have been od -c dumbDos.cgi 000 # ! / u s r / b i n / p e r l 020 - w \r \n \r \n that would have moved the ^M like gunge off of #!/usr/bin/perl and perl has no problem with sucking in -w\r\n as a command line argument since in the dark it will 'chomp' that stuff anyway . have we mentioned 'use -w' before Did we ever mention 'use strict;' before!!! There are Majikal and Mystical Reasons. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parsing a line - part 2
David Gray wrote: How about: /(\S+)=(.+?)(?=\s+\S+=|\s+|\z)/g To catch trailing whitespace at the end of the line of data? Actually, I meant: /(\S+)=(.+?)(?=\s+\S+=|\s*\z)/g ^^^ Yeah, that will work. :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wipe out elements in an array
On Apr 25, Bryan R Harris said: I'd like to remove all elements in an array that meet a certain criteria without changing their order. I'm sure this gets done all the time, but I'm not sure how to do it... You want splice() instead. perldoc -f splice -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 ** stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wipe out elements in an array
On Thursday, April 25, 2002, at 05:24 PM, Jeff 'japhy' Pinyan wrote: On Apr 25, Bryan R Harris said: I'd like to remove all elements in an array that meet a certain criteria without changing their order. I'm sure this gets done all the time, but I'm not sure how to do it... You want splice() instead. perldoc -f splice or use grep?: @myarray = grep {$_ !=3 and $_ !=5} @myarray; -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for Regular Expressions in Perl published by Manning, in 2002 * * stu what does y/// stand for? tenderpuss why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wipe out elements in an array
At 08:24 PM 4/25/02 -0400, Jeff 'japhy' Pinyan wrote: On Apr 25, Bryan R Harris said: I'd like to remove all elements in an array that meet a certain criteria without changing their order. I'm sure this gets done all the time, but I'm not sure how to do it... You want splice() instead. perldoc -f splice The poster appeared to want to remove possible discontiguous element sequences: My guess (this is just an example): @myarray = (1,2,3,4,5,6,7,8,9,10); foreach (@myarray) { if ($_ == 3 || $_ == 5) { undef($_); } } But I don't think it's working right... Right, setting an element to undef does not remove it. Use splice() if you want to remove a known number of elements that are all adjacent and start from a known offset. Otherwise, use grep: @myarray = grep { $_ != 3 $_ != 5 } @myarray If you want to remove elements based upon some criteria applied to their *index*, use an array slice. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wipe out elements in an array
On Thursday, April 25, 2002, at 04:58 , Bryan R Harris wrote: My guess (this is just an example): @myarray = (1,2,3,4,5,6,7,8,9,10); foreach (@myarray) { if ($_ == 3 || $_ == 5) { undef($_); } } what you want to look at is perldoc -f splice one way to hack a solution here would be: http://www.wetware.com/drieux/CS/lang/Perl/Beginners/RemoveFromArrayWithSplice. txt The funk that I ran into and did not expect was that my simplistic first idea is the standard while ( $count $len ) { #someJazz with Splice } but that really is not as simple - since well, you are shrinking the size of the array - so you have to shrink the $len - and NOT increment the $count, because now $array[$count] is a Completely new element you haven't seen before... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OpenInteract and others
Hello beginners, I hope this is the appropriate forum for this question. I have been looking for a pretty good base system for which to build a portal system. (messages, news, other content, weather) I want to write most or all of the modules myself but I figured an existing base platform for things like database interaction, session, security and other frameworks already existed. I found the OpenInteract project and browsing the mailing list archive seems like it has slowed down considerably over the last 6 months. [url: http://www.openinteract.org/] Are people using this? How is it? Pros? Cons? What other systems are there? I've seen bricolage but it is far more developed as a CMS than as a base system for what I want. I'm looking for a mod_perl/apache framework that has hooks for something like mysql or postgres. If it supported the opensource sap_db that would also be very cool. I'm happy to work from a framework and add my own modules and such -- I'm just looking for the best base that is out there and is tried and tested. Thanks, David Ulevitch mailto:[EMAIL PROTECTED] Founder, EveryDNS.nethttp://www.everydns.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wipe out elements in an array
On Thursday, April 25, 2002, at 05:37 , Peter Scott wrote: Use splice() if you want to remove a known number of elements that are all adjacent and start from a known offset. Otherwise, use grep: @myarray = grep { $_ != 3 $_ != 5 } @myarray If you want to remove elements based upon some criteria applied to their *index*, use an array slice. head to head comparison grep wins: http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/RemoveFromArray. txt ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
mod_perl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am following instructions found at http://take23.org/intro/index.xml/3 on how to install mod perl with apache already installed. The instructions are % tar xzvf mod_perl-x.xx.tar.gz % cd mod_perl-x.xx % perl Makefile.PL \ USE_APXS=1 \ WITH_APXS=/usr/sbin/apxs \ EVERYTHING=1 \ [] % make make test make install Well, the tar and cd work fine, but the third command barfs out the following: You are running Perl version 5.006 We strongly suggest to upgrade to at least 5.6.1 Reading Makefile.PL args from @ARGV Unable to determine server version, aborting Please specify MP_APXS or MP_AP_PREFIX To make matters worse, rpm -q perl tells me I'm running perl-5.6.0-12, quite a wais from the claim of 5.006. From the command line perl -v gives me, This is perl, v5.6.0 built for i386-linux I am at a total loss as to how to procede. And I'm hoping this is not too terribly ot. - -- Beau -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8yL4PbMtNI7KvfxQRAhNcAJ9gJduB7p7xTBtrE9mOmZA0ZjdGBwCguB/0 zjeQIcWTSbdPg3giq3heSjM= =TSK+ -END PGP SIGNATURE- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OpenInteract and others
There is Open Architecture Community System (OpenACS) http://www.openacs.org. It is a well engineered Tcl/AOLServer-based framework. It uses PostgreSQL or Oracle. I think they made it to work with Apache. I don't know about mod_perl but there are a lot of discussions about Perl there at http://openacs.org/bboard/search-entire-system.tcl?query_string=perl -- Ahmed Moustafa http://pobox.com/~amoustafa -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http headers
hi again, i was actually looking for modules that split the following into name/value pairs. the following is a typical request header from a web browser(eg.IE/netscape). more details on what i'm doing: i'm doing a simple proxy server. the web browser sends the request, the server uses sysread() (eg. sysread($client_socket, $buffer, 4096) )to read in the request into $buffer. thus $buffer contains the below string. i need to split it into name/value pairs or any other form which would be easier to process the request. GET http://doramaworks.tripod.com/lyrics/sissel01.html HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* Accept-Language: en-us Cookie: CookieStatus=COOKIE_OK User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461) Host: doramaworks.tripod.com Proxy-Connection: Keep-Alive --- Conan Chai [EMAIL PROTECTED] wrote: hi, are there any perl modules that splits the http request headers into name/value pairs? Conan It Will Come To Us !!! [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = It Will Come To Us !!! [EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Messenger - Instant Messaging, Instant Gratification. (Now with new emoticons!) http://messenger.yahoo.com.sg/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]