[28864] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 108 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 9 22:26:29 2007

Date: Fri, 9 Feb 2007 19:25:32 -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           Fri, 9 Feb 2007     Volume: 11 Number: 108

Today's topics:
        is this a bug in getopts dcruncher4@aim.com
    Re: is this a bug in getopts <nobull67@gmail.com>
    Re: is this a bug in getopts <nobull67@gmail.com>
    Re: LibXML validation using an external DTD through a p <jeffhughes1@yahoo.com>
    Re: Memory leak with XMLRPC and Perl... <findingAri@gmail.com>
    Re: Memory leak with XMLRPC and Perl... <john@castleamber.com>
        mod_perl uploads <partner@teamtrier.de>
    Re: mod_perl uploads <partner@teamtrier.de>
    Re: mod_perl uploads <noreply@gunnar.cc>
    Re: mod_perl uploads <partner@teamtrier.de>
    Re: mod_perl uploads xhoster@gmail.com
    Re: mod_perl uploads xhoster@gmail.com
    Re: mod_perl uploads <noreply@gunnar.cc>
    Re: mod_perl uploads <partner@teamtrier.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 7 Feb 2007 09:03:07 -0800
From: dcruncher4@aim.com
Subject: is this a bug in getopts
Message-Id: <1170867787.709008.207680@s48g2000cws.googlegroups.com>

my perl script takes two arguments -s and -t and both require a value.
this is the code

#! /bin/perl -w

use strict;
use Getopt::Std;
use constant OPTS => "s:t:" ;

use vars qw (%opt) ;

getopts(OPTS,\%opt) or &usage();


if (defined($opt{s})) {
   print "you supplied $opt{s} as value for -s\n" ;
}
if (defined($opt{t})) {
   print "you supplied $opt{t} as value for -t\n" ;
}

sub usage() {
    print "your usage is incorrect\n" ;
    exit(-1);
}

if i call the script as follows

script_name -s first_argument -t second_argument
you supplied first_argument as value for -s
you supplied second_argument as value for -t

which is fine.
Now if I call it as
script_name -s -t second_argument
the output is
you supplied -t as value for -s

Shouldn't getopts go to subroutine usage or spew out an error message
that
-s is a mandatory parameter.

What am I missing?



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

Date: 7 Feb 2007 09:45:40 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: is this a bug in getopts
Message-Id: <1170870340.792921.240180@p10g2000cwp.googlegroups.com>

On Feb 7, 5:03 pm, dcrunch...@aim.com wrote:
> my perl script takes two arguments -s and -t and both require a value.
> this is the code
>
> #! /bin/perl -w
>
> use strict;
> use Getopt::Std;
> use constant OPTS => "s:t:" ;
>
> use vars qw (%opt) ;
>
> getopts(OPTS,\%opt) or &usage();
>
> if (defined($opt{s})) {
>    print "you supplied $opt{s} as value for -s\n" ;}
>
> if (defined($opt{t})) {
>    print "you supplied $opt{t} as value for -t\n" ;
>
> }
>
> sub usage() {
>     print "your usage is incorrect\n" ;
>     exit(-1);
>
> }
>
> if i call the script as follows
>
> script_name -s first_argument -t second_argument
> you supplied first_argument as value for -s
> you supplied second_argument as value for -t
>
> which is fine.
> Now if I call it as
> script_name -s -t second_argument
> the output is
> you supplied -t as value for -s
>
> Shouldn't getopts go to subroutine usage or spew out an error message
> that
> -s is a mandatory parameter.

I'm guessing Perl's Getopt::Std is supposed to behave according to the
"standard".

The only standard I can think of is http://www.unix.org/single_unix_specification/
and as far as I can see it doesn't mandate one way or the other on
this matter.



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

Date: 7 Feb 2007 10:00:09 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: is this a bug in getopts
Message-Id: <1170871209.051600.274730@p10g2000cwp.googlegroups.com>

