Re: How do I make two different web pages come up from one CGI?
I want to create two web pages in two different windows from one CGI. Thanks for your input. - Original Message - From: Chris Devers [EMAIL PROTECTED] To: Luinrandir [EMAIL PROTECTED] Cc: Perl Beginners - CGI List beginners-cgi@perl.org Sent: Wednesday, August 03, 2005 6:00 PM Subject: Re: How do I make two different web pages come up from one CGI? On Wed, 3 Aug 2005, Luinrandir wrote: The following does not work Define does not work. It seems to work for me: $ lynx -mime_header http://localhost/test.pl HTTP/1.1 200 OK Date: Thu, 04 Aug 2005 00:49:32 GMT Server: Apache/1.3.33 (Darwin) mod_perl/1.29 Connection: close Content-Type: text/html HTMLHEADTITLESeneschals Report/TITLE/HEADBODY1/body/htmlContent-type: text/html HTMLHEADTITLESeneschals Report/TITLE/HEADBODY2/body/html $ What are you trying to do? THis may not be what you meant, but it works just fine. The HTML isn't standards compliant, but it produces results that will show up in most web browsers. If you want two different pages, you'll have to insert code that follows different paths depending on some condition or conditions. That way, when the page is loaded, the result can vary depending on the input and other factors; the user will get one version or the other. If you want one request to produce two separate pages, that isn't possible. The closest thing I can think of would bee to have a call in the HTML source that, on load, fires off a second page. Something like: #!/usr/bin/perl use strict; if ($ENV{QUERY_STRING} ) { print qq|Content-type: text/html\n\n|, qq|HTMLHEADTITLESeneschals Report/TITLE/HEAD\n|, qq|BODY javascript:onload(/path/to/second/url)\n|, qq|1\n|, qq|/body/html\n|; } else { print qq|Content-type: text/html\n\n|, qq|HTMLHEADTITLESeneschals Report/TITLE/HEAD\n|, qq|BODY\n| qq|2\n|, qq|/body/html\n|; } Or something like that. -- 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
Re: How do I make two different web pages come up from one CGI?
On Wed, Aug 03, 2005 at 10:45:35PM -0700, Luinrandir wrote: I want to create two web pages in two different windows from one CGI. Each request gives one file, that's how HTTP works. You will need at least two requests, with the script running twice (or two scripts running once each). You can use JavaScript to spawn a second window, although it might be blocked by popup blockers (the specifics of such a solution are rather off topic for this list though, so I'll suggest you look elsewhere if you want to go down that path). -- David Dorward http://dorward.me.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How do I make two different web pages come up from one CGI?
David Dorward wrote: On Wed, Aug 03, 2005 at 10:45:35PM -0700, Luinrandir wrote: I want to create two web pages in two different windows from one CGI. Each request gives one file, that's how HTTP works. You will need at least two requests, with the script running twice (or two scripts running once each). You can use JavaScript to spawn a second window, although it might be blocked by popup blockers (the specifics of such a solution are rather off topic for this list though, so I'll suggest you look elsewhere if you want to go down that path). Just to be thorough, not specifically because I like them, I will mention frames. Frames are an easy way to give the appearance of two requests (because there are actually three) without many client side limitations. Most *graphical* browsers support frames these days. And though I don't yet have experience with it I suppose you could look into Ajax. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: quote problem and mysql
Andrew Kennard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all snip / my $Vals; for ( my $i=1;$i=32;$i++ ) { $Vals.='?,'; } chop $Vals; Ugh. $vals = join(', ', ('?') x 32 ); Ideally, you should have your data in an array, then: my $sql = INSERT INTO table VALUES (${ \join(', ', map('?', @data)) }); $dbh-do( $sql, undef, @data ); Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Anonymous array of hashes question
Hello I have a situation where I build an anonymous array of hashes for some requests and responses found in a file (there can be multiple requests and responses). It works very nicely and tracks all of the responses and requests from an ip to another IP address. Here is my code: my $time=$1 if /^(\d+:\d+:\d+\.\d+)/; my $source=$1 if /(\S+) - \S+/; my $destination=$1 if /\S+ - (\S+)/; my $sourcePort=$1 if /S=(\d+)/; my $destinationPort=$1 if /D=(\d+)/; my $sequenceNumber=$1 if /Sequence number: (\d+)/; if ($protocol =~ /PING REQUEST/) { push @{$pingRequests{$destination}}, { time = $time, sequenceNumber=$sequenceNumber }; } elsif ($protocol =~ /PING RESPONSE/) { push @{$pingResponses{$source}}, { time = $time, sequenceNumber=$sequenceNumber }; } I can then access the contents via code like: foreach my $record(@{$pingRequests{$request}}) { $requestCount++; print \tRequest Time=$record-{time}\n if defined $details; } What I want to do however is track the response time between a request and response. This would be identified by the same sequence number for a request/respone pair. I would like to take the time value for each and subtract the response time from the request time to get the response time and add that to the response hash. I cannot figure out how to access the contents of the anonymous hash for that one value. Sudo code would be: elsif ($protocol =~ /PING RESPONSE/) { responseTime=pingRequests{$source}-time - pingResponses{$destination)-time if pingRequests{$source}-sequenceNumber = pingResponses{$destination}-sequenceNumber; push @{$pingResponses{$source}}, { time = $time, sequenceNumber=$sequenceNumber responseTime=$responseTime }; } DOes that make any sense? Can I do what I am trying to accomplish using the logic above? If so, what is that syntax? Help! Thanks! Jason -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response