[24747] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6902 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 23 18:21:31 2004

Date: Mon, 23 Aug 2004 15:10:10 -0700 (PDT)
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, 23 Aug 2004     Volume: 10 Number: 6902

Today's topics:
        Perl, POST, and Redirect, CGI.pm (Michael)
    Re: Perl, POST, and Redirect, CGI.pm <noreply@gunnar.cc>
    Re: Perl, POST, and Redirect, CGI.pm (Randal L. Schwartz)
    Re: Perl, POST, and Redirect, CGI.pm <dwall@fastmail.fm>
    Re: Perl, POST, and Redirect, CGI.pm <flavell@ph.gla.ac.uk>
    Re: Perl, POST, and Redirect, CGI.pm <Joe.Smith@inwap.com>
    Re: Perl, POST, and Redirect, CGI.pm <transmissions@fuse.net>
    Re: Perl, POST, and Redirect, CGI.pm <ceo@nospan.on.net>
    Re: Perl, POST, and Redirect, CGI.pm <noreply@gunnar.cc>
    Re: Perl, POST, and Redirect, CGI.pm <noreply@gunnar.cc>
    Re: Recursively copying a directory <lenaic.huard@laposte.net>
    Re: SSL Tunneling <Joe.Smith@inwap.com>
    Re: start some actions with Perl without Cron? <usenet@morrow.me.uk>
    Re: start some actions with Perl without Cron? (Sara)
    Re: WSDL/SOAP/XML-RPC HELP <ceo@nospan.on.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 23 Aug 2004 09:02:43 -0700
From: aravenwood@fuse.net (Michael)
Subject: Perl, POST, and Redirect, CGI.pm
Message-Id: <1db4f6d4.0408230802.477fe73f@posting.google.com>

I have a problem.  I have a cgi script which prints a form on the
screen.  When the users clicks submit, it posts back to itself to
validate the form fields.  If all the form's data is valid, it uses
the redirect method of CGI.pm to go to another cgi script.  If the
form data is all valid, the first script dumps that data into a file
it creates on the server, then redirects to the second script.  Then
the second cgi script opens up that file and retrieves the data from
it and uses it.  Here's the Problem:  apparently the server's
permissions have been changed, and scripts are no longer permitted to
create files on it.  I can't change the permissions (client's rules).

This whole complicated system is simply to get the validated data from
the first script to the second without having it show in the URL, for
privacy reasons.  Is there any way to use the redirect method in Perl
in such a way that it posts data - either from the form, or that I
give it as parameters?  Is there another approach besides the redirect
method I might use?  This system used to work until the client made a
bunch of changes to the server.

Thanks,
Michael


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

Date: Mon, 23 Aug 2004 18:12:18 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <2oujneFf0kh3U1@uni-berlin.de>

Michael wrote:
> This whole complicated system is simply to get the validated data
> from the first script to the second without having it show in the
> URL, for privacy reasons.  Is there any way to use the redirect
> method in Perl in such a way that it posts data - either from the
> form, or that I give it as parameters?

Don't know. Probably not.

> Is there another approach besides the redirect method I might use?

You can use HTTP::Request::Common to make a POST request.

But if the other script is on the same server, can't you just
incorporate in via e.g. the require() function?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 23 Aug 2004 10:31:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: aravenwood@fuse.net (Michael)
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <86657969ru.fsf@blue.stonehenge.com>

*** post for FREE via your newsreader at post.newsfeed.com ***

>>>>> "Michael" == Michael  <aravenwood@fuse.net> writes:

Michael> Here's the Problem:  apparently the server's
Michael> permissions have been changed, and scripts are no longer permitted to
Michael> create files on it.  I can't change the permissions (client's rules).

Web Hosts are a dime a dozen these days.  Move your money elsewhere.
Get a host that cooperates with you.  There's no excuse for being
unable to do your job because of restrictive rules.

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


 -----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
                  


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

Date: Mon, 23 Aug 2004 17:34:18 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <Xns954E8A0E86C2Fdkwwashere@216.168.3.30>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message 
<news:2oujneFf0kh3U1@uni-berlin.de>:

> Michael wrote:
>> This whole complicated system is simply to get the validated data
>> from the first script to the second without having it show in the
>> URL, for privacy reasons.  Is there any way to use the redirect
>> method in Perl in such a way that it posts data - either from the
>> form, or that I give it as parameters?
> 
> Don't know. Probably not.
> 
>> Is there another approach besides the redirect method I might use?
> 
> You can use HTTP::Request::Common to make a POST request.
> 
> But if the other script is on the same server, can't you just
> incorporate in via e.g. the require() function?

I wonder why they are two separate programs in the first place? It 
would be simpler (to me, anyway), to do something like this:

If the program is called without parameters, it returns a form and 
references itself in the form action, using the POST method. Program 
takes POSTed data, checks for validity. If data is invalid, return an 
error message to the browser and exit. If the data is valid, continue 
processing. Standard CGI practice, regardless of the language being 
used.



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