On Feb 7, 5:45 pm, "Brian McCauley" <nobul...@gmail.com> wrote:
> On Feb 7, 5:03 pm, dcrunch...@aim.com wrote:
>
>
>
> > my perl script takes two arguments -s and -t and both require a value.
> > this is the code
>
> > #! /bin/perl -w
>
> > use strict;
> > use Getopt::Std;
> > use constant OPTS => "s:t:" ;
>
> > use vars qw (%opt) ;
>
> > getopts(OPTS,\%opt) or &usage();
>
> > if (defined($opt{s})) {
> >    print "you supplied $opt{s} as value for -s\n" ;}
>
> > if (defined($opt{t})) {
> >    print "you supplied $opt{t} as value for -t\n" ;
>
> > }
>
> > sub usage() {
> >     print "your usage is incorrect\n" ;
> >     exit(-1);
>
> > }
>
> > if i call the script as follows
>
> > script_name -s first_argument -t second_argument
> > you supplied first_argument as value for -s
> > you supplied second_argument as value for -t
>
> > which is fine.
> > Now if I call it as
> > script_name -s -t second_argument
> > the output is
> > you supplied -t as value for -s
>
> > Shouldn't getopts go to subroutine usage or spew out an error message
> > that
> > -s is a mandatory parameter.
>
> I'm guessing Perl's Getopt::Std is supposed to behave according to the
> "standard".
>
> The only standard I can think of ishttp://www.unix.org/single_unix_specification/
> and as far as I can see it doesn't mandate one way or the other on
> this matter.

>From a very small and unscientific sample of commands on a GNU/Linux
box I have here it appears that the Getopt::Std behaviour is not
totally unprecedented.

And thinking about it, since there would be no way to quote the '-' it
_must_ be assumed that in @ARGV=('-s','-t') the '-t' is the optarg for
'-s'.



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

Date: 6 Feb 2007 10:13:51 -0800
From: "jhughe90" <jeffhughes1@yahoo.com>
Subject: Re: LibXML validation using an external DTD through a proxy?
Message-Id: <1170785631.870810.30920@l53g2000cwa.googlegroups.com>

On Jan 19, 10:59 am, "J. Gleixner" <glex_no-s...@qwest-spam-
no.invalid> wrote:
> jhughe90 wrote:
> > I'm trying to validate an XML doc usingLibXMLusing an external DTD.
> > The problem is the HTTP request needs to go through aproxy, andLibXML
> > doesn't seem to provide any support for this.  It doesn't support an
> > LWP UserAgent via any means nor does it process HTTPx_PROXY ENV
> > variables.  Anyone have any ideas on how to get this to work?
>
> Using my favorite Internet search engine, I found the following, which
> might help:http://use.perl.org/~perigrin/journal/31137

I think storing a DTD, that you don't own or publish, locally for
validation is bad idea.  There's no reason that proxy support can't be
added to LibXML.



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

Date: 3 Feb 2007 12:55:44 -0800
From: "490" <findingAri@gmail.com>
Subject: Re: Memory leak with XMLRPC and Perl...
Message-Id: <1170536144.066070.73560@l53g2000cwa.googlegroups.com>

On Feb 1, 7:10 pm, xhos...@gmail.com wrote:
> finding...@gmail.com wrote:
> > Hello,
> > I wrote a program in Perl (using version 5.8.4), that using XMLRPC to
> > communicate between the client and the server. The call from the
> > client to the server sitting in a infinite loop that can be run in
> > random inteval time.
> > After sometime that the client is running the perl's proccess taking
> > ~70MB of ram and ~100% of the CPU usage.
>
> Sounds more like a CPU leak than a memory leak.
>
> > May you know why?
>
> Not without seeing some code.
> I'd strace it.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> Usenet Newsgroup Service                        $9.95/Month 30GB

I'll try and explain myself.
I am writing a program in Perl that is bulit of a Server and a Client
that connect via XML-RPC.
The client has a infinite loop ( while(1) ), which inside it i call
the server.
After every call i make, the program goes to sleep for a minute (sleep
60;) then i make the call and so on and so on...
Thats why it is a infinite loop.
After sometime (dont know if its a day or more) that the client is
running the perl's proccess takes ~70MB of ram and ~100% of the CPU
usage.

