[24149] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6343 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 31 04:06:05 2004

Date: Wed, 31 Mar 2004 00:05:10 -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           Wed, 31 Mar 2004     Volume: 10 Number: 6343

Today's topics:
        Absolute and relative path <gna521g@tninet.se>
    Re: Absolute and relative path <lord-jacob@comcast.net>
        Bless, inheritance and swig (Xiaodong Huang)
    Re: Bless, inheritance and swig <bmb@ginger.libs.uga.edu>
    Re: Different @inc's for different users? <xxala_qumsiehxx@xxyahooxx.com>
    Re: Different @inc's for different users? <footnipple@indiatimes.com>
    Re: INSERT statement works by itself but not in the scr <trammell+usenet@hypersloth.invalid>
    Re: Lost data on socket - Can we start over politely? (Vorxion)
    Re: Lost data on socket - Can we start over politely? <tassilo.parseval@rwth-aachen.de>
    Re: Module compilation misery <spamtrap@dot-app.org>
        multiple lines / success or failure?! <geoffacox@dontspamblueyonder.co.uk>
    Re: multiple lines / success or failure?! <postmaster@castleamber.com>
    Re: multiple lines / success or failure?! <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: multiple lines / success or failure?! <geoffacox@dontspamblueyonder.co.uk>
    Re: multiple lines / success or failure?! <geoffacox@dontspamblueyonder.co.uk>
    Re: multiple lines / success or failure?! <spamtrap@dot-app.org>
    Re: perl modules -> RPM resources??? <mattdm@mattdm.org>
    Re: perl modules -> RPM resources??? <vek@station02.ohout.pharmapartners.nl>
        Problem with CGI.pm POST_MAX <bryan@akanta.com>
    Re: Question Regarding LWP <uri.guttman@fmr.com>
    Re: Remove empty elements of an array <bmb@ginger.libs.uga.edu>
    Re: Remove empty elements of an array <jurgenex@hotmail.com>
        Spawn child processes - VMS perl 5.6.1 <Patrick_member@newsguy.com>
    Re: Syntax error <tadmc@augustmail.com>
        using alarm with File::Tail (Keith Michaels)
    Re: validate links?? <invalid-email@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 31 Mar 2004 07:26:46 +0200
From: "Bengan" <gna521g@tninet.se>
Subject: Absolute and relative path
Message-Id: <c4dkuj$11t$1@green.tninet.se>

Newbie question:
Please expalin the difference between absolute and relative path.

Regards Berrna




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

Date: Wed, 31 Mar 2004 05:26:41 GMT
From: Jacob Heider <lord-jacob@comcast.net>
Subject: Re: Absolute and relative path
Message-Id: <e46a0a02b28e6fe477de0d02ba8982c8@news.teranews.com>

On Wed, 31 Mar 2004 07:26:46 +0200, Bengan wrote:

> Newbie question:
> Please expalin the difference between absolute and relative path.
> 
> Regards Berrna

Absolute path starts with the character '/'. It is relative to the root
directory (or root of a drive under Windows). Relative paths start with
any other character. They are relative to the current working directory.

HTH
Jacob

P.S. Was this about Perl?


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

Date: 30 Mar 2004 16:17:13 -0800
From: xhuang@yahoo.com (Xiaodong Huang)
Subject: Bless, inheritance and swig
Message-Id: <d20a1c88.0403301617.583439a3@posting.google.com>

I searched but could not find answer for this question on Internet or
in Newsgroups.

I have a class CObject in C++ which is wrapped by SWIG:

class CObject {
public:
  CObject();
  get();
}

I want to write a perl object that inherits from
CObject. So I wrote something like this (I used similar code
before in non-SWIG case):

Package MyPerlObject;

use Exporter;
use CObject;

our @ISA = qw(CObject Exporter);

sub new {
    my  $class  = shift ;
    $class      = ref($class) || $class ;
    my  $self   = CObject->new();
    bless $self, $class;
    return $self;
}

 ...

MyPerlObject does not have a method get(). When client of MyPerlObject
called MyPerlObject::get() at run-time, I got
"No matching function for overloaded CObject_get()".

So I tried to pinpoint where the problem was and found that it seemed
to have something to do with bless.

I modified the above new() subroutine by adding two lines:

sub new {
    my  $class  = shift ;
    $class      = ref($class) || $class ;
    my  $self   = CObject->new();
    $self->get();        # works
    bless $self, $class;
    $self->get();        # does not work
    return $self;
}

The line before "bless" statement works but the line after it gives me
the "No matching function .." error as before.

Could someone point to me what I did wrong or suggest a way to work around
the problem?

Thanks.

xh


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

Date: Tue, 30 Mar 2004 21:27:22 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Bless, inheritance and swig
Message-Id: <Pine.A41.4.58.0403302118580.14252@ginger.libs.uga.edu>

On Tue, 30 Mar 2004, Xiaodong Huang wrote:

> I searched but could not find answer for this question on Internet or
> in Newsgroups.
>
> I have a class CObject in C++ which is wrapped by SWIG:
>
> class CObject {
> public:
>   CObject();
>   get();
> }
>
> I want to write a perl object that inherits from
> CObject. So I wrote something like this (I used similar code
> before in non-SWIG case):
>
> Package MyPerlObject;
--^
s/P/p/;


>
> use Exporter;

FWIW, you probably don't need Exporter.


> use CObject;
>
> our @ISA = qw(CObject Exporter);
>
> sub new {
>     my  $class  = shift ;
>     $class      = ref($class) || $class ;
>     my  $self   = CObject->new();
>     bless $self, $class;
>     return $self;
> }
>
> ...
>
> MyPerlObject does not have a method get(). When client of MyPerlObject
> called MyPerlObject::get() at run-time, I got
> "No matching function for overloaded CObject_get()".
>
> So I tried to pinpoint where the problem was and found that it seemed
> to have something to do with bless.
>
> I modified the above new() subroutine by adding two lines:
>
> sub new {
>     my  $class  = shift ;
>     $class      = ref($class) || $class ;
>     my  $self   = CObject->new();
>     $self->get();        # works
>     bless $self, $class;
>     $self->get();        # does not work
>     return $self;
> }
>
> The line before "bless" statement works but the line after it gives me
> the "No matching function .." error as before.
>
> Could someone point to me what I did wrong or suggest a way to work around
> the problem?
>
> Thanks.
>
> xh
>

package CObject;

sub get { print "CObject::get ran\n" }
sub new { bless {}, $_[0] }

package MyPerlObject;

our @ISA = qw(CObject);

sub new {
    my  $class  = shift ;
    $class      = ref($class) || $class ;
    my  $self   = CObject->new();
    $self->get();        # works
    bless $self, $class;
    $self->get();        # does not work (does now)
    return $self;
}

my $o = MyPerlObject->new();

__END__
CObject::get ran
CObject::get ran


Hope that helps,

Brad


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

Date: Tue, 30 Mar 2004 23:14:05 GMT
From: "Ala Qumsieh" <xxala_qumsiehxx@xxyahooxx.com>
Subject: Re: Different @inc's for different users?
Message-Id: <1bnac.16704$942.8600@newssvr27.news.prodigy.com>

"sdfgsd" <footnipple@indiatimes.com> wrote in message
news:u%hac.352063$B81.5230606@twister.tampabay.rr.com...

> So now I'm running a few scripts (same old perl executable) as a regular
> user and as root and they both seem to be using different @inc's from the
> two different libs!

Are you sure it's the same executable?
Do a 'which perl' from both accounts and see. I had that problem once and it
was due to a mangled $PATH which picked up a different version.

--Ala




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

Date: Wed, 31 Mar 2004 00:07:37 GMT
From: "sdfgsd" <footnipple@indiatimes.com>
Subject: Re: Different @inc's for different users?
Message-Id: <dZnac.362695$Po1.248008@twister.tampabay.rr.com>


"Ala Qumsieh" <xxala_qumsiehxx@xxyahooxx.com> wrote in message
news:1bnac.16704$942.8600@newssvr27.news.prodigy.com...
> "sdfgsd" <footnipple@indiatimes.com> wrote in message
> news:u%hac.352063$B81.5230606@twister.tampabay.rr.com...
>
> > So now I'm running a few scripts (same old perl executable) as a regular
> > user and as root and they both seem to be using different @inc's from
the
> > two different libs!
>
> Are you sure it's the same executable?
> Do a 'which perl' from both accounts and see. I had that problem once and
it
> was due to a mangled $PATH which picked up a different version.

