[17202] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4614 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 14 06:05:26 2000

Date: Sat, 14 Oct 2000 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971517907-v9-i4614@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 14 Oct 2000     Volume: 9 Number: 4614

Today's topics:
    Re: *hex editing* in perl (Håkon Alstadheim)
    Re: [Q] "pass along" in AUTOLOAD ? <jeffp@crusoe.net>
    Re: [Q] "pass along" in AUTOLOAD ? <jeffp@crusoe.net>
    Re: [Q] "pass along" in AUTOLOAD ? (Mark-Jason Dominus)
    Re: Can't pipe from Perl to C <krahnj@acm.org>
    Re: Help with backup script <jkipp5@home.com>
    Re: Help with backup script <krahnj@acm.org>
    Re: MLDBM db Q. <bwalton@rochester.rr.com>
    Re: Multiple fork()s? (Mark-Jason Dominus)
    Re: question <joe+usenet@sunstarsys.com>
    Re: question <jeffp@crusoe.net>
    Re: question <joe+usenet@sunstarsys.com>
    Re: question <uri@sysarch.com>
    Re: Regex for matching e-mail addresses <jkipp5@home.com>
        run system command and return before completion <j.mackay@biochem.usyd.edu.au>
        Why these 2 simple errors? (BUCK NAKED1)
    Re: Why these 2 simple errors? <uri@sysarch.com>
    Re: Why these 2 simple errors? (BUCK NAKED1)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 14 Oct 2000 01:27:56 -0400
From: hakon.alstadheim@oslo.mail.telia.com (Håkon Alstadheim)
Subject: Re: *hex editing* in perl
Message-Id: <m0bswoxa8z.fsf@alstadhome.cyberglobe.net>

tomp at sci fi <tomp@sci.fi> writes:

> How do I convert the bytes to characters ? :) Or I just didn't get it how to
> write those properly because now the '0xFF' goes as ascii in the file.
> 
> Uri Guttman wrote:
> 
> > perldoc -f seek
> > perldoc -f sysread
> > perldoc -f syswrite
> > perldoc -f open
> > perldoc opentut
> > perldoc binmode
> >
> > it's all there and not difficult.
> >
> > uri
> 
Add to that:
perldoc -f unpack
(or you might get by with perldoc -f ord)

perldoc -f pack
(or you might get by with perldoc -f chr)
-- 
Håkon Alstadheim, Montreal, Quebec, Canada  


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

Date: Sat, 14 Oct 2000 01:19:08 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: [Q] "pass along" in AUTOLOAD ?
Message-Id: <Pine.GSO.4.21.0010140118140.14163-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 14, Mark-Jason Dominus said:

>In article <Pine.GSO.4.21.0010131856260.14163-100000@crusoe.crusoe.net>,
>Jeff Pinyan  <japhy@pobox.com> wrote:
>>This works for me:
>>    if ($meth =~ /\A[A-Z]+\z/) { goto &{ $SUPER::{$meth} } }
>
>I'm totally boggled here.  I first thought that this was a mistake,
>but you said that it works for you, so that can't be right.  What does
>$SUPER::{$meth} doing?  Is it documented anywhere?  

SUPER:: is a pseudo-package.  $meth is the name of the method (in all
caps).  $SUPER::{$meth} is the glob for the method in the parent
class.  &{ $SUPER::{$meth} } is the function.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Sat, 14 Oct 2000 01:47:10 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: [Q] "pass along" in AUTOLOAD ?
Message-Id: <Pine.GSO.4.21.0010140146110.14163-100000@crusoe.crusoe.net>

On Oct 14, Jeff Pinyan said:

>[posted & mailed]
>
>On Oct 14, Mark-Jason Dominus said:
>
>>In article <Pine.GSO.4.21.0010131856260.14163-100000@crusoe.crusoe.net>,
>>Jeff Pinyan  <japhy@pobox.com> wrote:
>>>This works for me:
>>>    if ($meth =~ /\A[A-Z]+\z/) { goto &{ $SUPER::{$meth} } }
>>
>>I'm totally boggled here.  I first thought that this was a mistake,
>>but you said that it works for you, so that can't be right.  What does
>>$SUPER::{$meth} doing?  Is it documented anywhere?  
>
>SUPER:: is a pseudo-package.  $meth is the name of the method (in all
>caps).  $SUPER::{$meth} is the glob for the method in the parent
>class.  &{ $SUPER::{$meth} } is the function.

