[17493] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4913 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 17 18:07:36 2000

Date: Fri, 17 Nov 2000 15:05:15 -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: <974502314-v9-i4913@ruby.oce.orst.edu>
Content-Type: text

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

Today's topics:
        AdminMisc::LogonAsUser Fails <burton_1080@yahoo.com>
    Re: Beginners blues. <johngros@Spam.bigpond.net.au>
    Re: Can I pass a logical data type using the pack funct <cmargoli@world.northgrum.com>
        CGI::Cache 1.02 released <newspost@coppit.org>
        combinining perl programs (wrapper) akothek@my-deja.com
    Re: combinining perl programs (wrapper) (Chris Fedde)
    Re: combinining perl programs (wrapper) akothek@my-deja.com
    Re: combinining perl programs (wrapper) <sumus@aut.dk>
    Re: combinining perl programs (wrapper) (Chris Fedde)
        Directory Coup d'Etat (Ameen Dausha)
    Re: Directory Coup d'Etat <elaine@chaos.wustl.edu>
    Re: disk free <jmcnair@avienda.com>
        Epoch Date and manipulation <gatien@magma-da.com>
    Re: Epoch Date and manipulation (Chris Fedde)
        GD.pm 1.32 / libgd 1.8.3 problem <jetmore@networkwcs.com>
    Re: How to force MSDOS window to stay open after perl? <caesura@freenetname.co.uk>
        OT: Thank you one and all <geoff@800-800-cruise.com>
        Perl spider performance <diab.lito@usa.net>
        perlctrl <jesse.van.oort@home.nl>
        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>
        Problems saving an uploaded file. <johan.ditmar@era.ericsson.se>
    Re: Problems saving an uploaded file. (Csaba Raduly)
    Re: Problems saving an uploaded file. <uri@sysarch.com>
        reading contents inside tar.gz <syarbrou@nospam.enteract.com>
        regexp puzzle <ereppert@rochester.rr.com>
    Re: Searching files <robert@genie.co.uk>
    Re: solution: installing Image::Magick to host as non-r <sean@motorsports.co.uk>
    Re: System command (Jan Ludewig)
    Re: System command <tony_curtis32@yahoo.com>
    Re: System command (Garry Williams)
    Re: System command guthrie_linck@my-deja.com
    Re: System command nodo70@my-deja.com
    Re: tree-sync.pl guthrie_linck@my-deja.com
    Re: Unix, Perl and the TOP command <r464.NOSPAM@usa.net>
    Re: Unix, Perl and the TOP command <elaine@chaos.wustl.edu>
    Re: Unix, Perl and the TOP command (Garry Williams)
    Re: Use of uninitialized value in hash slice <sumus@aut.dk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 17 Nov 2000 20:26:29 GMT
From: "Zeek" <burton_1080@yahoo.com>
Subject: AdminMisc::LogonAsUser Fails
Message-Id: <VvgR5.1962$Mg7.14023@news1.onlynews.com>

Has anyone gotten LogonAsUser to work wtih Active State perl 5.6 build 620?
I am using 20000708 adminmisc.  I guess the better question is has it ever
worked with AS perl.  I also tried it with build 522 and it fails.  I have
given the domain user the specified rights on the local system that it runs
on, I also set the rights on the Domain too.  This is my code it can't get
get any simpler than this.  It fails everytime with error code 0.  Is there
any functions that can get more detailed information on the errors.

******
use Win32::adminmisc;

if (Win32::AdminMisc::LogonAsUser("DOMNAME",
                                  "AdminUser",
                                  "AdminPassword",
                                  LOGON32_BATCH))
  {
    print "Successfully impersonating " . Win32::AdminMisc::GetLogonName() .
"\n";


  }
else
 {

   print 'Error: Failed to logon, ', Win32::GetLastError() . "\n";

   %Win = Win32::AdminMisc::GetWinVersion();
      ($Platform) = ($Win{Platform} =~ /Win_?(.*)/);

  print "       We are using Windows $Platform\n";
  print "       Version $Win{Major}.$Win{Minor}\n";
  print "       Build $Win{Build}\n";
  print "       $Win{CSD}\n";

 }
********





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

Date: Fri, 17 Nov 2000 22:59:46 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners blues.
Message-Id: <CLiR5.11475$tU2.96403@news-server.bigpond.net.au>

