Stress-test server
Hi, I would like to see what happens to my web server if I get 50-60 connections all posting requests to it. Can anyone suggest a module that might help (WWW.Mechanize perhaps). Thanx. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Stress-test server
On 11/14/05 11:25 AM, Dermot Paikkos [EMAIL PROTECTED] wrote: Hi, I would like to see what happens to my web server if I get 50-60 connections all posting requests to it. Can anyone suggest a module that might help (WWW.Mechanize perhaps). If you are using Apache, it comes with 'ab' (apache benchmark). You can use ab to send concurrent requests, etc. and it will give you a report. Sean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
cookies
Dear all, Could some one help me out by explaining how to set and delete a cookie using perl... With Best Regards, Karthikeyan S Honeywell Process Solutions - eRetail Honeywell Automation India Limited Phone:91-20-56039400 Extn -2701 Mobile :(0)9325118422 E-Mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] This e-mail, and any attachments thereto, are intended only for use by the addressee(s) named herein and contain Honeywell confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying which amounts to misappropriation of this e-mail and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof.
Re: combining array ref's
Tom Allison wrote: John W. Krahn wrote: Mike Blezien wrote: what is the most effecient way to combine multiple array refs into one array ref, IE: my $arrayrefA = ['1',2','3']; my $arrayrefB = ['4','5','6']; my $arrayrefC = ['7','8','9']; my $allarrayref = (Combine $arrayrefA $arrayrefB $arrayrefC) So you just want to combine the contents of the anonymous arrays? my $allarrayref = [ @$arrayrefA, @$arrayrefB, @$arrayrefC ]; You might want to Benchmark this. I know from the perl cookbook that joining two hashes can be done this way but it's also mentioned that it is very memory intensive. I don't know if the same applies here. My results show that this is not the best way to procede if you are interested in performance. use strict; use warnings; use Benchmark; use Time::HiRes; my $A = [1,2,3,4,5,6,7,8,9]; my $B = [11,12,13,14,15,16,17,18,19]; timethese(1000, { 'plain' = 'my $array = [$A, $B];', 'loopy' = 'push @$A, $_ foreach @$B;' }); Those aren't equivalent. 'plain' is only assigning two scalars while 'loopy' is pushing nine scalars. 'plain' = 'my $array = [EMAIL PROTECTED], @$B];', 'loopy' = 'push @$array, $_ foreach @$A, @$B;' But you don't need a foreach loop with push(): 'plain' = 'my $array = [EMAIL PROTECTED], @$B];', 'loopy' = 'push @$array, @$A, @$B;' $ perl -e' use Benchmark q/cmpthese/; my $A = [ 1 .. 9 ]; my $B = [ 11 .. 19 ]; cmpthese ( 10_000_000, { scalar_assign = q/my $array = [ @$A, @$B ]/, array_assign = q/my $array; @$array = ( @$A, @$B )/, map_assign= q/my $array; @$array = map @$_, $A, $B/, push = q/my $array; push @$array, @$A, @$B/, push_loop1= q/my $array; push @$array, $_ for @$A, @$B/, push_loop2= q/my $array; push @$array, @$_ for $A, $B/, } ); ' Rate push_loop2 push_loop1 map_assign scalar_assign array_assign push push_loop2 550358/s -- -32% -49% -60% -69% -69% push_loop1 812348/s48% -- -25% -40% -54% -55% map_assign1084599/s97%34% -- -20% -38% -40% scalar_assign 1360544/s 147%67%25%-- -23% -24% array_assign 1757469/s 219% 116%62% 29% -- -2% push 1795332/s 226% 121%66% 32% 2% -- John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: What is shift ?
On 13 Nov 2005 at 19:19, Dylan Stamat wrote: No, not the routine that deals with Arrays ! I see code like the following, everywhere: my $coolvariable = shift; Why is a new scalar being assigned to shift ? New to Perl... sorry for the lame question, but couldn't find an answer anywhere. shift does deal with arrays. So $coolvariable is has the first element of whatever array you passed to the function: sub mysub { my $first_element = shift; my $second_element = shift; print One=$first_element, Two=$second_element\n; } You see shift a lot at the start of scripts too. It's how you take in command-line arguments (the array @ARGV) . So #!/usr/bin/perl -w # name.pl # use strict; my $name = shift; print Your name is $name\n; ./name.pl joe prints joe. HTH. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Why glob() ?
It was just a temporary thing, this with Perl because of a work in school. I have no need of programming Perl otherwise, not at the moment anyway. /G http://www.varupiraten.se/ - Original Message - From: Guillaume R. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: beginners@perl.org Sent: Monday, November 14, 2005 7:36 AM Subject: Re: Why glob() ? Gustav Hi there! Lo Gustav ps. I don't have the manual or Perl installed on this computer... U should install so. Playing with perl without the docs is like playing football without the ball... Why don't u install it? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: cookies
To set the cookie I have used the following: my $username = 'name'; my $cookiereplace = Set-Cookie: username=$username; expires= \n; print $cookiereplace print header; #print htmls To unset the cookie : my $cookiereplace = Set-Cookie: username='';; With Best Regards, Karthikeyan S Honeywell Process Solutions - eRetail Honeywell Automation India Limited Phone:91-20-56039400 Extn -2701 Mobile :(0)9325118422 E-Mail: [EMAIL PROTECTED] This e-mail, and any attachments thereto, are intended only for use by the addressee(s) named herein and contain Honeywell confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying which amounts to misappropriation of this e-mail and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. -Original Message- From: Chris Devers [mailto:[EMAIL PROTECTED] Sent: Monday, November 14, 2005 5:45 PM To: S, karthik (IE03x) Cc: beginners@perl.org Subject: Re: cookies On Mon, 14 Nov 2005, S, karthik (IE03x) wrote: Could some one help me out by explaining how to set and delete a cookie using perl... Probably. Can you help us out by showing us what code you've tried so far, /or what documentation you've read so far? Give us a hint that you've at least *tried* to answer such a Frequently Asked Question for yourself, and we'll be happy to help you out. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: ?php???
[EMAIL PROTECTED] Seriously though, if you're a beginner, learn *any* language but PHP and anything Microsoft specific. Hi Out of interest, why would you say this. You've never had to admin a web server where people used PHP huh? People are always getting PHP hacked, to upload files, worms, and root kits. Its a constant trouble to have to scan for maliciouose PHP and remove/update the scripts involved. Practically a full time position here just to maintain security due 100% to PHP You got any links to support your statement, I googled and I have not seen anything than the usual, and googling for perl exploits and produces a fair amount of results. Yes *any* language can be used for evil, PHP just makes it way more intuitive and easy to do, others you have to be semi stupid to write dangerous code. (For example Matt's script archive is full of some extremely lame and insecure Perl scripts, I hate those as much as I do PHP, but thats just *one* set of scripts not the entire implementation of the language) For instance: Oh I have Magic quotes on so I can just pass my safely quoted data to mysql: wrong, now you have an injection attack. Oh I have it tightened down with PHPSuExec and have all sorts of goodies in php.ini to tighten it up: wrong again, `touch ~/php.ini` and poof all the safeties are off. I can't tell you how may times I've seen people with scripts that have exploits that allow them to upload files to /tmp and run commands on them. I've seen everything from rootkits to DoS bots *all* from PHP scripts that don't even have any upload funtions or system command calls themselves!!! Just recently this worm was going around: http://www.google.com/search?q=phpbb_patch which brings up another popular hackability example: http://www.google.com/search?q=phpbb+security There have been some *major* issues with that. In fact its gotten so bad we're considering removing PHP from our servers and creating/using different versions of PHP scripts people like to use in Perl (or C or Ruby, or Python, etc etc) Also from our benchmarking its plain too see that PHP is a huge bloat, it has to run under apache for the same reasons hippo's stay in the river most of the time. I don't have time for specifics, if you're really interested do your own tests but you'll be much better off not getting involved with PHP but of course if you want the headache shoot yourself. So again I reiterate: if you're a beginner (IE you havn't be molested by the PHP community yet and had the misfortune to use it) then stay away, of course thats just my .02 based on years of large scale development projects and admin work. I'm sure some PHP advocate will come down on me with fire and brim stone but who cares they're jerks and they'll get theirs when they're hacked into oblivion ;p -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: ?php???
[EMAIL PROTECTED] Seriously though, if you're a beginner, learn *any* language but PHP and anything Microsoft specific. Hi Out of interest, why would you say this. You got any links to support your statement, I googled and I have not seen anything than the usual, and googling for perl exploits Also this is interesting http://www.google.com/search?q=php+exploits A common thread: Remember, this is not a phpBB exploit or problem, it's a PHP issue and thus can affect any PHP script which uses the noted functions. See, no matter who codes what the language is inherently flawed, which is why I made the comment about PHP being especially easy to write hackable_sripts_with_lots_of_serious_exploits :) Because you could write the best code ever and the binary would still let them do bad bad things. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: What is shift ?
Dylan Stamat wrote: No, not the routine that deals with Arrays ! I see code like the following, everywhere: my $coolvariable = shift; Why is a new scalar being assigned to shift ? New to Perl... sorry for the lame question, but couldn't find an answer anywhere. shift is a built-in function. It's documented under perldoc -f shift It removes and returns the first element from an array. When called (as in this case) without an explicit array, it defaults to either @ARGV (if called outside of any sub), or @_ (if called within a sub). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: cookies
On Mon, 14 Nov 2005, S, karthik (IE03x) wrote: my $username = 'name'; my $cookiereplace = Set-Cookie: username=$username; expires= \n; print $cookiereplace print header; #print htmls To unset the cookie : my $cookiereplace = Set-Cookie: username='';; Okay, that's a start, thank you. Now, please, can you point out the documentation you were reading that led you to believe that this would do anything useful? I have a hunch you may have mis-read something :-) Here's a hint: among a great many other ways to do this, the CGI.pm module has built-in methods to handle this for you. Look up for the cookie sections of the CGI perldoc; an online version is here: http://perldoc.perl.org/CGI.html#HTTP-COOKIES Additionally, higher-level modules like CGI::Application do a lot of the work needed to make you forget that cookies are even necessary. Documentation on it is available at http://search.cpan.org/~markstos/CGI-Application/lib/CGI/Application.pm But if you just want to do things the old-fashioned way with raw cookies, don't roll your own code to do this when it's a problem that has been solved a hundred thousand times now -- just let CGI.pm do it. -- Chris Devers 0%T [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Why glob() ?
On Sun, 13 Nov 2005 22:47:05 -0500, Tom Allison wrote: Gustav Wiberg wrote: Hi again! If I understood it right... @list = glob('*.txt'); would return all files that ends with *.txt in current directory? Usually. If there are a lot of files in the directory, this will file. About the same time that the shell command 'rm' or 'ls' will faile if you do: rm *.txt Only if you're using a Perl from the last millennium. Starting with version 5.6.0, glob() no longer calls out to csh and does not have the same limitations. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: combining array ref's
John W. Krahn wrote: Tom Allison wrote: John W. Krahn wrote: Mike Blezien wrote: what is the most effecient way to combine multiple array refs into one array ref, IE: my $arrayrefA = ['1',2','3']; my $arrayrefB = ['4','5','6']; my $arrayrefC = ['7','8','9']; my $allarrayref = (Combine $arrayrefA $arrayrefB $arrayrefC) So you just want to combine the contents of the anonymous arrays? my $allarrayref = [ @$arrayrefA, @$arrayrefB, @$arrayrefC ]; You might want to Benchmark this. I know from the perl cookbook that joining two hashes can be done this way but it's also mentioned that it is very memory intensive. I don't know if the same applies here. My results show that this is not the best way to procede if you are interested in performance. use strict; use warnings; use Benchmark; use Time::HiRes; my $A = [1,2,3,4,5,6,7,8,9]; my $B = [11,12,13,14,15,16,17,18,19]; timethese(1000, { 'plain' = 'my $array = [$A, $B];', 'loopy' = 'push @$A, $_ foreach @$B;' }); Those aren't equivalent. 'plain' is only assigning two scalars while 'loopy' is pushing nine scalars. 'plain' = 'my $array = [EMAIL PROTECTED], @$B];', 'loopy' = 'push @$array, $_ foreach @$A, @$B;' But you don't need a foreach loop with push(): 'plain' = 'my $array = [EMAIL PROTECTED], @$B];', 'loopy' = 'push @$array, @$A, @$B;' $ perl -e' use Benchmark q/cmpthese/; my $A = [ 1 .. 9 ]; my $B = [ 11 .. 19 ]; cmpthese ( 10_000_000, { scalar_assign = q/my $array = [ @$A, @$B ]/, array_assign = q/my $array; @$array = ( @$A, @$B )/, map_assign= q/my $array; @$array = map @$_, $A, $B/, push = q/my $array; push @$array, @$A, @$B/, push_loop1= q/my $array; push @$array, $_ for @$A, @$B/, push_loop2= q/my $array; push @$array, @$_ for $A, $B/, } ); ' Rate push_loop2 push_loop1 map_assign scalar_assign array_assign push push_loop2 550358/s -- -32% -49% -60% -69% -69% push_loop1 812348/s48% -- -25% -40% -54% -55% map_assign1084599/s97%34% -- -20% -38% -40% scalar_assign 1360544/s 147%67%25%-- -23% -24% array_assign 1757469/s 219% 116%62% 29% -- -2% push 1795332/s 226% 121%66% 32% 2% -- John True dat. But you've shown even better what I was hinting at. The most code efficient method my $array = [ @$A, @$B ] is not the most efficient push @$array, @$_ for $A, $B that you presented. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: What is shift ?
Excellent, thanks for the clear answers. I've been coding Java for the last 2 years, and feel lost :) Thanks again ! On 11/14/05, Bob Showalter [EMAIL PROTECTED] wrote: Dylan Stamat wrote: No, not the routine that deals with Arrays ! I see code like the following, everywhere: my $coolvariable = shift; Why is a new scalar being assigned to shift ? New to Perl... sorry for the lame question, but couldn't find an answer anywhere. shift is a built-in function. It's documented under perldoc -f shift It removes and returns the first element from an array. When called (as in this case) without an explicit array, it defaults to either @ARGV (if called outside of any sub), or @_ (if called within a sub).
Re: cookies
On Mon, 14 Nov 2005, S, karthik (IE03x) wrote: Could some one help me out by explaining how to set and delete a cookie using perl... Probably. Can you help us out by showing us what code you've tried so far, /or what documentation you've read so far? Give us a hint that you've at least *tried* to answer such a Frequently Asked Question for yourself, and we'll be happy to help you out. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Hi All
Hi All, This is my first mail to this mailing list. I am just starting to learn Perl. Please help me in getting the basics cleared. Thanks Santosh
Re: Hi All
On Tue, 15 Nov 2005, Santosh Reddy wrote: This is my first mail to this mailing list. I am just starting to learn Perl. Please help me in getting the basics cleared. Here's some basics: http://learn.perl.org/ Here's another: This list responds best to direct questions about specific problems. If you want open-ended help with something that you haven't yet taken any time to research for yourself, stop right there, fire up your web browser (or get out your O'Reilly books), and spend some time studying up on the copious material that is already available for people that are just learning, as you are. Once you get your feet wet, and are working on specific tasks that you need help with, feel free to send specific questions -- along the lines of why doesn't this code work? or why doesn't this line do what I think it should or how can I complete the following subroutine? -- and we will be happy to help you out. But i you just want to open-endedly get the basics cleared, then this list is utterly the wrong place to ask. Start with a web search. Start with an excellent site like learn.perl.org. Start with some independent reading and practicing. And then come back to us once you're ready for the next step. -- Chris Devers ©957ðVÓ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response