Sorry, the test was misleading.  AUTOLOAD wasn't actually getting
called.

You can only use SUPER:: in a the documented way -- that is:

  $obj->SUPER::method();

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Sat, 14 Oct 2000 05:57:01 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: [Q] "pass along" in AUTOLOAD ?
Message-Id: <39e7f5ad.5fcf$7f@news.op.net>
Keywords: carpenter, contemporary, phenol, tell

[mailed and posted]

In article <Pine.GSO.4.21.0010140118140.14163-100000@crusoe.crusoe.net>,
Jeff Pinyan  <japhy@pobox.com> wrote:
>>In article <Pine.GSO.4.21.0010131856260.14163-100000@crusoe.crusoe.net>,
>>Jeff Pinyan  <japhy@pobox.com> wrote:
>>>This works for me:
>>>    if ($meth =~ /\A[A-Z]+\z/) { goto &{ $SUPER::{$meth} }} 
>>
>>I'm totally boggled here. 
>
>SUPER:: is a pseudo-package.  $meth is the name of the method (in all
>caps).  $SUPER::{$meth} is the glob for the method in the parent
>class.  &{ $SUPER::{$meth} } is the function.

OK, I now understand what you were thinking, but I still don't
understand how it could possibly have worked, for two reasons:

* As I mentioned in a different article, the original request makes no
  sense, since the poster wants AUTOLOAD to pass control to a method
  which, had it actually existed, would have prevented AUTOLOAD from
  being called in the first place.

* %SUPER:: doesn't appear to have the meaning you say it does.  At
  least, not in any way that I can identify.  It seems to me that
  %SUPER:: is the symbol table of the ordinary package that happens to
  be named 'SUPER'.  Then I double-checked the source code, and as far
  as I can tell, SUPER:: only has a special meaning when a method name
  is being resolved, which is not the case here (I think).

Are you *sure* that it worked for you?  What exactly did it do?  Do
you still have the example you ran?  I don't want to embarass you or
anything, but I'm really mystified.



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

Date: Fri, 13 Oct 2000 23:30:17 -0700
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Can't pipe from Perl to C
Message-Id: <39E7FD79.22331A84@acm.org>