One last question (I hope last), the filehandle has to be declared becuase I
kept getting unquoted string otherwise. I declared it and used a $bogus as
the filehandle, but now any value in $bogus gives can't use string ("bogus")
as a symbol while use strict refs.
Any clues as to how to get an acceptable filehandle?
I guess I have not declared the filehandle properly.  I include the code to
show exactly what I am doing wrong.
#!E:/Millenium Programs/perl/bin/Perl -w
use strict;
my($pwd)= my($time);
my($bogus)="BOGUS";
open $bogus,">C:\\Progra~1\\G6FTP\\ftpdat~1\\johngros\@bigpond.net.au.txt"
or die;
print $bogus "$pwd/n";
close $bogus;




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

Date: Fri, 17 Nov 2000 20:01:33 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
To: bcwache@my-deja.com
Subject: Re: Can I pass a logical data type using the pack function in Perl?
Message-Id: <Pine.SUN.3.95.1001117115212.1644A-100000@world.northgrum.com>

On Wed, 15 Nov 2000 bcwache@my-deja.com wrote:

> I'm trying to pass a parameter to a subroutine in a dll using
> Perl/CGI.  The subroutine is expecting a 'logical*2' data type (in
> FORTRAN) which represents .TRUE. or .FALSE..  However, there is no
> logical type for the pack function in the Perl documentation.  I've
> tried passing the value as a string, as 0/1, and several other ways
> with no success.  Has anyone ever successfully aaccomplished this?

I don't believe that the Fortran standards specify how .TRUE. and
 .FALSE. are represented, so the values would be compiler and platform
dependent.  Try writing a Fortran program that prints the values
in hex of logical*2 variables set to .TRUE. and .FALSE.  Then determine
how to represent those in Perl variables as numeric or string values.

-- 
Charles G. Margolin             Internal Information Services 0624/32
cmargoli@world.northgrum.com    Logicon Inc., A Northrop Grumman Company
                                El Segundo, California 90245-2804



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

Date: Fri, 17 Nov 2000 14:21:17 -0500
From: David Coppit <newspost@coppit.org>
Subject: CGI::Cache 1.02 released
Message-Id: <t1b207cm4rls1a@corp.supernews.com>

Description:
- Perl extension to cache output of time-intensive CGI scripts so that
  subsequent visits to such scripts will not cost as much time.

                                WARNING
      The interface as of version 1.01 has changed considerably
      and is NOT compatible with earlier versions.

Download:
- You can download CGI::Cache from CPAN:
  http://www.cpan.org/authors/id/D/DC/DCOPPIT/CGI-Cache-1.02.tar.gz
- Until the file propagates to the mirrors, you can use the following URL:
  http://download.sourceforge.net/cgicache/CGI-Cache-1.02.tar.gz