Dose this help you to understand me more?

thanks alot,
490!



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

Date: 3 Feb 2007 22:43:17 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Memory leak with XMLRPC and Perl...
Message-Id: <Xns98CCAA18F3ABFcastleamber@130.133.1.4>

"490" <findingAri@gmail.com> wrote:

> I'll try and explain myself.

Without seeing actual code you can tell what the program does 1000 times, 
but still we can only guess what's going wrong.

Reduce the program to the smallest possible version that still has the 
problem. Sometimes when doing this you'll find the answer yourself. 
Otherwise, you will end up with a very short program people can have a 
look at, or even run on their own systems and see if they can reproduce 
the issue.

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: 8 Feb 2007 04:43:38 -0800
From: "axel" <partner@teamtrier.de>
Subject: mod_perl uploads
Message-Id: <1170938618.851998.48990@a75g2000cwd.googlegroups.com>

Hi!

Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
sinnvolle Fehlermeldung an den Browser zu senden,
bevor die gesamten Upload Daten geparst werden?

Danke,
Axel



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

Date: 8 Feb 2007 05:37:24 -0800
From: "axel" <partner@teamtrier.de>
Subject: Re: mod_perl uploads
Message-Id: <1170941844.692235.321540@j27g2000cwj.googlegroups.com>

On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
> Hi!
>
> Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
> sinnvolle Fehlermeldung an den Browser zu senden,
> bevor die gesamten Upload Daten geparst werden?
>
> Danke,
> Axel

Sorry - I'll try it in english:
Is there a way to abort too big uploads before the whole stream gets
parsed
and send a meaningful message back to the client?



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

Date: Thu, 08 Feb 2007 15:26:53 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: mod_perl uploads
Message-Id: <530qd5F1q8rplU1@mid.individual.net>

axel wrote:
> On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
>>Gibt es eine Möglichkeit zu grosse Uploads abzubrechen und eine
>>sinnvolle Fehlermeldung an den Browser zu senden,
>>bevor die gesamten Upload Daten geparst werden?
> 
> Sorry - I'll try it in english:
> Is there a way to abort too big uploads before the whole stream gets
> parsed
> and send a meaningful message back to the client?

The CPAN module CGI::UploadEasy does that.

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


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

Date: 8 Feb 2007 08:15:32 -0800
From: "axel" <partner@teamtrier.de>
Subject: Re: mod_perl uploads
Message-Id: <1170951332.790417.303740@a75g2000cwd.googlegroups.com>

On 8 Feb., 15:26, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> axel wrote:
> > On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
> >>Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
> >>sinnvolle Fehlermeldung an den Browser zu senden,
> >>bevor die gesamten Upload Daten geparst werden?
>
> > Sorry - I'll try it in english:
> > Is there a way to abort too big uploads before the whole stream gets
> > parsed
> > and send a meaningful message back to the client?
>
> The CPAN module CGI::UploadEasy does that.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

Just tried your module but It shows the same behaviour as CGI.pm or
mod_perl:
If I upload a bigger file - the script runs until the whole file is
received and then
returns with:
Error
Post too large: Maxsize 300 KiB exceeded.
What I'm looking for is a way to return immediately after
checking Content-Length



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

Date: 08 Feb 2007 17:06:50 GMT
From: xhoster@gmail.com
Subject: Re: mod_perl uploads
Message-Id: <20070208120720.413$GP@newsreader.com>

"axel" <partner@teamtrier.de> wrote:
> On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
> > Hi!
> >
> > Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
> > sinnvolle Fehlermeldung an den Browser zu senden,
> > bevor die gesamten Upload Daten geparst werden?
> >
> > Danke,
> > Axel
>
> Sorry - I'll try it in english:
> Is there a way to abort too big uploads before the whole stream gets
> parsed
> and send a meaningful message back to the client?

Probably not from the Perl side.  Often, the web server reads the entire
post before it hands it off to the CGI, and then gives the CGI a handle
onto the buffered data, rather a handle to read the data directly from the
network connection.  So you very well may need to look for something
specific either to the server itself, or to the mod_perl aspect of the
server.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 08 Feb 2007 18:28:07 GMT
From: xhoster@gmail.com
Subject: Re: mod_perl uploads
Message-Id: <20070208132837.654$UI@newsreader.com>