Date: Mon, 23 Aug 2004 19:39:56 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <Pine.LNX.4.61.0408231934180.17305@ppepc56.ph.gla.ac.uk>

On Mon, 23 Aug 2004, David K. Wall wrote:

> If the program is called without parameters, it returns a form and 
> references itself in the form action, using the POST method. Program 
> takes POSTed data, checks for validity. If data is invalid, return an 
> error message to the browser and exit.

More politely, rebuild a copy of the form with the good data 
pre-entered and the bad data highlighted, and exit.

None of that part of the problem is Perl-specific (translation: it's 
mostly off-topic here and would be better dealt with on a CGI-specific 
group), but my page 
http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html might just 
contain something useful (see the Perl sample right at the end).

good luck


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

Date: Mon, 23 Aug 2004 19:12:55 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <XkrWc.56853$mD.45174@attbi_s02>

Michael wrote:

> If all the form's data is valid, it uses
> the redirect method of CGI.pm to go to another cgi script.

The other option is to have the first CGI script do a POST to
the second on, wait for the results to come back, then send
the results to the browser.  You will need to convert
relative URLs in the returned data.
	-Joe


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

Date: Mon, 23 Aug 2004 15:19:46 -0400
From: "Michael, TransmissionsLLC" <transmissions@fuse.net>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <6prWc.49665$n7.44165@fe37.usenetserver.com>

Thanks for the tip, Gunnar.  The problem, it turns out, was that someone
else had changed the structure of the server without informing everyone of
the changes.  I will keep your recommendation in mind as I am sure I will
come across a problem that requires it in the future.

Michael


"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:2oujneFf0kh3U1@uni-berlin.de...
> Michael wrote:
> > This whole complicated system is simply to get the validated data
> > from the first script to the second without having it show in the
> > URL, for privacy reasons.  Is there any way to use the redirect
> > method in Perl in such a way that it posts data - either from the
> > form, or that I give it as parameters?
>
> Don't know. Probably not.
>
> > Is there another approach besides the redirect method I might use?
>
> You can use HTTP::Request::Common to make a POST request.
>
> But if the other script is on the same server, can't you just
> incorporate in via e.g. the require() function?
>
> -- 
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl





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

Date: Mon, 23 Aug 2004 19:24:16 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <AvrWc.5883$Y94.2116@newssvr33.news.prodigy.com>

Michael wrote:
> I have a problem.  I have a cgi script which prints a form on the
> screen.  When the users clicks submit, it posts back to itself to
> validate the form fields.  If all the form's data is valid, it uses
> the redirect method of CGI.pm to go to another cgi script.  If the
> form data is all valid, the first script dumps that data into a file
> it creates on the server, then redirects to the second script.  Then
> the second cgi script opens up that file and retrieves the data from
> it and uses it.  Here's the Problem:  apparently the server's
> permissions have been changed, and scripts are no longer permitted to
> create files on it.  I can't change the permissions (client's rules).
> 
> This whole complicated system is simply to get the validated data from
> the first script to the second without having it show in the URL, for
> privacy reasons.  Is there any way to use the redirect method in Perl
> in such a way that it posts data - either from the form, or that I
> give it as parameters?  Is there another approach besides the redirect
> method I might use?  This system used to work until the client made a
> bunch of changes to the server.
> 

The better way has already been presented to you by David Wall -- when 
the form is POSTed, check for validity and keep processing.  Why add all 
that overhead with I/O to disk, re-opening the file, re-parsing it...? 
My goodness...!

If you just HAVE to do it that way and your second script is modified to 
receive data via CGI.pm, then you don't need POSTed data -- use a GET 
URL in your CGI redirect:

my $q = new CGI;
$q->redirect( "/cgi-bin/second-script.pl?var1=foo&var2=bar" );

You have to build the GET URL string though.

-ceo


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

Date: Mon, 23 Aug 2004 22:06:15 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <2ov10gFf3fpbU1@uni-berlin.de>

Michael, TransmissionsLLC wrote:
> Thanks for the tip, Gunnar.  The problem, it turns out, was that
> someone else had changed the structure of the server without
> informing everyone of the changes.

Suggest your client to change hosting provider.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 23 Aug 2004 22:06:19 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl, POST, and Redirect, CGI.pm
Message-Id: <2ov10kFf3fpbU2@uni-berlin.de>

Chris wrote:
> Michael wrote:
>> This whole complicated system is simply to get the validated data
>> from the first script to the second without having it show in the
>> URL, for privacy reasons.

<snip>

> If you just HAVE to do it that way and your second script is
> modified to receive data via CGI.pm, then you don't need POSTed
> data -- use a GET URL in your CGI redirect:

??

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 23 Aug 2004 22:49:27 +0200
From: =?ISO-8859-1?Q?L=E9na=EFc?= Huard <lenaic.huard@laposte.net>
Subject: Re: Recursively copying a directory
Message-Id: <412a58de$1$26986$626a14ce@news.free.fr>

>> the perl function equivalent to the "cp -R" Unix command.
> 
> use File::NCopy;