Changes:
- Fixed issues to make module mod_perl compatible.
- Fixed stop() documentation.
- Moved development to SourceForge. (http://cgicache.sourceforge.net/)
- Fixed warnings about tie under Perl 5.6.

Thanks,
David

_________________________________________________________________________
David Coppit - Graduate Student        david@coppit.org      
The University of Virginia             http://coppit.org/
    "Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."





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

Date: Fri, 17 Nov 2000 20:22:46 GMT
From: akothek@my-deja.com
Subject: combinining perl programs (wrapper)
Message-Id: <8v442d$464$1@nnrp1.deja.com>

simple newbie q:
i have a couple of perl programs that run ok by themselves and need to
combine them with one wrapper script that will execute the commands
sequentially and have some exception handling...similar to a shell
script. whats the best approach?

thanks...


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


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

Date: Fri, 17 Nov 2000 20:38:11 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: combinining perl programs (wrapper)
Message-Id: <TGgR5.509$Bf7.178934784@news.frii.net>

In article <8v442d$464$1@nnrp1.deja.com>,  <akothek@my-deja.com> wrote:
>simple newbie q:
>i have a couple of perl programs that run ok by themselves and need to
>combine them with one wrapper script that will execute the commands
>sequentially and have some exception handling...similar to a shell
>script. whats the best approach?
>
>thanks...
>

Why not just use a shell script? 
Oh you can goahead and use Perl as a shell too if you like.
read up on backquote (`) and system in the perlfunc manual page

chris
-- 
    This space intentionally left blank


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

Date: Fri, 17 Nov 2000 21:12:10 GMT
From: akothek@my-deja.com
Subject: Re: combinining perl programs (wrapper)
Message-Id: <8v46v3$6q4$1@nnrp1.deja.com>

i just thought it would be "better" to do it in perl because eventually
this script will be executed from a browser...

i tried using system and seems to work but not sure how to handle
exceptions...


In article <TGgR5.509$Bf7.178934784@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article <8v442d$464$1@nnrp1.deja.com>,  <akothek@my-deja.com>
wrote:
> >simple newbie q:
> >i have a couple of perl programs that run ok by themselves and need
to
> >combine them with one wrapper script that will execute the commands
> >sequentially and have some exception handling...similar to a shell
> >script. whats the best approach?
> >
> >thanks...
> >
>
> Why not just use a shell script?
> Oh you can goahead and use Perl as a shell too if you like.
> read up on backquote (`) and system in the perlfunc manual page
>
> chris
> --
>     This space intentionally left blank
>


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


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

Date: 17 Nov 2000 23:15:56 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: combinining perl programs (wrapper)
Message-Id: <7l62jlcz.fsf@macforce.sumus.dk>

akothek@my-deja.com writes:

> i just thought it would be "better" to do it in perl because eventually
> this script will be executed from a browser...

I think I agree. And actually this is what require() does when used on .pl
files.

if s1.pl contains

print "Hello ";

and s2.pl contains

print "World!\n";

then s3.pl containing

require "s1.pl";
require "s2.pl";

is an excellent implementation of Hello World (the most famous open source
program in the world).

There are some namespace gotcha's but i don't suppose you want to share
anything?

-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

Date: Fri, 17 Nov 2000 22:42:44 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: combinining perl programs (wrapper)
Message-Id: <EviR5.511$Bf7.178934784@news.frii.net>

In article <8v46v3$6q4$1@nnrp1.deja.com>,  <akothek@my-deja.com> wrote:
>i just thought it would be "better" to do it in perl because eventually
>this script will be executed from a browser...
>
>i tried using system and seems to work but not sure how to handle
>exceptions...
>

Exit code is placed in $? In unixland anyway commands exit with 0 if
nothing goes wrong.  That might make logic a bit wierd.  
Output from the command goes where stdout and stderr are pointing

  if ($r = system('ls', $ARGV[0])) {
    print "it failed \n";
  } else {
    print "it succeeded\n";
  } 
  print "$r\n";
  print "$?\n";
  print "$!\n"

chris
-- 
    This space intentionally left blank


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

Date: Fri, 17 Nov 2000 21:57:09 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: Directory Coup d'Etat
Message-Id: <3a15a92c.273173@news>

How to obtain ownership of a directory when you're not the owner but
you're in the group? I would like to approach this in a Perlish way.
	


Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"


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

Date: Fri, 17 Nov 2000 22:45:44 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: Directory Coup d'Etat
Message-Id: <syiR5.14697$AM5.277656@news1.nokia.com>

<ameen @ dausha . net (Ameen Dausha)> wrote in message
news:3a15a92c.273173@news...
> How to obtain ownership of a directory when you're not the owner but
> you're in the group? I would like to approach this in a Perlish way.

You can't, unless you are root.

e.




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

Date: Fri, 17 Nov 2000 14:11:46 -0500
From: John McNair <jmcnair@avienda.com>
Subject: Re: disk free
Message-Id: <3A1582F2.1060508@avienda.com>

It does not work with NFS under Linux.  At least not with the NFS 
module/daemon provided with RedHat 6.2 or Slackware 7.1.

IGuthrie wrote:

>> 2) use FileSys::Df;
>> FileSys::Df::df( ... );
>> 
>> This seems to work well on local filesystems and avoids the headaches
>> caused by require.  The problem is that it does not work with NFS.
> 
> 
> Could you be more specific when you say that it does not work with NFS? I use
> it with NFS all the time on HP and Sun systems without a problem.
> 
> Thanks,
> Ian


-- 
John McNair
JAPH
Avienda Technologies
jmcnair@avienda.com



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