Oh jeez! Thanks.




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

Date: Wed, 31 Mar 2004 02:14:28 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: INSERT statement works by itself but not in the script??
Message-Id: <slrnc6kac4.2v5.trammell+usenet@hypersloth.el-swifto.com.invalid>

On Tue, 30 Mar 2004 10:22:39 -0600, Bing Du <bdu@iastate.edu> wrote:
> mysql> INSERT INTO ltm_ssn (ltm_number,ssn,notes) SELECT 
> source_data.crse, source_data.ssn, old_ltm_ssn.notes FROM source_data 
> LEFT JOIN old_ltm_ssn ON source_data.crse=old_ltm_ssn.ltm_number AND 
> source_data.ssn=old_ltm_ssn.ssn WHERE source_data.offer_dept_abrvn='L TM;
> Query OK, 485 rows affected (0.03 sec)
> Records: 485  Duplicates: 0  Warnings: 0

That doesn't look like valid SQL to me.

Perhaps your quoting is off?



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

Date: 30 Mar 2004 21:32:54 -0500
From: vorxion@knockingshopofthemind.com (Vorxion)
Subject: Re: Lost data on socket - Can we start over politely?
Message-Id: <406a2dd6$1_1@news.iglou.com>

In article <4069a132.0@juno.wiesbaden.netsurf.de>, Thomas Kratz wrote:
>
>Instead please try this server ( some quickly reduced code from a bigger 
>server ) and mini client. If this works for you, you could extend it.
>I don't loose any data with this setup. And I don't even bother to set 
>unbuffered mode (tested on Win32).

It does indeed work.  This is the best sign I've seen in a week, since I've
been afraid it's simply not possible to do this, although I figured it was
a goof on my end.

I note that if I decrease the input chunks from 1024 down to 1, and that's
the -only- change I make to yours, it will eventually exhibit exactly what
I'm experiencing in my own server, which is a premature end of data--and
in your case, a disconnect of the client due to how you coded the error
checking--after about 30k.

Given that, I strongly suspect that my problem is taking expensive
time to sniff the first 15-20 bytes of each packet individually to
find the application level packet lengths and a first internal packet
separator, even though once I have the length I'm trying to read the
rest of the packet at the full listed size of the packet.  I'm talking
application-level packets here, not TCP packets.

In short, I think my code is simply lagging behind, and when it lags far
enough, the rest of the data vanishes.  I'm working on fixing that bit, and
I'll also have to prioritize it so that when data is present, it stops
working on processing its data internally and goes immediately back to
reading from the socket.  And I'm simply going to have it scarf up as much
data as is present and basically parse and process when there is no
actual communication going on.  That should (hopefully) elminiate the
problem.

>If you look at the server code, you'll get an idea what is meant by "a 
>small but complete sample to reproduce the problem". The base 
>functionality you need is in there. And if I were able to understand, what 
>your code tries to do, I would be able to shorten it to that level too.

Well, mine is multiplexing--it's meant to take in more than one connection
at a time.  Yours was written with a single connection in mind, although it
demonstrates perfectly that buffering shouldn't be an issue, even at 1k
block sizes.  The multiplexing is what's complicated mine so much.  :)

Thanks for the working example, and for the hope!

-- 
Vorxion - Member of The Vortexa Elite


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

Date: 31 Mar 2004 06:27:03 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Lost data on socket - Can we start over politely?
Message-Id: <c4dobn$kss$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Vorxion:

> In article <4069a132.0@juno.wiesbaden.netsurf.de>, Thomas Kratz wrote:

>>    foreach my $sock ( $sel->can_read(0.05) ) {
>>
>>       if ( $sock == $srv ) {
>>
>>          my $new = $srv->accept();
>>          $new->autoflush(1);
>>          print $log "new connection from ", $new->peerhost,
>>                ':', $new->peerport, "\n";
>>          $sel->add($new);
>>
>>          next;
>>       }
>>
>>       my $buf = '';
>>       my $clsel = IO::Select->new($sock);

> That, and one thing is curious--the docs for foreach() say that adding and
> removing elements from something from a list used for the loop is a Bad 
> Thing[tm].  You're modifying $sel any time there's a connect or disconnect.
> Doesn't that throw the foreach() loop out of sync?  Not at all a criticism,
> it's just that I've had fresh experience with foreach() and changed lists
> and elements thereof, and that part of the docs is fresh in my mind.  I'm
> curious why this causes no difficulties in your example.

That's ok in this case. What happens is this:

    foreach my $sock ( $sel->can_read(0.05) ) {

Here, 'foreach' loops over a temporary list returned by
$sel->can_read(0.05). can_read() is called _once_ (by the time perl
enters the loop) and perl saves its return values in this temporary
list.

And now when

    $sel->add($new);

happens, it only changes the state of the IO::Select object. The list is
not affected by that. The whole procedure is really this:

    my @temp = $sel->can_read(0.05);
    foreach my $sock (@temp) {
	...
	$sel->add($new);
	...
    }

This should make clear why adding sockets to the select-object is not
going to hurt the foreach-loop.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Tue, 30 Mar 2004 19:00:14 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Module compilation misery
Message-Id: <qf2dnTptzrBilPfd4p2dnA@adelphia.com>

Garry Heaton wrote:

> Please don't take this as a troll as I would like to hear how other Perl
> programmers deal with failed module compilation.

I try the simplistic "install Module::Name" in the CPAN shell first. If that
fails, I check the module docs to see if Makefile.PL needs additional
switches to install properly. If it does, I use "look Module::Name" to
download and unwrap the module package, and then run Makefile.PL and
friends manually.

That covers most of the problems. Occasionally I'll need to install a C
library that the Perl module depends on.

> because module compilation is so hit and miss. I have experienced failed
> compilations of many modules lately on both Mac OSX Panther and Fedora
> Core 1 (DBD::mysql, HTML::Mason, mod_perl and others)

I can't say anything about RedHat, but I've installed DBD::mysql several
times on Panther. I've found that it's trouble-free, provided that you do
two things:

1. Apply this patch described by Ed Moy (Apple engineer):
        <http://www.mail-archive.com/macosx@perl.org/msg05736.html>

2. Follow the instructions for providing the appropriate options to
Makefile.PL. The simplistic "install DBD::mysql" won't work; in many cases
it will fail to find the MySQL headers and libraries, and in all cases the
test scripts need to know the host/database/user/password to test with.

For HTML::Mason, the simplistic approach worked perfectly on my Panther
machine. The CPAN shell automatically found and installed all of the
dependencies, and every one of the modules' self-tests passed.

Anyway, this is mostly off-topic for this group. Try posting to
c.l.p.modules (f'ups set), or to the macosx list at lists.perl.org.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 31 Mar 2004 06:50:18 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: multiple lines / success or failure?!
Message-Id: <agpk60pbcbfp55llfu2pjkntt10pctfpui@4ax.com>

Hello

Re my previous posting on how to capture successive blocks of text
between <p> and </p> where the </p> is not on the first line of the
blocl of text in an html file ....

The only way that I have been able to extract the text and place it in
the correct place in the newly created file has been to edit all the
original html files so that the <p> and the </p> are on the same line,
ie instead of

<p>sjdhjhsjdhjhs
sjdjksjdkksj
jskdjkjs</p>

I have 

<p>sjdhjhsjdhjhs sjdjksjdkksj jskdjkjs</p>

This is a failure on my part! 

I have not tried HTML::Parser yet as I cannot find any help info to
get me started. All seen so far assume more than I know or understand
on OOP. I am back to where I was once on the use of ODBC when
eventually I found a little help and wrote my own steps 1 to 10 to
implement a simple example of this data base / CGI connectivity...

I am using Active Perl and Windows 98 and have tried to get the text
over multiple lines using

local $/ = "\0d\0a";

but the odd thing is that I have been ablle to get multiple lines of
text from a text version of an sql file with the default $/ value
using

sub intro {

my ($pathhere) = @_;
   open (INN, "d:/keep/sqlfile.txt");
my $lineintro;
# my $lineintro = <INN>;
       while (defined ($lineintro = <INN>)) {
              if ($lineintro =~ /$pathhere','(.*?)'\)\;/) {
               print OUT ("<tr><td>$1 <p> </td>\n");
                                                          }
                                            }
          }

and when I look at this sql text file using a hex editor I can see
that at the end of the block of text is 0D0A which is the same as the
<p> multiple lines </p> block in the html file but there I could not
get the text without breaking the rest of the Perl code...with or
without $/ = "\0d\0a";

Well, I could go on and on but I would like to use the HTML::Parser so
look forward to hearing about some intro type info with sample scripts
on its use! Or any Perl books which do this? Perhaps the latest Perl
O'Reilly books are OK?

Cheers

Geoff


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

Date: Wed, 31 Mar 2004 00:54:58 -0600
From: John Bokma <postmaster@castleamber.com>
Subject: Re: multiple lines / success or failure?!
Message-Id: <406a6ba7$0$24344$58c7af7e@news.kabelfoon.nl>

Geoff Cox wrote:

> Hello
> 
> Re my previous posting on how to capture successive blocks of text
> between <p> and </p> where the </p> is not on the first line of the
> blocl of text in an html file ....

slurp your file in one scalar (search google, perl slurp mode)

find out how you can do minimal matching, or non-greedy matching

find out how you can match a new line (\n) with .

-- 
John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/


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

Date: Wed, 31 Mar 2004 09:32:36 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: multiple lines / success or failure?!
Message-Id: <Xns94BD6054BA838elhber1lidotechnet@62.89.127.66>

John Bokma <postmaster@castleamber.com> wrote:

> Geoff Cox wrote:
> 
>> Hello
>> 
>> Re my previous posting on how to capture successive blocks of text
>> between <p> and </p> where the </p> is not on the first line of the
>> blocl of text in an html file ....


It would have been so much more helpful to the OP if you'd actually 
told him where to look.


> slurp your file in one scalar (search google, perl slurp mode)


Why search google when the docs have the information?


   perldoc perlvar (look for $/)


> find out how you can do minimal matching, or non-greedy matching


  perldoc perlretut
  perldoc perlre

 
> find out how you can match a new line (\n) with .


  perldoc perlop (look for m/PATTERN/cgimosx)


-- 
Cheers,
Bernard


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

Date: Wed, 31 Mar 2004 07:52:05 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: multiple lines / success or failure?!
Message-Id: <mutk60d980bie3rgprb04ci86f9lh3hd2u@4ax.com>

On Wed, 31 Mar 2004 09:32:36 +0200, "Bernard El-Hagin"
<bernard.el-haginDODGE_THIS@lido-tech.net> wrote:

John,

>It would have been so much more helpful to the OP if you'd actually 
>told him where to look.

I realised that too late!
>
>> slurp your file in one scalar (search google, perl slurp mode)
>
>
>Why search google when the docs have the information?
>
>
>   perldoc perlvar (look for $/)

have already done this but U guess I just missed the obvious?


>> find out how you can do minimal matching, or non-greedy matching
>
>
>  perldoc perlretut
>  perldoc perlre

I have been using the ? in say /<p>(.*?)<\/p>/s but perhaps that is
not sufficient?
 
>> find out how you can match a new line (\n) with .

>  perldoc perlop (look for m/PATTERN/cgimosx)

will do ...

Thanks

Geoff



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

Date: Wed, 31 Mar 2004 07:52:46 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: multiple lines / success or failure?!
Message-Id: <n5uk60ps02cobsgqfkmgd9442opu8r3nkr@4ax.com>

On Wed, 31 Mar 2004 00:54:58 -0600, John Bokma
<postmaster@castleamber.com> wrote:

>Geoff Cox wrote:
>
>> Hello
>> 
>> Re my previous posting on how to capture successive blocks of text
>> between <p> and </p> where the </p> is not on the first line of the
>> blocl of text in an html file ....
>
>slurp your file in one scalar (search google, perl slurp mode)
>
>find out how you can do minimal matching, or non-greedy matching
>
>find out how you can match a new line (\n) with .

John,

Thanks - will look again at these !

Thanks

Geoff



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

Date: Wed, 31 Mar 2004 02:55:33 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: multiple lines / success or failure?!
Message-Id: <kd-dnV9Z_Y345PfdRVn-gw@adelphia.com>

Geoff Cox wrote:

> I have not tried HTML::Parser yet as I cannot find any help info to
> get me started. All seen so far assume more than I know or understand
> on OOP.

These will help get you started with objects:

perldoc perlboot
perldoc perltoot
perldoc perltooc
perldoc perlobj
perldoc perlbot

The web site <http://learn.perl.org> has a list of recommended books.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 31 Mar 2004 00:10:24 GMT
From: Matthew Miller <mattdm@mattdm.org>
Subject: Re: perl modules -> RPM resources???
Message-Id: <slrnc6k33e.npu.mattdm@jadzia.bu.edu>

Gerald Jones <gj@freeshell.org> wrote:
> Does anyone know of a howto or tutorial on creating RPMs from regular
> tarballs of perl modules?

take a look at cpanflute2 in RPM::Specfile.

-- 
Matthew Miller           mattdm@mattdm.org        <http://www.mattdm.org/>
Boston University Linux      ------>                <http://linux.bu.edu/>


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

Date: 31 Mar 2004 07:29:00 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: perl modules -> RPM resources???
Message-Id: <slrnc6ksps.41b.vek@station02.ohout.pharmapartners.nl>

On Tue, 30 Mar 2004 21:54:01 +0000 (UTC),
    Gerald Jones <gj@freeshell.org> wrote:


> Hello,
>
> Does anyone know of a howto or tutorial on creating RPMs from regular tarballs
> of perl modules?
>

A quick and dirty solution is to install the perl module the normal way, get
the contents of .packlist and put that in the spec file.  With empty %build
and %install sections and the contents of .packlist in the %files section
you can quickly build a rpm package.  Otherwise you can download various
 .src.rpm packages for perl modules from various linux ditributions and see
how it may be done.


Villy


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

Date: Wed, 31 Mar 2004 00:56:33 GMT
From: Bryan <bryan@akanta.com>
Subject: Problem with CGI.pm POST_MAX
Message-Id: <5Hoac.44432$bV3.18407@newssvr25.news.prodigy.com>

I have a script that uses the following code:
$CGI::POST_MAX = 1024 * 100; # Set 100K limit on uploads

my $file = param("upload");
 

## Trap exceeded file size error from CGI::POST_MAX
if (!$file && cgi_error()) {
   print header();
   print "<script language=JavaScript type=text/javascript>\n";
   print "history.back(1);";
   print "alert(\'File size exceeded- There is currently a 100kb max per 
upload file\');";
   print "</script>";
}

I have used this before and it worked fine.  Now, with a newer version 
of CGI.pm (> 3.0) this functionality no longer works at all.  When 
trying to upload a too-large file, the server (apache) just hangs until 
it times out.  It never seems to either catch the cgi_error(), or 
perhaps the error is no longer thrown.

Anyone have any ideas what to do?

Thanks,
Bryan



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

Date: 30 Mar 2004 16:08:22 -0500
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: Question Regarding LWP
Message-Id: <siscr7vadovt.fsf@tripoli.fmr.com>

>>>>> "DP" == Douglas Pollock <pgmr400@hotmail.com> writes:

  DP> I just bought the book Spidering Hacks By Kevin Hemenway, Tara Calishain.

  DP> One of their examples includes the following partial code:

  DP> if ($libloc = $ENV{'LIBWWW_PERL'}) { unshift(@INC, $libloc); }

  DP> require "getopts.pl";
  DP> require "www.pl";
  DP> require "wwwurl.pl";
  DP> require "wwwerror.pl";

GACK!! that is such old perl4 stuff. if the rest of the book is like
that then burn it. get Perl and LWP which uses LWP itself, not some
ancient crap. the libwww that activestate has is LWP.

also the LWP docs themselves are fairly decent. check out its
cookbook.

uri


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

Date: Tue, 30 Mar 2004 21:34:58 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Remove empty elements of an array
Message-Id: <Pine.A41.4.58.0403302133450.14252@ginger.libs.uga.edu>

On Tue, 30 Mar 2004, fenisol3 wrote:

> Hello,
>
> What I am trying to do is to go through each element in an array using
> foreach loop, delete the elements that are empty (blank spaces), and store
> the rest in another array. Each element is intentionally separated by
> commas. If you know how to do this, please help me. Thanks.
>  -Fenisol3

Separated by commas?  What kind of array is that exactly?

Regards,

Brad


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

Date: Wed, 31 Mar 2004 03:08:53 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Remove empty elements of an array
Message-Id: <9Dqac.22364$u_2.6533@nwrddc01.gnilink.net>

fenisol3 wrote:
> What I am trying to do is to go through each element in an array using
> foreach loop, delete the elements that are empty (blank spaces), and
> store the rest in another array. Each element is intentionally
> separated by commas. If you know how to do this, please help me.

Please see "perldoc -f grep". That seems to do what you are asking for.
Please note, you should be very clear about what you want to retain/delete.
An element that contains blanks or spaces is not "empty".

jue




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

Date: 30 Mar 2004 21:58:54 -0800
From: Patrick Flaherty <Patrick_member@newsguy.com>
Subject: Spawn child processes - VMS perl 5.6.1
Message-Id: <c4dmmu01i81@drn.newsguy.com>

Hi,

I'm going through perlipc etc trying to refresh my memory as to how this
UNIX-style IPC stuff works.

Want to spawn several (say 5) child processes; then sit waiting in the parent;
get signals when they've finished; and if all is OK continue with the code in
the parent.

  However it seems that in VMS perl 5.6.1 I have no fork():


VMSNODE>perl -v

This is perl, v5.6.1 built for VMS_AXP

Copyright 1987-2001, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

VMSNODE>type test2.pl

fork();

VMSNODE>perl test2.pl
The Unsupported function fork function is unimplemented at test2.pl line 2.
%SYSTEM-F-ABORT, abort
VMSNODE>

  Is there any way, under these conditions, to get from here to there?

  pat



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

Date: Tue, 30 Mar 2004 19:07:32 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Syntax error
Message-Id: <slrnc6k6ek.1n6.tadmc@magna.augustmail.com>

Martin L. <mjpliv@eastlink.ca> wrote:
> Brian McCauley <nobull@mail.com> wrote in message news:<u965cm8sl9.fsf@wcl-l.bham.ac.uk>...

>> First a but of general advice...
>> 
>> You should always declare all variables as lexically scoped in the
>> smallest applicable lexical scope unless you have a positive is a
>> reason to do otherwise. BTW: this is not perculliar to Perl, it


> With regards to your advice, I am not familiar with the term
> "lexically" but I am guessing that it refers to declaring my variables
> as I first use them rather than a list at the beginning of the script.


You have guessed correctly.

See also:

   "Coping with Scoping":

      http://perl.plover.com/FAQs/Namespaces.html


> If that is the accepted convention then I will start doing so. 


Your life will become easier as a result.


> I am
> learning from a book that did't cover that. 


There are lots of bad Perl books. More bad ones than good ones in fact...


> It also showed the
> external subroutines without the "use strict" line and I assumed it
> was not needed. 


"use strict" is not needed (but it helps with the unexpected).

Seatbelts are not needed either (but they help with the unexpected).


> I do "use strict" in all of my normal perl scripts. I


I like you.


> added both the "use strict" and "use warnings" line, corrected my two
> typo's uploaded it back to my server. I got an error to the effect
> that could not locate files required to use warnings so I removed the
> "use warnings" line and everything runs just fine.


You have an ancient version of perl.

You can use the -w command line switch instead, until that dinosaur dies.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 30 Mar 2004 23:33:26 GMT
From: krm@sdc.cs.boeing.com (Keith Michaels)
Subject: using alarm with File::Tail
Message-Id: <HvExFq.A62@news.boeing.com>

File::Tail doesn't seem to work with alarm, probably because it
uses sleep internally.  Is there a way around this??  I need to
wake up the File::Tail->read periodically to flush some buffers
and then resume the Tail where it left off.  Do I need another
thread for that??  A sample of this would be appreciated!!
-K


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

Date: Wed, 31 Mar 2004 00:40:46 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: validate links??
Message-Id: <406A1351.8090002@rochester.rr.com>

Dan Pelton wrote:

> Whats the best way to check for broken links on a web page. These links 
> goto to CGIs and some of the links a redirected. I tried the code below 
> from the perl cook book. It works fine for links to html pages only.
> 
> "churl.pl http://www.ams.org" reports that http://www.ams.org/eims is 
> BAD, but it is a valid URL.


Hmmmm...when I run your code verbatim, it reports that all 131 links are 
OK, including the one above you say prints BAD.  Not sure where the 
problem is.  I'm running AS Perl build 806 on Windoze 98SE.


 ...
> Dan
 ...

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

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 6343
***************************************


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