Exactly what I was looking for.
Thanks !
-- 
(o_         Lénaïc HUARD
//\   Lenaic.Huard@laposte.net
V_/_      KeyID: 0x04D2E818


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

Date: Mon, 23 Aug 2004 19:23:22 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: SSL Tunneling
Message-Id: <KurWc.46126$Fg5.20487@attbi_s53>

Andy80 wrote:

> Hi everybody!
> 
> I've to write a proxy perl script for the following purpose:
> 
> 
>                        _____________a single PC______________
>                       | _________                   _______  |
> --------------------> | |        | --------------> |       | |
> --- SSL traffic ----> | |My proxy| -- plain -----> |daemon | |
> --------------------> | |_(perl)_| -- traffic ---> |_______| |
>                       |______________________________________|
> 
> 
> I've to "convert" SSL traffic into plain traffic and send it on the
> same machine but on another port. Is that possible??

I do it all the time, without using perl, by using openssh under
cygwin running on Windows-XP and/or Win2K.

   cygwin% ssh username@singlepc -L 80:singlepc:80 -L 110:singlepc:110

	-Joe


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

Date: Mon, 23 Aug 2004 00:52:09 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: start some actions with Perl without Cron?
Message-Id: <96onv1-9n4.ln1@osiris.mauzo.dyndns.org>


Quoth tadmc@augustmail.com:
> Pinocchio <krakle@visto.com> wrote:
> 
> > What's wrong with cron?
> 
> It is spelled wrong.

IIRC 'cron' has nothing to do with 'chron-', but actually stands for
'commands run overnight' or some such...

Ben

-- 
Like all men in Babylon I have been a proconsul; like all, a slave ... During
one lunar year, I have been declared invisible; I shrieked and was not heard,
I stole my bread and was not decapitated.
~ ben@morrow.me.uk ~                   Jorge Luis Borges, 'The Babylon Lottery'


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

Date: 23 Aug 2004 10:32:51 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: start some actions with Perl without Cron?
Message-Id: <776e0325.0408230932.658de2ef@posting.google.com>

"PHP2" <gp@nospm.hr> wrote in message news:<cg5u56$d6$1@ls219.htnet.hr>...
> is possible start some actions with Perl without Cron?
> 
> for example send email to users from database after 3 days or delete
> something from database automaticaly after 3 day with Perl but without Cron?


You can "sleep" for 60 x 60 x 24 x 3 seconds. I'm not sure if that
particular integer is in the range of "sleep"; I'll leave that as an
exercise to the reader.

If that's what you mean. But you won't get the builtin advantages of
using cron like crash recovery, logging, etc.

However, on some systems the admin locks down cron with /etc/cron.deny
or allow, so occasionally you'll need to "roll your own" in those
hostile environments. I've done it, but never with such an extended
sleep time.

Personally if I was going to sleep that long, I'd be more inclined to
have a small shellscript that kicks off the Perl script every n
seconds. That way the program isn't perpetually resident (yes I'm an
old-timer!).

G


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

Date: Mon, 23 Aug 2004 18:12:34 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: WSDL/SOAP/XML-RPC HELP
Message-Id: <msqWc.5867$Y94.930@newssvr33.news.prodigy.com>

lepi wrote:
> ChrisO wrote:
> 
>>
>>
>> (3) I hope you understand at least this much, because your assignment 
>> is a good one: Your prof simply wants you to present a public 
>> interface via the web (more specifically via a web service) to your 
>> backend serial "driver".  That's it.  I assure you it's really simple 
>> even though you feel it's hard right now.
>>
>>
>> These examples should get you started.  You are still going to have to 
>> work through the "security" issue.
>>
>> Good luck!
>> -ceo
> 
> 
> Thanks ChrisO,
> 
> Thank you very very much.
> This weekend I did some research on my own, and figured out that I 
> should begin with XML-RPC.
> BUT, there is still one open question. Where is SOAP and WSDL in all 
> this?

You can use SOAP in lieu of XML-RPC, but it's more involved.  It's 
either one or the other, essentially, for what you are trying to 
accomplish (eg. SOAP or XML-RPC).

> Can they be used also? I understand that with WSDL you can 
> describe Web service, but WSDL is allways coming in context with SOAP 
> and not with XML-RPC...
> 

Correct.  SOAP is a different specification for building web services. 
It's relation to XML-RPC may be solely based on XML and the fact that it 
gateways through the web (port 80 or other de facto web port: 8080, 
etc.)  Other than that, the specifications/"protocols" are different. 
SOAP is much more involved or "more full" (as some would say).  XML-RPC 
is rather simple as I previously indicated.  There really is no WSDL for 
XML-RPC although there is a voluntary "standard call" that is supposed 
to self-describe the methods available on any given XML-RPC server.  In 
the examples I gave you, I did not follow that "standard."  (But it's 
still XML-RPC and it still works -- quite well, I might add.  My XML-RPC 
server in combination with the XML-RPC email gateway I wrote allows me 
to make RPN calculator calls, check on bids at eBay, and easily add 
other services that I can call from my two-way pager!)

-ceo


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

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:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#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 V10 Issue 6902
***************************************


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