[17492] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4912 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 17 14:10:46 2000

Date: Fri, 17 Nov 2000 11:10:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974488212-v9-i4912@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 17 Nov 2000     Volume: 9 Number: 4912

Today's topics:
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
    Re: Problems saving an uploaded file. (Garry Williams)
    Re: question about canned perl script--thanks! rdayk@my-deja.com
        System command nodo70@my-deja.com
        test suweiyi@supanet.com
    Re: tree-sync.pl <ekulis@apple.com>
    Re: Unix, Perl and the TOP command <elaine@chaos.wustl.edu>
        use error, permissions? Help! <nathanday@my-deja.com>
    Re: Use of uninitialized value in hash slice <rick.delaney@home.com>
    Re: Use of uninitialized value in hash slice (Tad McClellan)
    Re: Use of uninitialized value in hash slice <ren.maddox@tivoli.com>
    Re: Why are references useful? <ronnie@catlover.com>
        Win32 Socket server problem <stuart.maccallum@wisesystems.co.uk>
    Re: Win32 Socket server problem <ddunham@redwood.taos.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3gh0$60n$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3jmo$ea6$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3mhh$koc$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3o9p$o9e$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3q21$rq1$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3rq9$1r5$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 15:58:08 +0100
From: "Johan Ditmar" <johan.ditmar@era.ericsson.se>
Subject: Problems saving an uploaded file.
Message-Id: <8v3tii$570$1@newstoo.ericsson.se>

Hi all,

I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
the following problem. I want to upload a file from a webpage and save it at
a server. I am using the following code to do that:

   $bitfile = param("bitfile");

   open (SAVE,">./bitfile.bit") || die $!;
   binmode(SAVE);

    while ( read($bitfile,$data,1024) ) {
      print SAVE $data;
    }
   close SAVE;

What it does is that it takes the file handle and then saves the clients
file under 'bitfile.bit' on the server.

Sometimes this works, but many times it happens that the file is not saved
(it is created, but has size 0 or is only 1 byte long). I have enough space
on my disk and enough memory. Could this be a bug?

Johan




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

Date: Fri, 17 Nov 2000 17:53:07 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Problems saving an uploaded file.
Message-Id: <7geR5.781$xb1.48894@eagle.america.net>

On Fri, 17 Nov 2000 15:58:08 +0100, Johan Ditmar
<johan.ditmar@era.ericsson.se> wrote:
>Hi all,
>
>I am using Apache 1.3 together with ActiveState Perl 5.6.0.618 and I have
>the following problem. I want to upload a file from a webpage and save it at
>a server. I am using the following code to do that:

[snip]

This happens to be the *fifth* identical post I've seen show up in the
last hour.  

YOU CAN STOP NOW.  

-- 
Garry Williams


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

Date: Fri, 17 Nov 2000 18:09:00 GMT
From: rdayk@my-deja.com
Subject: Re: question about canned perl script--thanks!
Message-Id: <8v3s7m$srt$1@nnrp1.deja.com>

Well, thanks Jeff. I have removed the perl script and all the
associated files from our virtual directory. I don't have access to the
actual server, we rent a web host on a monthly basis. No idea if it it
is UNIX, probably is though but I don't have a shell account. And of
course, I downloaded Perl for Windows, from perl.com. There is no file
called Perl.exe on my HDs. I uninstalled perl.

There are already some perl scripts in our virtual directory. A broken
search engine and some pages that were formerly used to place
subscription orders for our magazine. So there must be perl, I guess.
Naturally security is of concern to us but since we are going to change
web hosts I will opt-out of perl on the new server. I dream that we
will hire some programmer consultants but I don't think this will ever
happen.

I am more of a web programmer than an applications programmer, so I
always want things to be finished as quickly as possible. I am studying
for the Java certification test. I also like ASP, but I think of myself
as a webmaster primarily.

Thanks for your assistance.
Rachel





In article <3A146D40.AB38B452@vpservices.com>,
  Jeff Zucker <jeff@vpservices.com> wrote:
> rdayk@my-deja.com wrote:
> >
> > I am using a "canned" perl script to track hits. It appears to be
> > working but I don't think perl is residing in any of our virtual
> > directories.
>
> If it is a Perl script and it works, then you must have a perl
> executable lying around somewhere.  If you are on *nix, type "which
> perl" on the command line to find out where the executable is loated
or
> type perl -v or perl -V to get more info about the installed version
of
> perl.  If you are on windoze, use the start menu find to locate
> perl.exe.  If you are on something else, use whatever file search
tools
> are available to look for it.
>
> >I asked the previous webmaster and he doesn't know if we
> > have perl or not. So I downloaded a binary version of perl. Now I
would
> > like to FTP it to the appropriate virtual directory, but I don't
know
> > which files have to be sent.
>
> You are better off logging on to the server and FTPing the binary
from a
> trusted source like www.perl.com or www.activestate.com and then
> performing the installation there on your server.  Installation is not
> usually simply a matter of files, but also of things like environment
or
> registry settings depending on your OS.
>
> > I want to send perl to our server then delete it from my HD it is
> > taking up too much space and I am not a programmer, just a lowly
> > webmaster. Which file should I send?
>
> Unless your local computer is exactly the same operating system as
your
> web server this won't work.  If the OSs are the same and you
downloaded
> a binary that was part of a self-installing executable, it is that
> executable rather than any of the files it installed that you would
want
> to FTP to the server and run the self-installing executable there.
>
> P.S. If you are, by your own definition "not a programmer", I am not
> sure how wise it is to install perl and perl scripts on your server
> unless you will be hiring consultants whom you trust to manage it for
> you.
>
> --
> Jeff
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 17 Nov 2000 18:19:43 GMT
From: nodo70@my-deja.com
Subject: System command
Message-Id: <8v3srm$te0$1@nnrp1.deja.com>