Date: Fri, 17 Nov 2000 19:49:46 GMT
From: "Guy Gatien" <gatien@magma-da.com>
Subject: Epoch Date and manipulation
Message-Id: <uZfR5.2573$A26.110216@sjc-read.news.verio.net>

I am a newbie on Perl. I am trying to take the current date and increment it
by 30 days and then parse out the mon day and year.

My code contains:

$epochTime=time;
print "epoch is: ", $epochTime;

however; when adding : print scalar localtime(974481828);   I receive the
following on the screen instead of the formatted time.

Time::tm=ARRAY(0x20ea2c)


What am I missing, why will it not output the scalar context?
Help Help !

Thanks much,
Guy




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

Date: Fri, 17 Nov 2000 20:33:45 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Epoch Date and manipulation
Message-Id: <JCgR5.508$Bf7.189811712@news.frii.net>

In article <uZfR5.2573$A26.110216@sjc-read.news.verio.net>,
Guy Gatien <gatien@magma-da.com> wrote:
>I am a newbie on Perl. I am trying to take the current date and increment it
>by 30 days and then parse out the mon day and year.
>
>My code contains:
>
>$epochTime=time;
>print "epoch is: ", $epochTime;
>
>however; when adding : print scalar localtime(974481828);   I receive the
>following on the screen instead of the formatted time.
>
>Time::tm=ARRAY(0x20ea2c)
>

Works for me...

  $epochTime=time;
  print "epoch is: ", $epochTime, " ";
  print scalar localtime($epochTime), "\n";

chris
-- 
    This space intentionally left blank


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

Date: Fri, 17 Nov 2000 16:12:36 -0600
From: John Jetmore <jetmore@networkwcs.com>
Subject: GD.pm 1.32 / libgd 1.8.3 problem
Message-Id: <Pine.GSO.4.21.0011171545080.8958-100000@world.evansville.net>


I am trying to install GD.pm 1.32 on a customer's machine and am
experiencing what seems to be a very odd problem.  I've looked back
through DejaNews, and while GD.pm seems to cause a lot of problems, I 
haven't seen this specific one described.  Any help anyone could give 
me would be much appreciated.

Platform is sparc-sun-solaris2.8

libgd compiles and installs with no problems.  jpeg, freetype, and xpm
were succesfully included in making the library.  The demo programs that
come w/ the distribution all work as expected.  After my first couple of
failures, I also patched the libgd stuff w/ the patch that comes in the GD
1.32 dist, but w/ the same results (described below).

When I go to make GD.pm, it makes w/ no errors reported.  The problem is
that the test fails w/ an odd message.  Here's the output of `make test`:

#####################################################################

# make test
PERL_DL_NONLAZY=1 /local/bin/perl -Iblib/arch -Iblib/lib -I/wcs/lib/perl5/5.00503/sun4-solaris -I/wcs/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/GD................Use of uninitialized value at t/GD.t line 97.
brush is not of type GD::Image at t/GD.t line 97.
dubious
        Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 2-10
        Failed 9/10 tests, 10.00% okay
Failed Test  Status Wstat Total Fail  Failed  List of failed
-------------------------------------------------------------------------------
t/GD.t            9  2304    10    9  90.00%  2-10
Failed 1/1 test scripts, 0.00% okay. 9/10 subtests failed, 10.00% okay.
make: *** [test_dynamic] Error 2

#####################################################################

The line it's choking on in GD.t is:

$im->setBrush($tile);

The cause of this failure is on line 95, which is:

my($tile) = newFromPng GD::Image(TILE);

newFromPng is returning undef rather than a reference, which is what it's
supposed to do when it fails, I just can't figure out why it's
failing.  The content of $! immediately following the newFromPng call is
"Bad file number".  I have confirmed that the filehandle is open and can
be read from.

So, w/ no errors providing knits to be picked at, I'm not sure what else
to do to troubleshoot this.  Does anyone have any ideas?

Thanks for any help,
--John Jetmore




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

Date: Fri, 17 Nov 2000 19:09:37 -0000
From: "Andrew Cragg" <caesura@freenetname.co.uk>
Subject: Re: How to force MSDOS window to stay open after perl?
Message-Id: <8v3vn8$qao$1@gxsn.com>

Or wot about :

print "Enter to exit : "; <STDIN>;

at the end of your prog.