xhoster@gmail.com wrote:
> "axel" <partner@teamtrier.de> wrote:
> > On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
> > > Hi!
> > >
> > > Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
> > > sinnvolle Fehlermeldung an den Browser zu senden,
> > > bevor die gesamten Upload Daten geparst werden?
> > >
> > > Danke,
> > > Axel
> >
> > Sorry - I'll try it in english:
> > Is there a way to abort too big uploads before the whole stream gets
> > parsed
> > and send a meaningful message back to the client?
>
> Probably not from the Perl side.  Often, the web server reads the entire
> post before it hands it off to the CGI, and then gives the CGI a handle
> onto the buffered data, rather a handle to read the data directly from
> the network connection.  So you very well may need to look for something
> specific either to the server itself, or to the mod_perl aspect of the
> server.

Actually, I don't think this is possible at all using a single http
connection. It seems the browser refuses to read any of the response until
the server first reads the post in its entirety.  (This is why CGI reads
the entire post, just dumping it into /dev/null, when POST_MAX is
exceeded).  The server could drop the connection as soon as it realizes the
post is going to be too large, but then the browser will just report a
generic connection problem, rather than any specific error message you
might want it to.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Fri, 09 Feb 2007 00:35:21 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: mod_perl uploads
Message-Id: <531qhiF1pkt9rU1@mid.individual.net>

axel wrote:
> Gunnar Hjalmarsson wrote:
>>axel wrote:
>>>On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
>>>>Gibt es eine Möglichkeit zu grosse Uploads abzubrechen und eine
>>>>sinnvolle Fehlermeldung an den Browser zu senden,
>>>>bevor die gesamten Upload Daten geparst werden?
>>>
>>>Sorry - I'll try it in english:
>>>Is there a way to abort too big uploads before the whole stream gets
>>>parsed
>>>and send a meaningful message back to the client?
>>
>>The CPAN module CGI::UploadEasy does that.
> 
> Just tried your module but It shows the same behaviour as CGI.pm or
> mod_perl:
> If I upload a bigger file - the script runs until the whole file is
> received

Yes, the whole request will be transmitted before you'll be able to 
check content-length. Note that you asked about abortion before it gets 
_parsed_, not before it's _transmitted_.

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


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

Date: 8 Feb 2007 22:26:07 -0800
From: "axel" <partner@teamtrier.de>
Subject: Re: mod_perl uploads
Message-Id: <1171002367.804556.56570@h3g2000cwc.googlegroups.com>

On 9 Feb., 00:35, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> axel wrote:
> > Gunnar Hjalmarsson wrote:
> >>axel wrote:
> >>>On 8 Feb., 13:43, "axel" <part...@teamtrier.de> wrote:
> >>>>Gibt es eine M=F6glichkeit zu grosse Uploads abzubrechen und eine
> >>>>sinnvolle Fehlermeldung an den Browser zu senden,
> >>>>bevor die gesamten Upload Daten geparst werden?
>
> >>>Sorry - I'll try it in english:
> >>>Is there a way to abort too big uploads before the whole stream gets
> >>>parsed
> >>>and send a meaningful message back to the client?
>
> >>The CPAN module CGI::UploadEasy does that.
>
> > Just tried your module but It shows the same behaviour as CGI.pm or
> > mod_perl:
> > If I upload a bigger file - the script runs until the whole file is
> > received
>
> Yes, the whole request will be transmitted before you'll be able to
> check content-length. Note that you asked about abortion before it gets
> _parsed_, not before it's _transmitted_.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl

Ok, my mistake, I ment _transmitted_.
But with modperl FilterConnectionHandler I thought it to
be possible to examine the header before the tranfer is done.
Unfortunately I can't get this kind of handler be called with my
configuration...
But if it is true that the browser doesn't accept a custom response
before the transfer is done I must use a simple reject.
Thanks,
Axel



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

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 V11 Issue 108
**************************************


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