Anyone knows what is wrong with this line since it complain "cmp:
Unknown option -"?
$result = system ("cmp", "-s $file1 $file2");

Thanks,
nodo


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 17 Nov 2000 15:00:54 GMT
From: suweiyi@supanet.com
Subject: test
Message-Id: <8v3h76$3eh$1@fennel.nnrp.netline.net.uk>

This is the body of the article


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

Date: Fri, 17 Nov 2000 10:31:51 -0800
From: Ed Kulis <ekulis@apple.com>
To: guthrie_linck@my-deja.com
Subject: Re: tree-sync.pl
Message-Id: <3A157996.296A71A2@apple.com>

I've considered using  rsync and I'll look into it more.

I liked the idea of tree-sync.pl because it produces a table of the
differences between the trees and a straight forward perl script that
contains the perl instructions necessary to duplicate the trees based on
the latest timestamps and which files exist in each tree.

I'd also like to leave some files like *.log, *.tmp so that you don't
duplicate the inevitable junk that harried programmers leave laying
around.

-ed


guthrie_linck@my-deja.com wrote:

> what about using rysnc?
>
> rsync can run locally. download and compile rsync.samba.org
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Fri, 17 Nov 2000 18:34:59 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: Unix, Perl and the TOP command
Message-Id: <nTeR5.14695$AM5.277641@news1.nokia.com>

"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrn91a1oi.4v9.rgarciasuarez@rafael.kazibao.net...
> vivekvp wrote in comp.lang.perl.misc:
> >
> > I have a Unix system.  I want to check for zombie processes.  The way
I
> > am determining this is those processes that have a time of greater
than
> > 30 minutes.
> Bad. Daemons or X servers have typically a time larger than 30 minutes
> (if the machine's uptime is long enough).

Time is not the way to judge whether or not something is a defunct or
zombified orphan process.

> The perl program you want may get the info from ps, something like the
> following one-liner :
>   perl -e 'kill 9, map { (split " ",$_)[1] } grep /<defunct>/,`ps -ef`;'

Kill -9 on random strings from ps -ef is enough to give you grey hairs
after a few reboots. A zombie is the orphaned process of parent process
who died and when the kernel realises this it makes it a child of init
which should do the right thing and call wait so they can die. This means
the PPID for the zombie, a real zombie, is 1..but so are all your daemons
so you may just accidentally knock off most of your system daemons if you
look for PPID of 1. If something is owned by a mere user and has a PPID =
1 then it's a good bet, but not absolutely sure, that it's a zombie.

    UID     PID  PPID  C STIME TTY  TIME CMD
    foobar  8140     1  0   Nov 03 ?        0:02 mutt

This is an example of a zombie. Now, I know mutt wasn't started at boot
time with init, it doesn't show that it's defunct but the kernel has given
it to init to try and make it go away nicely.

Most modern kernels are very good about cleaning up the zombies these days
so you probably don't need to worry about killing them manually. If you do
have an abundance of them, you probably need to examine your code far more
than worry about killing orphans.

e.





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

Date: Fri, 17 Nov 2000 18:13:22 GMT
From: Nathan Day <nathanday@my-deja.com>
Subject: use error, permissions? Help!
Message-Id: <8v3sfq$t1g$1@nnrp1.deja.com>

Hi folks,

I've got a little module problem that's driving me crazy.

If I'm logged in as a normal user and say

perl -e "use HTML::Parser;"

I get this message:

Can't locate loadable object for module HTML::Parser in @INC (@INC
contains: /usr/lib/perl5/5.00503/i386-
linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-
linux /usr/lib/perl5/site_perl/5.005 .) at -e line 1
BEGIN failed--compilation aborted at -e line 1.


If I'm root, I get no errors.

There's another machine here that's set up fairly similarly, and
doesn't have this problem.  I'm assuming that this is a permissions
issue, but haven't found any dissimilarities between the 2 perl
installs on the 2 machines.

Any help would be _greatly_ appreciated.

-Nathan


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 17 Nov 2000 14:08:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Use of uninitialized value in hash slice
Message-Id: <3A153F33.CED1224F@home.com>


Anno Siegel wrote:
> 
> Rick Delaney  <rick.delaney@home.com> wrote in comp.lang.perl.misc:
> >
> >Not in this case where a lot of quoting is going on.  C<undef> is not a
> >valid hash key but 'undef' is.
> 
> Absolutely.  I cancelled the article too late.