Michael wrote:
> 
> Hi there -
> 
> This prints Hello, world! (so I could see it get in the script, but then
> hangs on the read...

You seem to be confusing the pipe '|' on the command line and fifos.

> Here's some code...
> 
> Here's the .pl script...
> [michael@linux /michael]$ cat test.pl
> #!/usr/bin/perl -w
> 
> # test.pl - Trying to call a C program...
> 
> print "Hello, world!\n";
> open(MYPROG,"./testreturn somedata|");

'testreturn' is reading 'somedata' from the command line and then
whatever it prints to standard output (stdout) is piped to your perl
program. Since your c program doesn't read from the command line or
print to stdout nothing is happening.

> read(MYPROG,$answer,50);
> close(MYPROG);
> 
> print $answer
> 
> And here's my C code...
> [michael@linux /michael]$ cat testreturn.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <errno.h>
> #include <string.h>
> 
> main() {
>         int fifo[2];
>         char *message = "This comes from the called program";
>         char line[8];
> 
>         if (pipe(fifo) == -1) {
>                 fprintf(stderr,"Cannot create pipe\n");
>                 exit (1);
>         }
>         read (fifo[0],line,8);
>         write (fifo[1],message, strlen(message)+1);
> 
> }
> 
> Any help greatly appreciated.

John


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

Date: Sat, 14 Oct 2000 07:20:27 GMT
From: Jim Kipp <jkipp5@home.com>
Subject: Re: Help with backup script
Message-Id: <39E80A82.22CF58C5@home.com>

Thanks John. I have never used file::find.  Why do you have to reference
the &wanted routine?
Also, I am not sure what is going on in the line:
return if $File::Find::dir =~ m-/(dirs|don't|want|copied)$-;

Thanks Again
Jim

> > use strict;
> 
> use File::Copy;
> use File::Find;
> 
> my $dir = 'd:/program files/netscape/users/me/mail'
> my $target = 'n:/nets_back'; # zip drive on Win95 machine
> 
> find( \&wanted, $dir );
> 
> sub wanted {
>     return if $File::Find::dir =~ m-/(dirs|don't|want|copied)$-;
>     copy( $File::Find::name, "$target/$_" );
> }
> 
> HTH
> 
> John


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

Date: Sat, 14 Oct 2000 01:27:33 -0700
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Help with backup script
Message-Id: <39E818F5.2A498ED1@acm.org>

Jim Kipp wrote:
> > > use strict;
> >
> > use File::Copy;
> > use File::Find;
> >
> > my $dir = 'd:/program files/netscape/users/me/mail'
> > my $target = 'n:/nets_back'; # zip drive on Win95 machine
> >
> > find( \&wanted, $dir );
> >
> > sub wanted {
> >     return if $File::Find::dir =~ m-/(dirs|don't|want|copied)$-;
> >     copy( $File::Find::name, "$target/$_" );
> > }
> 
> Thanks John. I have never used file::find.  Why do you have to reference
> the &wanted routine?

That is the way File::Find works. The first argument to find is a
reference to a subroutine and the second argument is a list of
directories. The 'wanted' sub is called by 'find' whenever it finds a
file. Inside the 'wanted' sub $_ is the name of the current file,
$File::Find::dir is the name of the directory the file is in and
$File::Find::name is the same as "$File::Find::dir/$_".

perldoc File::Find

> Also, I am not sure what is going on in the line:
> return if $File::Find::dir =~ m-/(dirs|don't|want|copied)$-;

Your original post had this subroutine:
> sub CheckDir{
>         my ($name) = shift;
>         if ($name !~ /^dirs|don't|want|copied$/) {
>                 return 1;
> 
>         }

It's the same test written a different way.  :-)

John


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

Date: Sat, 14 Oct 2000 04:20:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: MLDBM db Q.
Message-Id: <39E7DF25.AE808DAB@rochester.rr.com>

"Schwieterman, Chad" wrote:
> 
> I am using the MLDBM module to store a hash of hashes in a database. The
> problem is that I cannot delete the entries.
> 
> The entry looks like this:
> $MlDbM{'Email' => ['test'],'Name' => ['testing'],'ICQ' => ['tester']}Testing
> 
> sub deleteProfile{
>   # $db_loc is the location of the database
>   # $mode is 0640
>   # use MLDBM 'DB_File';
>   # $user is the user I am trying to delete. In this case Testing.
> 
>   tie %DBMHASH, 'MLDBM', $db_loc, O_CREAT|O_RDWR, $mode or bail("Cannot
> access the database, $!");
> 
>     if($DBMHASH{$user}){  #checks to see if user exists (this works)
>        delete $DBMHASH{$user}; #does not delete the member.. why?
>     }
> 
>   untie %DBMHASH;
> }

Hmmmm...well, I'm not sure what you are trying to get at with the
$MlDbM... statement -- it sure doesn't compile.  I'm assuming you
actually want something like:

%MlDbM=('Email'=>....);

In that case, the hash will have three keys:  Email, Name, and ICQ.

Later you try to access the key Testing in your hash.  But there isn't
any key by that name present (there is a value which is similar).  So
I'm confused by why you say the test to see if the user exists works?  

Note also that you should use the exists function to test for the
existence of a key, as what you have will check for the truth value of
the value of the key -- so if the key has a value of 0, for example,
your test would take the false branch even though the key exists.  

Given fixes for the above, I would expect the delete to work OK.  I just
tested it with an MLDBM-tied hash, and it works fine (MLDBM using
DB_File and Data::Dumper on Perl 5.6 ActiveState build 616, Windoze 98
SE).
-- 
Bob Walton


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

Date: Sat, 14 Oct 2000 06:00:35 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Multiple fork()s?
Message-Id: <39e7f682.5fe7$31a@news.op.net>
Keywords: asymptotic, biota, quaint, transceiver


In article <ARQF5.9343$46.85576@typhoon.san.rr.com>,  <eric@on-e.com> wrote:
>Ahh.. that's what I needed - I knew it was simple.  Much appreciated.

I'm glad I could help.


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

Date: 14 Oct 2000 01:11:06 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: question
Message-Id: <m31yxk2ej9.fsf@mumonkan.sunstarsys.com>

Uri Guttman <uri@sysarch.com> writes:

> >>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> 
>   JS> "Christian Gersch" <c.gersch@iglusoft.com> writes:
>   >> If ($. = 4) $text = $_;
> 
>   JS> this should read
> 
>   JS> if ($. == 4) { $text = $_; } #GOOD
> 
>   JS> or you could do the whole loop in one line:
> 
>   JS> $text = <FILE> while ($. <= 4); #BAD
> 
>   JS> but using $. really isn't a good idea
>   JS> since it makes your code difficult to
>   JS> read (most perlies don't know what $.
>   JS> does- I had to look it up myself). Put
>   JS> your own line counter variable in, and 
>   JS> name it as such, and break your code up 
>   JS> so each line does one thing.
> 
> that is bogus. $. is the better way to do it as it is simpler than
> making an extra counter. most perl hacker DO know it.

Oh really? and what happens when god forbid you have 2 files open at
the same time- and your haven't looked at the code in over a year? 

> then where do you draw the line? might as well not use perl if you have
> that attitude. obscurity and brevity for its own sake is for obsfucated
> contests and golf. but using a well documented perl variable for its
> intended purpose is neither.

Ever heard of something called KISS? nah- didn't think so.
Well so much for offering free advice- you get what you pay for!  


Best.
-- 
Joe Schaefer


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

Date: Sat, 14 Oct 2000 01:24:32 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: question
Message-Id: <Pine.GSO.4.21.0010140121020.14163-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 14, Joe Schaefer said:

>Uri Guttman <uri@sysarch.com> writes:
>
>> >>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
>> 
>>   JS> but using $. really isn't a good idea
>>   JS> since it makes your code difficult to
>>   JS> read (most perlies don't know what $.
>>   JS> does- I had to look it up myself). Put
>>   JS> your own line counter variable in, and 
>>   JS> name it as such, and break your code up 
>>   JS> so each line does one thing.

Was it such a bad thing to look up one of the variables Perl provides for
you?  Was learning something -- expanding your knowledge of Perl --
something that you didn't want to do?  Didn't enjoy?

Perl offers $. for a reason.  Perl also documents it for a reason.

>> that is bogus. $. is the better way to do it as it is simpler than
>> making an extra counter. most perl hacker DO know it.
>
>Oh really? and what happens when god forbid you have 2 files open at
>the same time- and your haven't looked at the code in over a year? 

What DOES happen when you have two files open at the same time?

  open A, "foo";
  open B, "bar";
  while (<A>) { print, last if $. == 10 }
  while (<B>) { print, last if $. == 5 }
  close B;
  close A;

That prints line 10 of foo, and line 5 of bar.  As expected.

>Ever heard of something called KISS? nah- didn't think so.
>Well so much for offering free advice- you get what you pay for!  

Which is simpler?  Using $. or making a counter variable for each file,
and incrementing it when you need to?

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: 14 Oct 2000 02:02:21 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: question
Message-Id: <m3vguw0xle.fsf@mumonkan.sunstarsys.com>

Jeff Pinyan <jeffp@crusoe.net> writes:


> >Oh really? and what happens when god forbid you have 2 files open at
> >the same time- and your haven't looked at the code in over a year? 
> 
> What DOES happen when you have two files open at the same time?
> 
>   open A, "foo";
>   open B, "bar";
>   while (<A>) { print, last if $. == 10 }
>   while (<B>) { print, last if $. == 5 }
>   close B;
>   close A;
>
> That prints line 10 of foo, and line 5 of bar.  As expected.
> 

You're not shortsighted enough to see that this example is of no more 
complexity than opening/closing the files in sequence.  I'm sure that 
in your experience you've needed to keep multiple files open, and read/write 
to them at a number of different places in your code. I'll even bet you've 
written a few scripts that required debugging? If not, they I guess I'm 
never going to get the KISS principle across to you.  

> Which is simpler?  Using $. or making a counter variable for each file,
> and incrementing it when you need to?

IMHO, shortcuts like $. are for experienced perl programmers.
The original poster does not fit that bill. Shortcuts are good things, but 
they should remain shortcuts, not standard coding practice. 

If we all taught people shortcuts from the very beginning, you'd wind up 
with little more than spaghetti code after the complexity of a project reached
a few hundred lines.  Scenario: if you were a project manager that was 
training new perl programmers, and were responsible for maintaining their 
code long after they left your employ, I think you'd know that teaching your 
coders to sprinkle their scripts with perl shortcuts (*especially $_*) is 
very foolish. People make mistakes, and it's much easier to debug code that 
reflects the programmers intentions- if there's a problem with $., you'll 
have quite along day tracking back to which file you read from last.  
Even worse, you might not know if the program is supposed to be counting lines 
from that last read file, or from some other file.  And *god forbid* you 
decide to add another code segment a few months after you've "completely" 
debugged it, and guess what- that segment opens/reads another file and 
screws up the count in $. that you previously pristine script relies on. 
OOPS!

Or you can avoid all this at the expense of a few additional bytes of memory,
and some clean coding practices.  I think we should be recommending to
new perl programmers that they go ahead and burn the bytes and KISS.
The better they get, the lazier they can be- but that priviledge should
be *earned*, not given away at the beginning.  Base on the question the
original poster asked, and the code he submitted, I don't think he's 
earned that right- but if you want to continue to debug for him, feel 
*free*.

I've said all I'm going on this subject- so feel free to put your final 
comments on the above.  I'm sure they'll be be "definitive".

-- 
Joe Schaefer


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

Date: Sat, 14 Oct 2000 06:13:28 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: question
Message-Id: <x77l7cvtkn.fsf@home.sysarch.com>

>>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:


  JS> You're not shortsighted enough to see that this example is of no
  JS> more complexity than opening/closing the files in sequence.  I'm
  JS> sure that in your experience you've needed to keep multiple files
  JS> open, and read/write to them at a number of different places in
  JS> your code. I'll even bet you've written a few scripts that
  JS> required debugging? If not, they I guess I'm never going to get
  JS> the KISS principle across to you.

and you will never get to be an experienced programmer. idioms,
shortcuts and other tools are the stock in trade of experienced
programmers. if you want to program in kiddie speak, go ahead, but not
for me.

  >> Which is simpler?  Using $. or making a counter variable for each file,
  >> and incrementing it when you need to?

  JS> IMHO, shortcuts like $. are for experienced perl programmers.  The
  JS> original poster does not fit that bill. Shortcuts are good things,
  JS> but they should remain shortcuts, not standard coding practice.

ok, the you should only program with turing machines. skip the
assemblers, high level langauges and perl.


  JS> If we all taught people shortcuts from the very beginning, you'd
  JS> wind up with little more than spaghetti code after the complexity
  JS> of a project reached a few hundred lines.  Scenario: if you were a

who ever said that? but it's obvious, you know better. teaching about a
useful perl variable is not advocating spaghetti code. you have no
logcial way to jump to that conclusion. you sound like moronzilla's
brother and want to stop all useful things from being used.

  JS> Or you can avoid all this at the expense of a few additional bytes
  JS> of memory, and some clean coding practices.  I think we should be

a few extra bytes everywhere and what do you have? omnimark, the
anti-perl!

  JS> recommending to new perl programmers that they go ahead and burn
  JS> the bytes and KISS.  The better they get, the lazier they can be-
  JS> but that priviledge should be *earned*, not given away at the
  JS> beginning.  Base on the question the original poster asked, and
  JS> the code he submitted, I don't think he's earned that right- but
  JS> if you want to continue to debug for him, feel *free*.

and what rights have you earned here? you have just started posting and
have obviously not done the requisite lurking. teaching new ideas to all
levels is common practice here. so is referring to the fine manuals to
be read instead of quoting them all the time. 

  JS> I've said all I'm going on this subject- so feel free to put your final 
  JS> comments on the above.  I'm sure they'll be be "definitive".

well, anything will be better than what you have said. and with your fun
attitude you will just be killfiled by most of the regulars here. have
fun!

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: Sat, 14 Oct 2000 07:31:24 GMT
From: Jim Kipp <jkipp5@home.com>
Subject: Re: Regex for matching e-mail addresses
Message-Id: <39E80D13.165B28AE@home.com>

$a =~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)

fgont@my-deja.com wrote:
> 
> Hi!
> 
> I'm looking for a regex for matching regular expressions.
> 
> For example, given the string:
> $a= "\"Gont \@ Fernando Ariel", <fernando\@hey.com>,
> someone\@somewhere.com";
> 
> It should only match "fernando\@hey.com" and "someone\@somewhere.com"
> 
> Kind regards,
> 
> Fernando Gont
> e-mail: fgont@ANTISPAM.softhome.net
> 
> [To send a personal reply please remove the antispam tag]
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


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

Date: Sat, 14 Oct 2000 19:43:56 +1000
From: Joel Mackay <j.mackay@biochem.usyd.edu.au>
Subject: run system command and return before completion
Message-Id: <39E82ADC.79E61D63@biochem.usyd.edu.au>

hi all,
I am trying to write a pelr CGI script that will run a number crunching
program from a form submit button, but will return control of the
browser window before the crunching finishes (since it will take several
hours). I tried simply using:

`dyana &`
ānd a number of variations thereof, but the browser always waits till
the program is finished running before continuing.

Any suggestions out there?
thanks,
joel
-- 
**********************************************************************
Dr Joel Mackay
ARC Research Fellow	
Department of Biochemistry		
University of Sydney		ph:  +612-9351-3906
NSW 2006, Australia		fax: +612-9351-4726
**********************************************************************


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

Date: Sat, 14 Oct 2000 00:47:58 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Why these 2 simple errors?
Message-Id: <28851-39E7F38E-2@storefull-242.iap.bryant.webtv.net>

#!/usr/local/bin/perl 
print "Content-type: text/html\n\n";
use lib 'modules/Archive-Tar-0.22'; 
use Tar;
$tar = Tar->new();
$tar->extract_archive("module.tar.gz",1);
print "File Has Been Extracted";

Why am I getting these errors?
1. Compression not available at line 4
2. Cannot locate object "new" at line 5

Thanks,
Dennis 



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

Date: Sat, 14 Oct 2000 06:25:02 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why these 2 simple errors?
Message-Id: <x74s2gvt1d.fsf@home.sysarch.com>

>>>>> "BN" == BUCK NAKED1 <dennis100@webtv.net> writes:

  BN> #!/usr/local/bin/perl 
  BN> print "Content-type: text/html\n\n";
  BN> use lib 'modules/Archive-Tar-0.22'; 
  BN> use Tar;
  BN> $tar = Tar->new();
  BN> $tar->extract_archive("module.tar.gz",1);
  BN> print "File Has Been Extracted";

  BN> Why am I getting these errors?
  BN> 1. Compression not available at line 4
  BN> 2. Cannot locate object "new" at line 5


from the docs for Archive::Tar:

    use Archive::Tar;
    Archive::Tar->create_archive ("my.tar.gz", 9, "/this/file", "/that/file");
    print join "\n", Archive::Tar->list_archive ("my.tar.gz"), "";
    $tar = Archive::Tar->new();

	Archive::Tar provides an object oriented mechanism for handling
	tar files. It provides class methods for quick and easy files
	handling while also allowing for the creation of tar file
	objects for custom manipulation. If you have the Compress::Zlib
	module installed, Archive::Tar will also support compressed or
	gzipped tar files.

so you are using the wrong class name which is why new is not found.

and you haven't installed Compress::Zlib which is why it says
compression not available.

so rtfm.

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: Sat, 14 Oct 2000 02:27:20 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Why these 2 simple errors?
Message-Id: <28852-39E80AD8-9@storefull-242.iap.bryant.webtv.net>

 
>uri@sysarch.com (Uri=A0Guttman) wrote:
>so you are using the wrong class 
>name which is why new is not found. 

Hmmm... I thought you could just call out the module name to use a
module in a local directory. When I change use Tar;
$tar =3D Tar->new();   to  use Archive::Tar;
$tar =3D Archive::Tar->new();   ...then my BEGIN fails, and it doesn't
find the module. 

>and you haven't installed
>Compress::Zlib which is why it 
>says compression not available. 

That's what I thought, and you're right, Compress::Zlib is not
installed... BUT the docs say it isn't necessary unless you're using
compression. I'm extracting, not compressing. 

>so rtfm. 
>uri

I have... many times, including the section you quoted. Any more ideas?

Thanks for your help,
--Dennis



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

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


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