[32870] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4148 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 24 14:09:37 2014

Date: Mon, 24 Feb 2014 11:09:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 24 Feb 2014     Volume: 11 Number: 4148

Today's topics:
        cookie <gravitalsun@hotmail.foo>
    Re: cookie <sbryce@scottbryce.com>
    Re: cookie <bjoern@hoehrmann.de>
    Re: cookie <gravitalsun@hotmail.foo>
    Re: How do I get "system" to report the correct failure laredotornado@zipmail.com
        non-working perl script under Windows 2008 dr.mtarver@gmail.com
    Re: non-working perl script under Windows 2008 <janek_schleicher@yahoo.de>
    Re: non-working perl script under Windows 2008 <jurgenex@hotmail.com>
    Re: obj 8-2 <johnblack@nospam.com>
    Re: obj 8-2 <johnblack@nospam.com>
    Re: obj 8-2 <mach2@hushmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 24 Feb 2014 20:06:53 +0200
From: George Mpouras <gravitalsun@hotmail.foo>
Subject: cookie
Message-Id: <leg1nv$207b$1@news.ntua.gr>

I want to send a cookie to users’ browser (using the CGI) after 
evaluating a form. The problem is that you can send a cookie only at the 
header and the forms can be only after start_html . any idea ?


------------------------------

Date: Mon, 24 Feb 2014 12:01:49 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: cookie
Message-Id: <leg4v3$2li$1@dont-email.me>

On 2/24/2014 11:06 AM, George Mpouras wrote:
> I want to send a cookie to users’ browser (using the CGI) after
> evaluating a form. The problem is that you can send a cookie only at
> the header and the forms can be only after start_html . any idea ?


This isn't a Perl question, but...

Unless you are evaluating the form input on the client side, sending the
form and sending the cookie happen during two different transactions, so
there is no problem.

1) Send the form.
2) Receive the user input.
3) Evaluate the user input and send the cookie with the response.


------------------------------

Date: Mon, 24 Feb 2014 20:04:25 +0100
From: Bjoern Hoehrmann <bjoern@hoehrmann.de>
Subject: Re: cookie
Message-Id: <nr5ng9p526atnivnbt86ghb0tot21g9n7u@hive.bjoern.hoehrmann.de>

* George Mpouras wrote in comp.lang.perl.misc:
>I want to send a cookie to users’ browser (using the CGI) after 
>evaluating a form. The problem is that you can send a cookie only at the 
>header and the forms can be only after start_html . any idea ?

The Cookie either has to be set from the `<form action='...'>` or has to
be set dynamically e.g. using JavaScript.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 


------------------------------

Date: Mon, 24 Feb 2014 21:08:43 +0200
From: George Mpouras <gravitalsun@hotmail.foo>
Subject: Re: cookie
Message-Id: <leg5bu$295k$1@news.ntua.gr>

Στις 24/2/2014 21:01, ο/η Scott Bryce έγραψε:
> On 2/24/2014 11:06 AM, George Mpouras wrote:
>> I want to send a cookie to users’ browser (using the CGI) after
>> evaluating a form. The problem is that you can send a cookie only at
>> the header and the forms can be only after start_html . any idea ?
>
>
> This isn't a Perl question, but...
>
> Unless you are evaluating the form input on the client side, sending the
> form and sending the cookie happen during two different transactions, so
> there is no problem.
>
> 1) Send the form.
> 2) Receive the user input.
> 3) Evaluate the user input and send the cookie with the response.


The only Perl question is how to write it in C better and compile it.
Back to the subject now, you can not do what you said using the CGI from 
the same script. I am thinking of an ugly workaround but I 'ld like to 
avoid it.



------------------------------

Date: Mon, 24 Feb 2014 08:46:13 -0800 (PST)
From: laredotornado@zipmail.com
Subject: Re: How do I get "system" to report the correct failure message?
Message-Id: <257d6ace-3673-4cae-9268-f4c5b9f6da6c@googlegroups.com>