Sorry, I should have given that a chance.  I shall not cancel my blind
answer to richard_dobson as penance.  :-(

Anyway, this exchange was still valuable since you were able to impart
the useful information that you can't have an undefined hash key.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Fri, 17 Nov 2000 09:10:20 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Use of uninitialized value in hash slice
Message-Id: <slrn91aiis.u9.tadmc@maxim.metronet.com>

On Fri, 17 Nov 2000 12:55:36 GMT, Rick Delaney <rick.delaney@home.com> wrote:
>John Lin wrote:
>> 
>> In the following program:
>> 
>>     my %hash = (undef=>1, 2=>3);
>>     print $hash{undef},$hash{2},"\n";  # prints 13


>Not really.  As you see, a plain bareword as a hash key will be
>automatically quoted, so in your first example "undef" is treated as the
>string instead of the function.


Note that it is the "fat comma", not "bareword as hash key"
that is doing the quoting in this particular case.

You get an empty string key instead of an "undef" key if
you use a normal comma:

        my %hash = (undef,1, 2=>3);


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


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

Date: 17 Nov 2000 11:57:05 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Use of uninitialized value in hash slice
Message-Id: <m3pujubhxq.fsf@dhcp11-177.support.tivoli.com>

tadmc@metronet.com (Tad McClellan) writes:

> On Fri, 17 Nov 2000 12:55:36 GMT, Rick Delaney <rick.delaney@home.com> wrote:
> >John Lin wrote:
> >> 
> >> In the following program:
> >> 
> >>     my %hash = (undef=>1, 2=>3);
> >>     print $hash{undef},$hash{2},"\n";  # prints 13
> 
> 
> >Not really.  As you see, a plain bareword as a hash key will be
> >automatically quoted, so in your first example "undef" is treated as the
> >string instead of the function.
> 
> 
> Note that it is the "fat comma", not "bareword as hash key"
> that is doing the quoting in this particular case.

Of course, it is actually both.  The "fat comma" on the assignment,
and the "bareword as hash key" in the single hash lookup (the line
that prints 13).

BTW, I almost always end up using qw// for hash slices, which will
also work in this case (ignoring the fact that all of this is using
the string "undef" which has no real relation to undef).

  print @hash{qw/undef 2/}, "\n";

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 17 Nov 2000 18:05:40 GMT
From: Ron Grabowski <ronnie@catlover.com>
Subject: Re: Why are references useful?
Message-Id: <3A157369.7CF6BA2C@catlover.com>

> This is one of those things that are hard to explain with simple examples.

Suppose you have a large array that takes up 20mb of memory. If you to
pass that array by value to a subroutine you now have to two instances
of it ( the original one and the copy ). The data in the array is now
taking up 40mb of space ( an extra 20mb of a copy that is being sent to
the sub ). By passing the array by reference you are pointing the
subroutine to the location in memory that the big array is stored at so
you are using 20mb of memory instead of 40mb.


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

Date: Fri, 17 Nov 2000 15:16:53 -0000
From: "Stuart MacCallum" <stuart.maccallum@wisesystems.co.uk>
Subject: Win32 Socket server problem
Message-Id: <t1aipshi0dqj6f@corp.supernews.com>

Hi

Thanks in advance

I have written a concurrent message sockets server in Perl. It will have to
work on linux and NT machines. There is no problem in running the code on a
linux machine however on an NT machine the messaging service stops working
after 125 messages have been received and informs me that there is an error
when trying to connect to the message server. I am using the fork() function
and using the $SIG{CHLD} variable to free up the process after it has
completed.

Does anybody know what the problem is? If so what other options do I have to
implement the server??

Does anybody know the significance of the 125?? Is Perl only aloud to use
125 sockets before they have to be reused, this would explain the connection
problem.

I am using Perl 5.6







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

Date: Fri, 17 Nov 2000 18:17:47 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Win32 Socket server problem
Message-Id: <fDeR5.37$Tc5.26696@news.pacbell.net>

Stuart MacCallum <stuart.maccallum@wisesystems.co.uk> wrote:
> Hi

> Thanks in advance

> I have written a concurrent message sockets server in Perl. It will have to
> work on linux and NT machines. There is no problem in running the code on a
> linux machine however on an NT machine the messaging service stops working
> after 125 messages have been received and informs me that there is an error
> when trying to connect to the message server. I am using the fork() function
> and using the $SIG{CHLD} variable to free up the process after it has
> completed.

Well, NT doesn't really have a fork(), so perl is faking it.  You should
make sure you're not hitting any limitations mentioned in perlfork.

You may also have found a bug or something.  And read the ActiveState
(if that's what you're using) documentation about the limitations of
signals.

> Does anybody know the significance of the 125?? Is Perl only aloud to use
> 125 sockets before they have to be reused, this would explain the connection
> problem.

> I am using Perl 5.6

It's possible that you may have better luck by calling threads directly.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4912
**************************************


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