[7798] in Perl-Users-Digest
Perl-Users Digest, Issue: 1423 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 6 03:07:31 1997
Date: Sat, 6 Dec 97 00:00:38 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 6 Dec 1997 Volume: 8 Number: 1423
Today's topics:
Re: ... rumours run amok (Hans Juergen von Lengerke)
Re: 001 + 1 = 002; 002 - 1 = 1 ARGH (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: ? on localtime(time); (Ronald L. Parker)
All files created by my script have permissions of ---- <Brett.W.Denner@lmco.com>
Bizarre possible perl bug -- help! (Iosif Fettich)
Communication through pipes with su (Jeff Yoak)
evaluating $var within files? <erixred@IDT.NET>
Re: forked processes not exiting <ghowland@hotlava.com>
Re: forked processes not exiting <andy_collier@customer_insight.com>
Re: forked processes not exiting <dan@ukonline.co.uk>
Re: getopts on NT? (Jeff Kehoe)
Re: Help with VERY simple problem <tycage@infi.net>
Re: How do I print all but the first variable in an arr (Sean McAfee)
I need help with perl-cgi script <foley.steve@ic.gc.ca>
Re: Mailing binary file <eryq@zeegee.com>
Re: NEWBIE can't tar latest_tar.gz (Mike Stok)
Re: NEWBIE can't tar latest_tar.gz charlot@SPAM-FREE.org
Re: NEWBIE can't tar latest_tar.gz <tycage@infi.net>
Odd minus/modulus behavior (Sean McAfee)
PERL Backticks and Non-parsed Headers (NPH) (Scriptman)
PERL<-->databases ???(newbie) (Damir Boraska)
Re: Q: lambda fun, loop, string to expr (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: recursing sub directories (Andrew M. Langmead)
Re: Regular Expressions <mak@mark.dircon.net>
Re: Seems to be just another 5.004_* bug:-( (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: use CGI (Andrew Williams)
variable <i101038@spv.ing.uniroma1.it>
Re: Windows 95 flock problem (hapless newbie question) <camerond@mail.uca.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 05 Dec 1997 18:34:52 GMT
From: lenkerWEEDS@dircon.co.uk (Hans Juergen von Lengerke)
Subject: Re: ... rumours run amok
Message-Id: <34894898.4599701@news.dircon.co.uk>
Randal Schwartz wrote:
>On IRC-EFNET #perl the other day, we came up with some more precisely
>accurate, but scary phrases:
>
> Larry Wall has no plans to make Perl4 be Y2K!
> No patches will ever be released to make Perl4 Y2K.
> It is unlikely that Perl4 will ever be Y2K certified.
>
>So, be sure to memorize the above phrases, and repeat them as often as
>you can. ^^^^^^^^ ^^^^^^
Or write a script to do it for you :-)
Hans
#! /usr/bin/perl -w
&memorize;&repeat;sub memorize {@scare = ("Larry Wall has no plans "
."to make Perl4 be Y2K!\n","No patches will ever be released to mak"
."e Perl4 Y2K.\n", "It is unlikely that Perl4 will ever be Y2K cert"
."ified.\n");} sub repeat{while ("true") {foreach(@scare) {print;}}}
--
To mail me, just pull the WEEDS!
------------------------------
Date: Fri, 05 Dec 97 12:26:55 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: 001 + 1 = 002; 002 - 1 = 1 ARGH
Message-Id: <34883a28$2$ofn$mr2ice@speaker>
In <348cdb18.9232288@news.tornado.be>, on 12/05/97 at 10:56 AM,
bart.mediamind@tornado.be (Bart Lateur) said:
+-----
| >Probably because there's no obvious predecessor to 'a000', for example.
| Ok. So what comes after "a999"?
+--->8
"b000". If you autoincrement "z999" it adds another character in front in the
sequence of the current first character, hence "aa000". This is relatively
simple and deterministic, unlike the question of what to do with autodrcrement
(if you follow the same rule you end up with an empty string; what happens if
you autodecrement that?).
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Fri, 05 Dec 1997 14:39:22 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: ? on localtime(time);
Message-Id: <34880e1a.4727958@10.0.2.33>
[courtesy copy to Tom]
On 5 Dec 1997 00:44:10 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time() - 24 * 60 * 60);
This doesn't work for two hours out of the year (midnight to 1 PM on
the first Monday in April, and 11PM to midnight on the last Sunday in
October) in those backwater parts of the US that still bother with
that centuries-old concept we call DST, because not all days have 24
hours.
I think you can check the $isdst flag, and if "yesterday's" DST flag
is not the same as today's, adjust the time appropriately and call
localtime again for the correct date. Fortunately, my Perl scripts
don't have to worry about this. Instead, my scripts find all the
DST-related localtime bugs in every C Runtime ever built.
It's good to see you're back, Tom. We missed you.
------------------------------
Date: Fri, 05 Dec 1997 10:44:57 -0600
From: Brett Denner <Brett.W.Denner@lmco.com>
Subject: All files created by my script have permissions of ----------
Message-Id: <34882F89.41C6@lmco.com>
I am running a large Perl script on both an Iris (6.2) and a Cray using
Perl 5.004_04. The script works fine on the Cray, but on the Iris, all
of the files created by the script have permissions set to ----------.
That is, when I type 'ls -lF', the listing for my created files looks
like this:
---------- 1 denner prop 0 Dec 5 10:31 falcon.dbm.dir
---------- 1 denner prop 1024 Dec 5 10:31 falcon.dbm.pag
Eventually, of course, if I try to access these (and other) files, my
script bombs. BTW, when I run 'print umask, "\n";' with the script, it
print out 18 (decimal), which equates to 022 octal.
Can anyone suggest why my Perl script is mis-setting these file
protections?
Thanks,
Brett
--
Brett W. Denner Lockheed Martin TAS
Brett.W.Denner@lmco.com P.O. Box 748
(817) 935-1144 (voice) Fort Worth, TX 76101
(817) 935-1212 (fax) MZ 9333
------------------------------
Date: Fri, 05 Dec 1997 17:50:41 GMT
From: ifettich@netsoft.ro (Iosif Fettich)
Subject: Bizarre possible perl bug -- help!
Message-Id: <34883ce8.39770698@news.taide.net>
On Tue, 02 Dec 1997 13:55:38 -0800, Matthew Reimer <mreimer@vpop.net>
wrote:
>I'm having a strange problem with perl where a file-scoped lexical
>variable usage inside an eval returns "" unless the variable is somehow
>referred to within the subroutine.
>
>For example, running the program below results in the following output:
>
>---
>build: var is 0123456789
>Use of uninitialized value at (eval 1) line 1.
>subst: var is
>---
>
>Uncommenting the "$SOME_VAR;" line and running the program gives this:
>
>---
>Useless use of private variable in void context at test.pm line 22.
>Useless use of private variable in void context at test.pm line 22.
>build: var is 0123456789
>subst: var is 0123456789
>---
>
>I've tested this with perl 5.003, 5.004_01 and 5.004_04 with the same
>results.
>
>Is this a perl bug, or am I doing something wrong?
>
>Thanks in advance for any help you can give.
Use of "my" is somewhat tricky; take a look to the corresponding man
page (man perlfunc) or the Camel book, page 189 in the Second Edition.
An excerpt shows that:
"A private variable is not visible until the statement _after_ its
declaration. Subroutines called from within the scope of such a
private variable cannot see the private variable unless the subroutine
is also textually declared within the scope of the variable".
You may use local instead, if this fits you:
local $test::SOME_VAR;
$test::SOME_VAR = "0123456" etc.
Iosif Fettich
ifettich@netsoft.ro
>
>Matt
>
>---file test.pl-------------------------------------
>
>#!/usr/local/bin/perl5.00401 -w
>
>use lib '.';
>use test;
>
>&build;
>exit;
>
>---file test.pm-------------------------------------
>
>package test;
>use Exporter;
>@ISA = qw(Exporter);
>@EXPORT = qw(build);
>
>use strict;
>
>my $SOME_VAR;
>
>sub build {
>
> $SOME_VAR = "0123456789";
>
> print "build: var is $SOME_VAR\n";
> &subst();
>
>}
>
>sub subst {
> my $string = 'subst: var is $SOME_VAR';
>
># $SOME_VAR;
> print eval qq/"$string"/, "\n";
>
>}
>
>1;
-----------------------------------------------------------------------
Iosif Fettich | e-mail: ifettich@netsoft.ro ICQ UIN: 5496730
Mng. Director | phone/fax: +40-(0)65-162614
NetSoft SRL | mail: NetSoft SRL,4300 Tg.Mures,O.P.1-C.P.172,Romania
------------------------------
Date: Fri, 05 Dec 1997 17:42:16 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Communication through pipes with su
Message-Id: <669e9b$jdn@sjx-ixn5.ix.netcom.com>
Hi everyone. A client of mine would like to have a CGI script that
will allow him to execute a command as if he were logged in via
telnet. My question is twofold and concerns the following code.
if($username) {
open(COMMAND, "|su $username -c '$command 2>&1' |");
print COMMAND "$password\n";
$output = <COMMAND>;
} else {
$output = `$command 2>&1`;
}
The three variables are obtained successfully be earlier code. If no
username / password are provided, this code will perform the command
entered with the ID of the webserver (nobody) and $output has STDOUT
and STDERR to return. If username and password are provided and
correct, the command is executed with the id of the user, but I don't
get the output.
My first question is whether or not this is safe. Other than the risk
of sending a password to the server unencrypted (which he can overcome
with htts if he is really concerned at that level) I don't see any
problems here, but I'm not an expert.
The second question concerns the output. I've never tried to work
with pipes on both sides of a command before. What sort of approach
is required to get the output I'm looking for?
Cheers,
Jeff
Jeff Yoak jeff@yoak.com http://yoak.com/
------------------------------
Date: 5 Dec 1997 17:20:25 GMT
From: eric bucher <erixred@IDT.NET>
Subject: evaluating $var within files?
Message-Id: <669d4p$f8@nnrp3.farm.idt.net>
This has got to be so elementary that it escapes me.
I've got a file with several variables in it
(ie. $var1, $var2, etc..) that i would like to have evaluated
by a PERL program like this:
#!/usr/local/bin/perl
$file = 'file2';
open(INPUT, "$file"); {
while (<INPUT>) {
print $_;
}
close (INPUT);
}
But my $var's just don't get evaluated, even though they are defined
and I can get them to print with ( print $var; ).
What am I doing wrong?
thanks in advance,
eric
------------------------------
Date: Fri, 05 Dec 1997 17:50:58 +0100
From: Gary Howland <ghowland@hotlava.com>
To: "Robert G. Ferrell" <rferrell@usgs.gov>
Subject: Re: forked processes not exiting
Message-Id: <348830F2.1671@hotlava.com>
Robert G. Ferrell wrote:
>
> In article <668t8t$r8b$1@apple.news.easynet.net>, dan@ukonline.co.uk
> says...
> >They don't actually exit (using 'exit
> >0;') , instead they become zombie processes. Anyone have any ideas, or
> >could
> >point me in the right direction ?
>
> You mean, say, the C/S example in the Camel book? Each forked process
> should have its own exit statement that is invoked when the input buffer
> from the client is empty. If this isn't happening, check to make sure
> first of all that there *is* an exit statement in your code. If worse
> comes to worse, you could always grep ps for zombies and kill them that
> way. Crude, but effective in a pinch.
Sorry, but even that won't work. Zombie processes are already dead, but
are taking up a slot in the process table since the parent has yet to
collect the exit code (using wait(2)). The only way around this is for
the parent to do a wait(2), perhaps on catching the death of child
signal, e.g.:
$SIG{CHLD} = sub { wait };
Another alternative is to use the double fork trick:
unless ($pid = fork) {
unless (fork) {
exec "what you really wanna do";
die "no exec";
# ... or ...
## (some_perl_code_here)
exit 0;
}
exit 0;
}
waitpid($pid,0);
This is just one of the headaches that fork() is responsible for. Like
I said in a message a couple of days ago - fork() is a truly pathetic
way to do "multithreading". (But we don't have much alternative when
using perl).
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: Fri, 05 Dec 1997 11:13:09 -0700
From: Andy Collier <andy_collier@customer_insight.com>
Subject: Re: forked processes not exiting
Message-Id: <34884435.55A6ADE2@customer_insight.com>
Dan Hopkins wrote:
>
> I've recently set up a perl client-server system running on BSDI UNIX. A lot
> of the code was ..ahem... 'borrowed' from a freely available client-server
> example.
>
> It all works reasonably well ..... apart from killing off the forked servers
> once they've completed their tasks. They don't actually exit (using 'exit
> 0;') , instead they become zombie processes. Anyone have any ideas, or could
> point me in the right direction ?
>
You need to do a wait() or waitpid() from the parent of the process in
order to harvest the childs exit so that a zombie process isnt created.
Check the second edition O'Reilly book and look for the little section
of code entitled REAPER in the Cl/Svr examples for a starting point.
But the base fact on a *ix system is that you have to have something to
take the exit of a child when it exits. If you dont, the OS will (and
thats where zombies come from). Thats life with fork() and friends (as
I learned many years ago in C). Too bad we dont have true threading yet
-- it would likely solve most of your problems while causing you a few
new interesting ones.
Regards,
A.C.
------------------------------
Date: Fri, 5 Dec 1997 17:59:57 -0000
From: "Dan Hopkins" <dan@ukonline.co.uk>
Subject: Re: forked processes not exiting
Message-Id: <669fc2$27f$1@apple.news.easynet.net>
Gary Howland wrote in message <348830F2.1671@hotlava.com>...
>> In article <668t8t$r8b$1@apple.news.easynet.net>, dan@ukonline.co.uk
>> says...
>> >They don't actually exit (using 'exit
>> >0;') , instead they become zombie processes
<SNIP>
>Sorry, but even that won't work. Zombie processes are already dead, but
>are taking up a slot in the process table since the parent has yet to
>collect the exit code (using wait(2)). The only way around this is for
>the parent to do a wait(2), perhaps on catching the death of child
>signal.
>
>This is just one of the headaches that fork() is responsible for. Like
>I said in a message a couple of days ago - fork() is a truly pathetic
>way to do "multithreading". (But we don't have much alternative when
>using perl).
>Gary
>--
>pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
>Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
Thanks for the help guys (and those who replied via email). A well placed
waitpid and all is well.
.... another case of RTFM I guess ! ...
Cheers.
-------------------------------------------------
Dan Hopkins
Systems Admin & Development
UK Online Ltd.
email: dan@ukonline.co.uk
-------------------------------------------------
------------------------------
Date: 5 Dec 1997 18:07:41 GMT
From: kehoe@fc.hp.com (Jeff Kehoe)
Subject: Re: getopts on NT?
Message-Id: <669ftd$7vo@fcnews.fc.hp.com>
Problem solved! I found the answer on the FAQ at :
http://www.perl.com/CPAN-local/doc/FAQs/win32/Perl_for_Win32_FAQ_4.html
(question 4.10 - Thanks to Evangelo Prodromou!)
The problem was with the association of perl.exe with the .pl file type.
You have to add a few characters to get the command line args passed to
perl.exe properly. Here are the instructions from the FAQ.
1. Open the My Computer icon on the Desktop.
The My Computer window should appear.
2. From the View menu in the My Computer window, select Options.
The Options dialog box should appear.
3. In the Options dialog box, select the File Types tab.
4. Click the New Type button.
The Add New File Type dialog box should appear.
5. In the Description of type edit box, type "Perl Script".
6. In the Associated extension edit box, type ".pl".
7. Leave the Content Type (MIME) edit box blank.
8. Click the New button beneath the Actions list.
The New Action dialog box will appear.
9. In the Action edit box, type "Open"
(it's important to use this name for the action!).
10. In the Application used to perform action edit box, type
"[full path to perl]\perl.exe %1 %*",
where [full path to perl] is the full path to perl.exe on your
machine. Note that if perl is in your path, you _can_ just put perl.exe,
but for esoteric reasons it's just better to put the full path. Also,
if the path to your interpreter includes spaces
(like "C:\Program Files\perl5")
put in the DOS path instead ("C:\progra~1\perl5").
11. Click OK to close the New Action dialog box.
12. Click OK to close the Add New File Type dialog box.
13. Click OK to close the Options dialog box.
Thanks for all the help!
Jeff
------------------------------
Date: Fri, 05 Dec 1997 12:35:58 -0500
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: Help with VERY simple problem
Message-Id: <34883B7E.17EEB9D@infi.net>
Jason Thomas Hitesman wrote:
> I'm trying to read in a text file so that each the lines are stored in an
> array here's what I'm using
>
> (just the snippet of code I'm having problems with is included)
>
> while (<PFILE>) {
> $rows[$i] = <PFILE>;
> $i++;
> }
>
> However when I try to read in a three line text file I only get two lines
> read in.
You are using the <PFILE> incorrectly. Here's what is happening.
while(<PFILE>) { # Takes a line out of PFILE and puts it into $_;
$rows[$i] = <PFILE>; #Takes the next line of out PFILE and puts it
into $rows[$i]
$i++;
}
Then you go back to the top of the while loop and the next line is
assigned to
$_ then inside the loop the next line is assigned to $rows[$i].
So only every other line is being put in @rows.
There are several ways to do this.
@rows = <PFILE>
This is the easiest. PFILE gets put into @rows one line at the time.
or doing it with your loop you would say,
$i=0;
while(<PFILE>) {
$rows[$i++] = $_;
}
or you could be cute and say
$i=0;
while(defined($rows[$i++] = <PFILE>)){};
but I'm just getting silly now.
Hope this helps,
Ty
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
The Web Site of Love: http://www.wsol.net/mst3k/
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: 5 Dec 1997 17:18:17 GMT
From: mcafee@breakout.rs.itd.umich.edu (Sean McAfee)
Subject: Re: How do I print all but the first variable in an array?
Message-Id: <669d0p$cem$1@newbabylon.rs.itd.umich.edu>
In article <3487a7be.28527677@news.demon.co.uk>,
James Zubin Pope <jzp@usa.net> wrote:
>I am fairly new to perl and this is the situation I am in. I need to
>be able to print all but the first variable in a regular array.
How about this:
print substr(join(" ", @array), length($array[0]) + 1);
Avoids both an iterative loop and the construction of a mostly-redundant
subarray. Then again, maybe this is even more efficient:
$temp = shift(@array);
print join(" ", @array);
unshift(@array, $temp);
--
Sean McAfee | GS d->-- s+++: a25 C++ US+++$ P+++ L E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ | mcafee@
| R+ tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Fri, 05 Dec 1997 12:39:59 -0500
From: Stephen Foley <foley.steve@ic.gc.ca>
Subject: I need help with perl-cgi script
Message-Id: <34883C6F.37AE0B52@ic.gc.ca>
If anyone can help I appreciate it!
I am trying to put a web forum up on a NT server. I got the script from
Matts script archive, and configured it as directed through the provided
documentation.
Upon submitting the form, I get the error:
HTTP/1.0 501 Not Supported
All the files and directories have been given proper access (readable,
writeable, executable)
The script was written for unix, but it has been modified according to
matt's script archive documentation.
I am lost! help!
foley.steve@ic.gc.ca
------------------------------
Date: Fri, 05 Dec 1997 11:36:59 -0500
From: Eryq <eryq@zeegee.com>
To: Mikel Cook <mikel@ap.net>
Subject: Re: Mailing binary file
Message-Id: <34882DAB.486B@zeegee.com>
Mikel Cook wrote:
>
> I am developing a site that will send an image form to a third party. I
> have a script that sends out an email item, but the image doesn't make it.
>
> The host is UNIX, the email server is sendmail (Linux flavor, I believe).
>
> I open the handle MAIL for output, create and print a message header, open
> the binary file for input, use binmode, then I am using
>
> while (!eof <handle>) {
> print MAIL;
> }
>
2 problems noticed; 1 solution follows:
1) In general, Internet email cannot send arbitrary
binary data safely. That's why MIME-encoding was invented.
Your example hints at some -B switch to sendmail that
I've never seen before, so I can't verify that you're doing
"the right thing".
2) If you're reading binary data, use read(). Don't get lines with <>.
Read chunks of, say, 4096 bytes from the file until done, and
print them to MAIL.
> I am not getting an error on the open statement even with the -w parameter,
> so it seems that flag is OK. I read in the sendmail man page that the -B
> flag is for a binary message body.
Yes, but how is that message body encoded? base64 I would hope.
Anyway, I would suggest getting MIME::Lite from CPAN, available
also at:
http://www.enteract.com/~eryq/CPAN/MIME-Lite/
http://www.enteract.com/~eryq/CPAN/MIME-Lite/docs/MIME/
Through it, you can say:
$msg = new MIME::Lite
From =>'me@myhost.com',
To =>'you@yourhost.com',
Cc =>'some@other.com, some@more.com',
Subject =>'Helloooooo, nurse!',
Type =>'image/gif',
Encoding =>'base64',
Path =>'/path/to/hellonurse.gif';
$msg->send;
That should work on any Unix system with sendmail.
Hope that helps,
--
___ _ _ _ _ ___ _ Eryq (eryq@zeegee.com)
/ _ \| '_| | | |/ _ ' / President, Zero G Inc.
| __/| | | |_| | |_| | "Talk is cheap. Let's build." - Red Green.
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: 5 Dec 1997 17:12:53 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: NEWBIE can't tar latest_tar.gz
Message-Id: <669cml$2pc@news-central.tiac.net>
In article <669c3o$spr@mtinsc05.worldnet.att.net>,
Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
>I am trying to extract latest_tar.gz on a SCO Unix box. The command i am
>using is tar xvf latest_tar.gz. I am getting directory checksum
>errors. Any help for a Newbie??
The .gz suffix indicates it's a compressed file, so you can do somehting
like:
gunzip -c latest_tar.gz | tar xvf -
where gunzip reads latest_tar.gz and squrts the decompressed version to
tar's standard input.
Some versions of tar have flags to automatically filter input or output
streams through compress or gzip, they should be documented on tar's man
page if they exist.
If the decompression has problems then the file may have been corrupted
during download.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 5 Dec 1997 12:21:10 -0500
From: charlot@SPAM-FREE.org
Subject: Re: NEWBIE can't tar latest_tar.gz
Message-Id: <669d66$3h4@ocean.CAM.ORG>
In article <669c3o$spr@mtinsc05.worldnet.att.net>,
Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
>I am trying to extract latest_tar.gz on a SCO Unix box. The command i am
>using is tar xvf latest_tar.gz. I am getting directory checksum
>errors. Any help for a Newbie??
>
Sure. You must "gunzip" the file before trying to extract its contents.
Assuming you have gzip installed on your system:
gunzip latest_tar.gz | tar xvf -
or
cat latest_tar.gz | gunzip | tar xvf -
or
gunzip latest_tar.gz
tar xvf latest_tar
Hope this helps,
Richard.
--
Richard Bellavance -- charlot(at)cam(dot)org -- http://www.cam.org/~charlot/
"All along this path I tread / My heart betrays my weary head
With nothing but my love to save / From the cradle to the grave"
(Eric Clapton, "From the cradle")
------------------------------
Date: Fri, 05 Dec 1997 12:38:28 -0500
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: NEWBIE can't tar latest_tar.gz
Message-Id: <34883C14.2994A66D@infi.net>
charlot@SPAM-FREE.org wrote:
>
> In article <669c3o$spr@mtinsc05.worldnet.att.net>,
> Nick Nottleman <Nick1pub@worldnet.att.net> wrote:
> >I am trying to extract latest_tar.gz on a SCO Unix box. The command i am
> >using is tar xvf latest_tar.gz. I am getting directory checksum
> >errors. Any help for a Newbie??
> >
>
> Sure. You must "gunzip" the file before trying to extract its contents.
> Assuming you have gzip installed on your system:
>
> gunzip latest_tar.gz | tar xvf -
^
|--- missing a -c here.
Should be
gunzip -c latest_tar.gz | tar -xvf -
Hope this helps,
Ty
--
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
The Web Site of Love: http://www.wsol.net/mst3k/
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: 5 Dec 1997 18:07:59 GMT
From: mcafee@breakout.rs.itd.umich.edu (Sean McAfee)
Subject: Odd minus/modulus behavior
Message-Id: <669ftv$d65$1@newbabylon.rs.itd.umich.edu>
> perl -e 'print -3 % 4'
1
> perl -e '$a = "xyz"; print -length($a) % 4'
-3
> perl -e '$a = "xyz"; print ((-length($a)) % 4)'
-3
> perl -e 'print ((-3) % 4)'
1
> perl -e '$a = "xyz"; $b = length($a); print -$b % 4;'
1
Huh?
--
Sean McAfee | GS d->-- s+++: a25 C++ US+++$ P+++ L E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ | mcafee@
| R+ tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 5 Dec 1997 17:26:10 GMT
From: scriptman@aol.com (Scriptman)
Subject: PERL Backticks and Non-parsed Headers (NPH)
Message-Id: <19971205172600.MAA28425@ladder01.news.aol.com>
The following code CORRECTLY generates a non-parsed header (NPH) and allows me
to see its output from my browser as it executes:
#!/usr/bin/perl
$server_protocol = $ENV{'SERVER_PROTOCOL'};
print "$server_protocol : 200 OK\n";
print "Content-type: text/html\n\n";
print "<HTML><BODY><PRE>\n";
print "OK, Here I go. I am counting from 1 to 10!\n";
$|=1;
for ($i=1; $i <= 10; $i++)
{
print "$i\n";
sleep(1);
} #i
print "All done!\n";
print "</PRE></BODY></HTML>\n";
exit;
However, what I need to be able to do is to invoke an EXTERNAL script and have
it work the same way. The following code DOES NOT work:
#!/usr/bin/perl
### MAIN SCRIPT ###
$server_protocol = $ENV{'SERVER_PROTOCOL'};
$server_software = $ENV{'SERVER_SOFTWARE'};
print "$server_protocol : 200 OK\n";
print "Content-type: text/html\n\n";
print "<HTML><BODY><PRE>\n";
print "OK, Here I go. I am counting from 1 to 10!\n";
$|=1;
print `/home/p_sattle/cgi-bin/nphcall.pl`;
print "All done!\n";
print "</PRE></BODY></HTML>\n";
exit;
#!/usr/bin/perl
### CALLED SCRIPT (nphcall.pl) ###
$|=1; #Presence or absence of this didn't seem to matter!
for ($i=1; $i <= 10; $i++)
{
print "$i\n";
sleep(1);
} #i
exit;
Some type of buffering must be going on somewhere! How do get the second
senerio to work like the first???
Thanks in advance,
Pete Sattler
Chase Manhattan Bank
------------------------------
Date: 5 Dec 1997 16:47:22 GMT
From: dboraska@jagor.srce.hr (Damir Boraska)
Subject: PERL<-->databases ???(newbie)
Message-Id: <669b6q$og5@bagan.srce.hr>
HI there..I hope that there should be someone outhere who will help me with
this *problem*...
I'm using perl just ocasionally,so my knowledge of it is not really
impressive..however I find perl great for writing cgi scripts.
I need to write web form-data into a database,and also to offer a search
of the same database...
Now here it comes: I have NO experiences with anything like that,so I'd
appreciate if someone could tell me how to do it...and what to use.
Database fields should be: author/title/volume/issue/kkeywords...
and serach should be done in the same categories....THANX!!!
P.S. I use Unix!!!
------------------------------
Date: Fri, 05 Dec 97 12:38:00 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Q: lambda fun, loop, string to expr
Message-Id: <34883cb3$3$ofn$mr2ice@speaker>
In <66723f$i1c$1@agate.berkeley.edu>, on 12/04/97 at 07:59 PM,
ilya@math.ohio-state.edu (Ilya Zakharevich) said:
+-----
| > But you can't adapt that to Perl subs in general, since sort's BLOCK parameter
| > is deliberately optimized to skip some context setup. Omit setting up the
| > context for subs in general and an awful lot of subs are going to break
| > horribly....
| If this were true, you would not be able to put whatever you want after
| `sort'.
| However, it IS true - in *general*.
+--->8
Understand that I'm a "defensive programming" type --- a lot of subs would
work, but the ones that don't would create a nightmare. I'm not real keen on
the idea in *general*.
And I'm none too certain that a "sniffer" could ferret out all of the nasty
cases. Swiss Army Chainsaws can cut in both directions :-)
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Fri, 5 Dec 1997 17:41:19 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: recursing sub directories
Message-Id: <EKq94v.8Lw@world.std.com>
rabrody@earthlink.net_NOSPAM (Robert Brody) writes:
>Hi. In reading the posts and DejaNews, I came across a very handy
>Perl command to search/replace text in files in an entire directory.
> perl -pi -e 's/old/new/g' *
>Varients of this were also exampled, such as attaching a suffix to the
>original file, eg., -pi.bak, or specifying a specific filename pattern
>instead of an asterisk, and so forth.
>Can this command be extended to recurse all subdirectories from the
>current directory?
>From the quoting and the wildcard syntax, I'm assuming that you are
using a machine running unix.
A non-perl solution would be to use the "find" command to create a
list of files and "xargs" to run your perl script on them.
find . -type f -print|xargs perl -pi -e 's/old/new/g'
A perl only solution would be to use the File::Find module to collect
all the files:
#!/usr/bin/perl -w -pi
use File::Find;
BEGIN {
@dirs = @ARGV; # directories to search are on the command line
undef @ARGV; # clear it out so we can spoof the files to change.
# collect file names
find sub { return unless -f $_; push @ARGV, $File::Find::name}, @dirs;
}
#change all of the files
s/old/new/g;
You may want to change things a bit so that you process each file as
find() sees them rather than collecting them all at once. Also, since
this got a little bigger than a one liner, you may want to forget
about the impicit -pi loop and code one explicitly.
--
Andrew Langmead
------------------------------
Date: Fri, 05 Dec 1997 17:16:05 +0000
From: Mark Morgan <mak@mark.dircon.net>
Subject: Re: Regular Expressions
Message-Id: <348836D5.B14AE5A2@mark.dircon.net>
David Siebert wrote:
>
> I have the Camal but but this section is notvery clear. I need to convert \n
> and \c\n to <BR> any suggestions?
Not sure why you're trying to do this, but the following should work:
$var=~s/\c?\n/<BR>/g;
Mark.
------------------------------
Date: Fri, 05 Dec 97 12:43:50 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Seems to be just another 5.004_* bug:-(
Message-Id: <34883db4$4$ofn$mr2ice@speaker>
In <Pine.GSO.3.96.971204141220.4421N-100000@usertest.teleport.com>, on
12/04/97 at 02:14 PM,
Tom Phoenix <rootbeer@teleport.com> said:
+-----
| for ($n=1; $n < 1e12; $n++) { sleep 1 }
| What do you propose that we do about it? :-)
+--->8
"I can't allow you to do that, Dave." :-) A sentient Perl is about the only
evolution path left anyway....
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Fri, 05 Dec 1997 18:27:00 GMT
From: andrew@edoc.com (Andrew Williams)
Subject: Re: use CGI
Message-Id: <34894764.73868171@news.clark.net>
On Fri, 05 Dec 1997 15:28:12 GMT, paineta@edp.net (Thomas Paine)
wrote:
>I have a perl script that was running on a DEC Alpha machine and it had the
>following line.
>
>use CGI qw(:standard);
>
>I am trying to make this script run on a NT web server, but I am not having
>much luck. Could someone possibly point me in the right direction.
Sounds like CGI.pm is not installed.
------------------------------
Date: Fri, 05 Dec 1997 18:22:12 +0100
From: Marcello Pediconi <i101038@spv.ing.uniroma1.it>
Subject: variable
Message-Id: <34883844.2275CAA5@spv.ing.uniroma1.it>
I tried to define a variable in this way
$testa1 = '<html><head><meta
http-equiv="Content-Type"content="text/html".....
The interpreter gives me some errors. How do I have to do to define this
variable?
Thanks
Pippo
------------------------------
Date: Fri, 05 Dec 1997 11:06:48 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Ryan McGuigan <ryan@ramresearch.com>
Subject: Re: Windows 95 flock problem (hapless newbie question)
Message-Id: <348834A8.B86A7C5F@mail.uca.edu>
Ryan McGuigan wrote:
>
> [snip]
> It is really a good idea to setup some file locking mechanism, or,
> download a better build of perl for win32 (which supports flock).
>
> Go here http://www.perl.com/CPAN-local/ports/winNT/Standard/
>
> This is, in my opinion, much better than activeware's port.
BUZZ. Sorry, but your answer is INCORRECT (the correctness of your
opinion is undefined). Yes, GS's port (5.04002) does support flock(),
but Win95 does not. You will get a message using the -w switch something
to the effect that "flock() is not supported on this platform." You're
stuck without it, unless you use another OS (flock does work on WinNT,
if you're so inclined).
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1423
**************************************