Andy Cragg
www.caesura.co.uk





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

Date: Fri, 17 Nov 2000 10:42:14 -0800
From: "GC" <geoff@800-800-cruise.com>
Subject: OT: Thank you one and all
Message-Id: <ZXeR5.5801$pZ1.30894@nntp3.onemain.com>

Ladies, Gentlemen & Porters,

Just a quick note to say thank you very much for your patience, guidance
and tips. The archival info at deja is superb re: the use of canned
'generic' CGI and the dubiousness of its use. The constant pointers to
Perl modules are sincerely appreciated and very useful. This is one of
the finest ng's it's been my privilege to participate in, and I
especially appreciate the fact that virtually everyone is able to make
do with very old and ratty Nomex. :)

Thanks again,
Geoff




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

Date: Fri, 17 Nov 2000 19:40:56 GMT
From: Mario <diab.lito@usa.net>
Subject: Perl spider performance
Message-Id: <8v41k7$202$1@nnrp1.deja.com>

is Perl an acceptable choice for a web spider?

Mario


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


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

Date: Fri, 17 Nov 2000 19:58:50 GMT
From: Jesse van Oort <jesse.van.oort@home.nl>
Subject: perlctrl
Message-Id: <4t2b1t0fmtcisl92d5fsd097g70i0gt1as@4ax.com>

Hi all,

Digging out Deja.com I came across this question quite a few times,
but never answered, so here goes:

How come that a dll created with Perlctrl and afther that successfully
registered with regsvr32 does work with a sample script but never
shows up either when I try to import it into Delphi (5 Ent) or when I
want to test it using MS's Control Test Container.

My configuration is Win2kPro, Delphi 5 ent, VC98, ActivePerl 5.6
(build 620) and a trial version of the dev kit.

It all seems to work, I get no errors, but I can't use my favorite
language with my favorite IDE.


Any Ideas?


Regards,

Jesse van Oort


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

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: <8v3vas$90f$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: <8v4134$d08$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: <8v42rd$g5t$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: <8v44jl$j61$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: <8v46bt$mc8$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: <8v4845$pbs$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: <8v49sd$s7g$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: <8v4bkn$257$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 19:39:38 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: Problems saving an uploaded file.
Message-Id: <Xns8FEFC2603quuxi@194.203.134.135>

A million monkeys weren't enough! It took "Johan Ditmar"
<johan.ditmar@era.ericsson.se> on 17 Nov 2000 to produce
<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.
>

Where does it get the filehandle from ? 
<GUESS>
Are you using CGI.pm (that's the only mention of param() in the Perl 
docs) ? If you do, it seems to me that $bitfile contains the name of 
the file to upload. In that case, you need to open() it first.
</GUESS>

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
In God we trust, everybody else please enter the password:


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

Date: Fri, 17 Nov 2000 22:11:47 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Problems saving an uploaded file.
Message-Id: <x78zqifduk.fsf@home.sysarch.com>

>>>>> "JD" == Johan Ditmar <johan.ditmar@era.ericsson.se> writes:

  JD> Could this be a bug?

the only bug is in your newsreader. how many more times will you post
this? you have succeeded in making no one interested in helping you.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Fri, 17 Nov 2000 16:19:43 -0600
From: Steve . <syarbrou@nospam.enteract.com>
Subject: reading contents inside tar.gz
Message-Id: <jjbb1t0ccf60vd01t4qoljuh3ud1ehbvl7@4ax.com>

I am using Perl on a Linux box. I have a file that is say
weekend200000110.tar.gz.

Inside that file is two text files.  Say file1.csv and file2.csv.  Is
there a way in Perl, that I can open and read in the contents of
file1.csv like you would do if it was not in the tar.gz file?  If so,
an example would be much appreciated.  Thanks.

Steve

newsgroup replies preferred.  Remove nospam when replying thru email.


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

Date: Fri, 17 Nov 2000 22:27:33 GMT
From: Ed Reppert <ereppert@rochester.rr.com>
Subject: regexp puzzle
Message-Id: <ereppert-C1AB2F.17312917112000@news-server.rochester.rr.com>

If there's a better place to post this, please let me know. :-)

Here's the situation:

I have a Mac, running MacOS 9.0.4. I deal periodically with large 
numbers of uuencoded files. Usually, Stuffit Expander deals with these 
quite well. However, occassionally, I'll get a bunch of files that 
Stuffit Expander trips over. I have found that if I delete the headers 
from these files (they are usenet postings), Stuffit Expander has no 
further problem with them. After some time dealing with this manually - 
opening the files in BBEdit and manually removing the headers - it 
occurred to me that I could use a regexp to find and delete the headers 
automatically. (BBEdit support regexps, although it's somewhat limited). 
At one point, I thought I had it - it worked once or twice, and then 
failed to find the delimiting one (or more) blank lines, so not deleting 
anything. I tried coming up with a Perl script (I do have MacPerl) to 
deal with this, but so far no joy there either. I've not much experience 
with Perl. After a while I gave up, and went back to manual editing. 
Having just spent a frustrating couple hours doing that, I'm ready to 
try scripting it again. I'm hoping someone here can give me a leg up. 
Any takers? :-)


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

Date: Fri, 17 Nov 2000 21:11:17 +0000
From: Robert <robert@genie.co.uk>
Subject: Re: Searching files
Message-Id: <9i7b1t8vp87h488icvovdvacb4naj1r761@4ax.com>

On Fri, 17 Nov 2000 00:01:23 -0600, tadmc@metronet.com (Tad McClellan)
wrote:

>On Thu, 16 Nov 2000 21:26:00 +0000, Robert <robert@genie.co.uk> wrote:
>
>>Say I have a file file of URLs, in the format 
>><a href="http://websitesname.com/file.asp?name=john&phone=12345>Johns
>>details</a>
>>obviously they wont all be john, they will all have different names
>>and phone numbers.
>>What I want to do is search within this file for John and then display
>>the phone number for that url.
>>How easy is this 
>
>
>Pretty easy:
>
>   print "$1: $2\n" if /name=([^&]+)&phone=([^>]+)/;
>
>
>>and If someone could give me some pointers I would be
>>most happy.
>
>
>   perldoc perlre
>   perldoc perlop

Thanks, this was a help,
I got mixed up with what I had in the URL
the URL was actually 

<a href="http://websitename/file.asp?phone=12345">JohnsPhone</a>

So I was looking for JohnPhone which was the desciption for the URL
and wanting to search backwards to display the phone number.

Would this work out roughly the same.
Regular Expressions and operators arent something I have really used
in Perl previously but I am learning.

Robert




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

Date: Fri, 17 Nov 2000 22:53:03 +0000
From: Sean W <sean@motorsports.co.uk>
Subject: Re: solution: installing Image::Magick to host as non-root user
Message-Id: <sean-A34607.22530317112000@usenet.plus.net>

I tried to follow your guide but I keep getting the following error when 
I try to configure it


configuring ImageMagick 5.2.0
checking host system type... configure: error: cannot guess host type; 
you must
specify one


Can anyone shed any light on this

Cheers
Sean


In article <8v1tfs$bd6$1@nnrp1.deja.com>, dtbaker_dejanews@my-deja.com 
wrote:

> In article <slrn8vsqdp.710.sholden@pgrad.cs.usyd.edu.au>,
>   sholden@cs.usyd.edu.au wrote:
> > On Tue, 31 Oct 2000 05:40:27 GMT,
> > 	dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com>
> wrote:
> > >
> > >        $ perl Makefile.PL
> PREFIX=/home/normsgallery/www/admin/cgi-bin
> >
> > I suspect it would be wiser to install somewhere other than off your
> cgi-bin.
> >
> > PerlMagick could install some executables (I doubt it does, but as a
> general
> > principle) which aren't meant to be CGI programs and could open up
> some
> > security holes...
> >
> > Since it's done now, the paranoid part of me would .htaccess (or
> equivalent)
> > off the lib/perl5 subdirectory so that the web server won't allow
> access.
> ---------------
> 
> well, actually the whole mess is .htaccess protected, so I think I'm
> *pretty* safe. additionally, the server doesnt let anyone list a cgi-bin
> dir anyway, so it would be pretty darn hard to figure out the name,
> arguements, etc to make my scripts behave badly I think. good thought
> though.
> 
> 
> 
> >
> > By the way, I for one think it's good when people post as you have..
> much better
> > than the 'solved now don't worry' posts that don't helpt he next
> person.
> ---------------
> thanx.... I just wish I could get some straight answers on topics
> sometimes. People tend to give pieces or general answers, and it takes a
> ton of time to sift thru.  ah well.
> 
> Dan
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy


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