On Saturday, February 22, 2014 7:27:08 PM UTC-6, C.DeRykus wrote:
> On Friday, February 21, 2014 4:19:55 PM UTC-8, Ben Morrow wrote:
> 
> > Quoth laredotornado@zipmail.com:
> 
> >  ....      
> 
> > 
> 
> > You are checking $? and then printing $!. Properly speaking you need to check both:
> 
> >
> 
> >     use Fcntl qw/:sys_wait_h/; 
> 
> >     my $st = system (...);
> 
> >     if ($st == -1) {
> 
> >         die "failed to run jboss-cli: $!";
> 
> >     }
> 
> >     elsif ($st != 0) {
> 
> >         if (WIFEXITED($?)) {
> 
> >             die sprintf "jboss-cli exited with status %i", 
> 
> >                 WEXITSTATUS($?);
> 
> >         }
> 
> >         elsif (WIFSIGNALED($?)) {
> 
> >             die sprintf "jboss-cli was killed with signal %i",
> 
> >                 WTERMSIG($?);
> 
> >         }
> 
> >         else {
> 
> >             # shouldn't happen
> 
> >             die "jboss-cli failed: $?";
> 
> >         }
> 
> >     }   
> 
> > 
> 
> > On systems which use non-standard return values from wait(2) you may
> 
> > need to replace $? with ${^CHILD_ERROR_NATIVE}, though IIRC this is not consistent across perl versions.
> 
> > >         } 
> 
> > > However, what Perl reports is "Failed to deploy /tmp/my.war:
> 
> > > Inappropriate ioctl for device" and when I run the command in a shell,
> 
> > > the actual error message is "{"JBAS014653: Composite operation failed
> 
> > > and was rolled back. Steps that failed:" => {"Operation step-2" =>
> 
> > > {"JBAS014671: Failed services" =>
> 
> > > {"jboss.web.deployment.default-host./my" =>
> 
> > > "org.jboss.msc.service.StartException in service
> 
> > > jboss.web.deployment.default-host./my: JBAS018040: Failed to start
> 
> > > context"},"JBAS014771: Services with missing/unavailable dependencies"
> 
> > > => ["jboss.deployment.unit.\"my.war\".jboss.security.jacc
> 
> > > Missing[JBAS014861: <one or more transitive dependencies>]"]}}}".  
> 
> > > 
> 
> > > Any ideas how I can output the correct error message?
> 
> > 
> 
> > Does the command print this to stderr (or, indeed, stdout)? I would
> 
> > expect this to be visible when you run the command via system, given
> 
> > that you haven't redirected either. What matters is to make sure your
> 
> > Perl program also realises something went wrong.
> 
> >  
> 
> 
> 
> Or, maybe outputting  stdout/stderr will convey enough:
> 
> 
> 
> use IPC::Run qw/run/;
> 
> 
> 
> @cmd = ("$jbossHome/bin/jboss-cli.sh", "--file=$file");
> 
>  
> 
> run( \@cmd, '>&', \$out_and_err ) 
> 
>      or die "run: $? status=$out_and_err";
> 
> ...
> 
> 
> 
> -- 
> 
> Charles DeRykus

Thanks for all the replies.  Ultimately the one Charles provided did accurately output the error I was hoping to capture.


------------------------------

Date: Mon, 24 Feb 2014 04:16:12 -0800 (PST)
From: dr.mtarver@gmail.com
Subject: non-working perl script under Windows 2008
Message-Id: <0d8f284a-a841-437e-add4-816527d2aa52@googlegroups.com>

I'm doing a test Perl script under Windows 2008

Here is the HTML page that calls it; a simple submit button

<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled </title>
</head>

<body>
<form action="cgi-bin/lambdaperl.cgi" method="POST">
</form>

<form method="POST">
    <p><input type="submit" name="B1" value="Submit"></p>
</form>
</body>
</html>

Here is the file lambdaperl.cgi

#!/usr/bin/perl
 
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print <<HTML;
<html>
 <head>
  <title>A Simple Perl CGI</title>
 </head>
 <body>
  <h1>A Simple Perl CGI</h1>
  <p>Hello World</p>
 </body>
<//html>
HTML
 
exit;

I get

405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.


------------------------------

Date: Mon, 24 Feb 2014 13:30:55 +0100
From: Janek Schleicher <janek_schleicher@yahoo.de>
Subject: Re: non-working perl script under Windows 2008
Message-Id: <bn0sc4Fjk61U1@mid.individual.net>

Am 24.02.2014 13:16, schrieb dr.mtarver@gmail.com:
> I'm doing a test Perl script under Windows 2008
>
> Here is the HTML page that calls it; a simple submit button
> ...
> <body>
> <form action="cgi-bin/lambdaperl.cgi" method="POST">

The input-submit buttion has to be inside this form.

> </form>
>
> <form method="POST">

This is now a new formular with no action specified what to do when 
something is submitted.

>      <p><input type="submit" name="B1" value="Submit"></p>
> </form>
> </body>
> </html>


Greetings,
Janek


------------------------------

Date: Mon, 24 Feb 2014 07:47:01 -0800
From: Jrgen Exner <jurgenex@hotmail.com>
Subject: Re: non-working perl script under Windows 2008
Message-Id: <j8qmg9pfqqk990g14mclc74kv7dvf0np5s@4ax.com>

dr.mtarver@gmail.com wrote:
>I'm doing a test Perl script under Windows 2008
>
>Here is the HTML page that calls it; a simple submit button

Irrelevant

>Here is the file lambdaperl.cgi

Irrelevant

>I get
>
>405 - HTTP verb used to access this page is not allowed.
>The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

This is not a Perl error message.

jue


------------------------------

Date: Mon, 24 Feb 2014 10:49:38 -0600
From: John Black <johnblack@nospam.com>
Subject: Re: obj 8-2
Message-Id: <MPG.2d75341ccaacb06a9897b4@news.eternal-september.org>

In article <lee9mo$gu4$1@dont-email.me>, news@todbe.com says...
> It's more than enough width to keep things easy to read without
> sucking up your entire monitor width these days.

I agree for code, but its nice to allow comments, which I like to be all as left justified as 
possible, to extend beyond 80 columns.

John Black


------------------------------

Date: Mon, 24 Feb 2014 10:52:29 -0600
From: John Black <johnblack@nospam.com>
Subject: Re: obj 8-2
Message-Id: <MPG.2d7534c94448c20e9897b5@news.eternal-september.org>

In article <20140223160953.682@kylheku.com>, kaz@kylheku.com says...
> On 2014-02-23, John Black <johnblack@nospam.com> wrote:
> > In article <lec1o4$iav$1@dont-email.me>, news@todbe.com says...
> >> always staying in my 80 col space.
> >
> > 80 columns is so 1980s, no?  (maybe 90s)
> 
> In 1984 I had an Apple II+ compatible computer with an 80 column
> card. It was supported by software like ASCII Express Pro, a serial
> communication program with terminal emulation. The CP/M operating system
> cheerfully used the 80 column card also.

I cut my teeth on a Commodore 64.  I remember when I upgraded to a Commodore 128 around 1986, 
one of the big deals was that it went from 40 to 80 columns!!  (and at 2MHz had twice the 
clock speed!).

I used to try to keep code to 80 columns so that I could print it out and not have lines 
wrapping down making things unreadable.  At some point, I figured out that I never really 
used the printouts...

John Black


------------------------------

Date: Mon, 24 Feb 2014 12:12:15 -0600
From: Marek Novotny <mach2@hushmail.com>
Subject: Re: obj 8-2
Message-Id: <NvGdnSjrEcjiFpbOnZ2dnUVZ_rKdnZ2d@supernews.com>

On Mon, 24 Feb 2014 10:52:29 -0600, John Black wrote:

> In article <20140223160953.682@kylheku.com>, kaz@kylheku.com says...
>> On 2014-02-23, John Black <johnblack@nospam.com> wrote:
>> > In article <lec1o4$iav$1@dont-email.me>, news@todbe.com says...
>> >> always staying in my 80 col space.
>> >
>> > 80 columns is so 1980s, no?  (maybe 90s)
>> 
>> In 1984 I had an Apple II+ compatible computer with an 80 column card.
>> It was supported by software like ASCII Express Pro, a serial
>> communication program with terminal emulation. The CP/M operating
>> system cheerfully used the 80 column card also.
> 
> I cut my teeth on a Commodore 64.  I remember when I upgraded to a
> Commodore 128 around 1986,
> one of the big deals was that it went from 40 to 80 columns!!  (and at
> 2MHz had twice the clock speed!).
> 
> I used to try to keep code to 80 columns so that I could print it out
> and not have lines wrapping down making things unreadable.  At some
> point, I figured out that I never really used the printouts...
> 
> John Black

My first computer was a Timex Sinclair 1000. Then a VIC20 and then a 
Commodore 64. I used that Commie for 5 years straight. Loved it! Actually 
I really kind of miss it. I then got into the Amiga when that released. 
Would love to find a used Amiga 3000 on ebay for the hell of it. 
Commodore really had some great stuff for us kids at the time. 

-- 
Marek Novotny
A member of the Linux Foundation
http://www.linuxfoundation.org


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4148
***************************************


home help back first fref pref prev next nref lref last post