Date: Fri, 17 Nov 2000 12:06:12 -0800
From: jl@gate5.de (Jan Ludewig)
Subject: Re: System command
Message-Id: <jl-1711001206120001@dyn-192.gate5.de>

In article <8v3srm$te0$1@nnrp1.deja.com>, nodo70@my-deja.com wrote:

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

/jan

-- 
--
can't think of a signature right now


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

Date: 17 Nov 2000 14:18:13 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: System command
Message-Id: <873dgq2vzu.fsf@limey.hpcc.uh.edu>

>> On Fri, 17 Nov 2000 18:19:43 GMT,
>> nodo70@my-deja.com said:

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

You're running the command cmp with *1* argument "-s
$file1 $file2".  But what you want is 3 arguments: -s,
$file1 and $file2, viz.

    $result = system 'cmp', '-s', $file1, $file2;

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Fri, 17 Nov 2000 20:26:23 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: System command
Message-Id: <PvgR5.795$xb1.49628@eagle.america.net>

On Fri, 17 Nov 2000 12:06:12 -0800, Jan Ludewig <jl@gate5.de> wrote:
>In article <8v3srm$te0$1@nnrp1.deja.com>, nodo70@my-deja.com wrote:
>
>> Anyone knows what is wrong with this line since it complain "cmp:
>> Unknown option -"?
>> $result = system ("cmp", "-s $file1 $file2");
>$result = system ("cmp -s $file1 $file2");

 ... or

    $result = system ("cmp", "-s", $file1, $file2);

See the section on `system PROGRAM LIST' in the perlfunc manual page.
The original poster's version is passing only one parameter to cmp:
"-s $file1 $file2" when he intended three.  

-- 
Garry Williams


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

Date: Fri, 17 Nov 2000 20:35:00 GMT
From: guthrie_linck@my-deja.com
Subject: Re: System command
Message-Id: <8v44pk$4nd$1@nnrp1.deja.com>



the syntax is system(@list);

you must make sure your arugments are given properly:

system ("cmp", "-s $file1 $file2");
  is quite different from
system ("cmp -s $file1 $file2");

its just like typing it in at shell.
the first one would be like:
$ cmp "-s $file1 $file2" passing cmp a single argument!

which doesn't make any sense.

the best way is to pass a list, with an element for each argument:

system("cmp", "-s", $file1, $file2);



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


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

Date: Fri, 17 Nov 2000 21:10:58 GMT
From: nodo70@my-deja.com
Subject: Re: System command
Message-Id: <8v46sr$6p4$1@nnrp1.deja.com>

I got it.  Thank you all of your response.

-nodo

In article <873dgq2vzu.fsf@limey.hpcc.uh.edu>,
  Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >> On Fri, 17 Nov 2000 18:19:43 GMT,
> >> nodo70@my-deja.com said:
>
> > Anyone knows what is wrong with this line since it
> > complain "cmp: Unknown option -"?
> > $result = system ("cmp", "-s $file1 $file2");
>
> You're running the command cmp with *1* argument "-s
> $file1 $file2".  But what you want is 3 arguments: -s,
> $file1 and $file2, viz.
>
>     $result = system 'cmp', '-s', $file1, $file2;
>
> hth
> t
> --
> Eih bennek, eih blavek.
>


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


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

Date: Fri, 17 Nov 2000 19:05:45 GMT
From: guthrie_linck@my-deja.com
Subject: Re: tree-sync.pl
Message-Id: <8v3vi2$vtj$1@nnrp1.deja.com>

yeah - rsync is pretty good, but i've also had problems with it, being
buggy (on the network though),. rsync does have options to skip files
based on shell-patterns. so you could sync a directory, but leave out
*.log or  *~ or .whatever files... on a side note, i have written a
complex "find" type program, totally re-written in perl  and designed
much differently than normal unix find as well as the perl-find
look-a-like. it easily does things like mass renaming of files based on
patterns (ie, rename all .c files to .C files...) it could also possibly
do tree-syncing behavior. but, i'm sort of in the middle of another
overhaul, but this is another good application for my program which i
should take into consideration... anwyays....


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


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

Date: Fri, 17 Nov 2000 14:25:06 -0500
From: Prophet <r464.NOSPAM@usa.net>
Subject: Re: Unix, Perl and the TOP command
Message-Id: <3A158611.BD9773CC@usa.net>

> perl -e 'kill 9, map { (split " ",$_)[1] } grep /<defunct>/,`ps -ef`;'

A kill -9 on a defunct process is not going to kill it.  A better approach
would be to send a signal 18 to the parent process, thus asking it to check
the status of its children:

perl -e 'kill 18, map { (split " ",$_)[2] } grep /<defunct>/,`ps -ef`;'

Or, if you wish to be a little less succinct:

#!/usr/local/bin/perl
open(DEFUNCTS, "ps -ef |");
while (<DEFUNCTS>) {
        if ($_ =~ /defunct/) {
                ($user, $procpid, $parentpid) = split(' ', $_);
                `kill -18 $parentpid`;
                print "Sending signal to parent of PID $procpid for user
$user.\n";
        }
}

If a process is defunct and owned by init (PID 1), it is there until you
reboot.  Otherwise, a signal 18 works only if you are lucky...



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

Date: Fri, 17 Nov 2000 20:07:19 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: Unix, Perl and the TOP command
Message-Id: <XdgR5.14696$AM5.277656@news1.nokia.com>

"Prophet" <r464.NOSPAM@usa.net> wrote in message
news:3A158611.BD9773CC@usa.net...
> If a process is defunct and owned by init (PID 1), it is there until you
> reboot.  Otherwise, a signal 18 works only if you are lucky...

This is not true with most current Unix kernels.

e.




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

Date: Fri, 17 Nov 2000 21:03:12 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Unix, Perl and the TOP command
Message-Id: <k2hR5.798$xb1.49771@eagle.america.net>

On Fri, 17 Nov 2000 18:34:59 GMT, Elaine Ashton
<elaine@chaos.wustl.edu> wrote:
>"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. 

Agreed.  

>A zombie is the orphaned process of parent process
>who died 

Actually, a "<defunct>" or a zombie process is one that has died and
the parent has *not* died and the parent has not called wait() or
waitpid() on the dead process.  

>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 happens when a parent of a child who has died exits.  

>This means
>the PPID for the zombie, a real zombie, is 1..

Not so.  By definition, the PPID is not 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. 

*Any* process whose parent calls exit() will be inherited by init (PID
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. 

No, it is not.  

This is from the Solaris manual page for ps: 

	 A process that has exited and *has* a parent, but has not
	 yet been waited for by the parent, is marked <defunct>.

(I added the emphasis.)  

Your example is *not* a zombie.  (And hence, ps did not mark it
"<defunct>").  It is only a process whose parent has called exit().
Your example shows a process which is (presumably) healthy.  

>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.

Not true.  The init process will do nothing about this process except
reap its status if and when *mutt* exits.  

    $ sudo truss -p 1
    password:
    pause()                         (sleeping...)
    ^C$

The init process is not working "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.

No OS that I know of will do a thing about a "zombie" process.  There
is no such thing as killing a zombie -- it's already dead.  It's the
parent of the *dead* zombie that is at fault for not calling wait().
and there is no process, kernel or anything else that will do anything
about a parent that refuses to call wait() on its dead children.  

>If you do have an abundance of them, you probably need to examine
>your code far more than worry about killing orphans.

 ... or examine the parent that refuses to call wait().  

 ... and kill the faulty parent, if you want them removed from the
process table.  

-- 
Garry Williams


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

Date: 17 Nov 2000 23:30:58 +0100
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Use of uninitialized value in hash slice
Message-Id: <66lmjknx.fsf@macforce.sumus.dk>

Rick Delaney <rick.delaney@home.com> writes:

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

And since this is so close to the whole truth we might as well finish it:

The above is true of straight Perl hashes. In tied hashes the object that
the hash is tied to may treat undef as a key any way it likes - also as
something that's not ''.

This could actually be used for something practical - like using a tied
hash as a dictionary that will extract the key for a given element from
the element itself if the undefined key is specified.

-- 
Jakob Schmidt
http://aut.dk/orqwood
etc.


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

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


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