[6682] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 307 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 15 16:17:16 1997

Date: Tue, 15 Apr 97 13:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 15 Apr 1997     Volume: 8 Number: 307

Today's topics:
     Re: [Q] Converting a string to lower case (Jeff Stampes)
     building 5.003; sdbm.c:39: parse error before `malloc' <allen@siva.usc.edu>
     How do I randomly re-order the lines of a file? (Adam H. Lewenberg)
     Re: Index of  items in a list? <tchrist@mox.perl.com>
     Re: Installing Perl5.003 (Matthew Cravit)
     Re: Kudos to Tom Christiansen and problems with OO (Terrence M. Brannon)
     Re: Need  a math program <sib@worldnet.att.net>
     Re: Opening Files That Match *.TXT Wildcard - How? <tchrist@mox.perl.com>
     Re: Passing How Do I Send Parseable values via the Comm <johnc@interactive.ibm.com>
     Perl code for POST and GET? <ragloh@menger.eecs.stevens-tech.edu>
     Re: Perl Curses with pdcurses2.2 on DOS... help? (Ilya Zakharevich)
     Re: Perl to Oracle on a NT-Server (John D Groenveld)
     Re: question: How does one substitute into something ot <sib@worldnet.att.net>
     Re: reading in password file (Justin C Lloyd)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Cyber Surfer)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Charles Lin)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and <fbonnet@irisa.fr>
     Re: Socket problem (Eric Bohlman)
     Re: Unix and ease of use  (WAS: Who makes more ...) (Kaz Kylheku)
     Re: Unix and ease of use  (WAS: Who makes more ...) <tim@a-sis.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) <tim@a-sis.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) (Kaz Kylheku)
     Re: Unix and ease of use (WAS: Who makes more ...) <tim@a-sis.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 15 Apr 1997 18:21:45 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: [Q] Converting a string to lower case
Message-Id: <5j0gvq$kcr$1@neocad.com>

amas@lhr-sys.dhl.com wrote:
: Coming from AWK I feel a bit lost without certain of my favourite
: function calls. One of these is the toLower() and toUpper() calls.

see man perlfunc and look for the functions uc() ucfirst() and lc().

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Tue, 15 Apr 1997 11:05:06 -0700
From: m Allen <allen@siva.usc.edu>
Subject: building 5.003; sdbm.c:39: parse error before `malloc'
Message-Id: <3353BF2A.43B874B5@siva.usc.edu>

Hi. I'm trying to build 5.0003 on a pentium pro running Linux slackware
1.2.13.

Problem: make is breaking on the SDBM_FILE section. 

Here is the relevant output:
sdbm.c:39: parse error before `malloc'
sdbm.c:39: warning: parameter names (without types) in function
declaration
sdbm.c:39: warning: data definition has no type or storage class
sdbm.c:40: parse error before `free'
sdbm.c:40: warning: parameter names (without types) in function
declaration
sdbm.c:40: warning: data definition has no type or storage class
sdbm.c:41: parse error before `lseek'
sdbm.c:41: warning: data definition has no type or storage class
sdbm.c: In function `sdbm_open':
sdbm.c:93: warning: assignment makes pointer from integer without a cast
sdbm.c: In function `sdbm_prep':
sdbm.c:129: `O_WRONLY' undeclared (first use this function)
sdbm.c:129: (Each undeclared identifier is reported only once
sdbm.c:129: for each function it appears in.)
sdbm.c:130: `O_RDWR' undeclared (first use this function)
sdbm.c:132: `O_RDONLY' undeclared (first use this function)
make[2]: *** [sdbm.o] Error 1
make[2]: Leaving directory
`/usr/users/joeallen/perl5.003/ext/SDBM_File/sdbm'
make[1]: *** [sdbm/libsdbm.a] Error 2
make[1]: Leaving directory `/usr/users/joeallen/perl5.003/ext/SDBM_File'
make: *** [lib/auto/SDBM_File/SDBM_File.so] Error 2

I'm trying to upgrade from 5.001 to 5.003, so that I can use GD.pm
I'm using the "latest.tar.gz". 
I've read the INSTALL notes, the hints/linux.sh, the FAQS and tried
dejanews. 

I've tried a bunch of variants on the configure script.
There is mention of Malloc problems in INSTALL, 
but I'm not sure that's my problem. I've tried both 
suggestions concerning -D flags anyway. 

make minitest is successful. 
Any hint about why the make would break here is appreciated. 

Additional curiosities:

Should I use the ELF binary off sunsite?
I really dont know what SDBM is for, do I need it? 
Should I try 5.0004?
Any libraries I am failing to include? (I'm just
using the defaults, I don't know where e.g., O_RDONLY is defined.)

Thanks for your time. 

-Joe Allen


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

Date: 15 Apr 1997 18:06:34 GMT
From: adam@orion.math.uiuc.edu (Adam H. Lewenberg)
Subject: How do I randomly re-order the lines of a file?
Message-Id: <5j0g3a$nd@vixen.cso.uiuc.edu>

I need to RANDOMLY re-order the lines of a small text file (between 20
and 50 lines). Preferably, I would like to say something like 'reorder
file' and get the re-ordered file sent to standard output. A perl
solution would be good, but I could also use awk, sed, or any of the
other standard UNIX tools. 

Example
original file:

line 1
line 2
line 3
line 4

after re-ordering:

line 3 
line 4
line 2
line 1

-- 
University of Illinois at Champaign-Urbana, Dept. Of Mathematics
INTERNET: adam@math.uiuc.edu   or    lewenber@uiuc.edu



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

Date: 15 Apr 1997 19:21:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Index of  items in a list?
Message-Id: <5j0kes$eq2$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    friendly@hotspur.psych.yorku.ca (Michael Friendly) writes:
:		push(@indices, 1+$i) if ($v =~ /$names[$i]/i);

Others have answer your other questions, but let me point 
out that what you have there will run about 10-20x slower than 
it should.   Use index() unless you *****REALLY***** need 
a pattern, and then go look in the faq for how to approach it.
Unless you're trying to be pessimally slow.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


    "That which does not kill me makes me stranger." --Larry Wall


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

Date: 15 Apr 1997 09:11:00 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Installing Perl5.003
Message-Id: <5j09ak$fhs@shell3.ba.best.com>

In article <5iumfc$gn@mtinsc05.worldnet.att.net>,
Shelly  <Swedek@postoffice.worldnet.att.net> wrote:
>How can I tell if I have a gcc CC c compiler?  I am trying to install
>Perl5.003 and when I get to the part where you type "make (return)"
>it says I'm missing files:  in.h, stat.h, timer.h termios.h, sockios.h,
>limits.h, and dirent.h.  Then it says "make *** [miniperlmain.o] Error 1.

That error message doesn't sound like it's related to whether your compiler
is gcc or not. That error message suggests you are missing some include files
under /usr/include/sys and /usr/include/netinet. Since you didn't specify
your OS, it's hard to be more specific in offering suggestions, but it sounds
like you need to go back and reinstall your include files (and possibly 
other pieces of the compiler). 

To answer your other question, though, you can find out if you have gcc by
typing "gcc -v", and seeing what it says. :)

/MC
-- 
--
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: 15 Apr 1997 12:21:44 -0700
From: brannon@bufo.usc.edu (Terrence M. Brannon)
Subject: Re: Kudos to Tom Christiansen and problems with OO
Message-Id: <ysizenccum62.fsf@bufo.usc.edu>

nelson <nmljn@wombat.netsinc.com> writes:

> BTW, are we talking jazz {piano,violin}, classical, country...?
> 
> Any other jazz pianist Perl types out there besides myself?
> 

The only Perl types are scalar, array, and hash. :-)

-- 
o============o  Sending  unsolicited commercial e-mail (UCE) to this address
 Legal Notice   is indication of your consent to pay me $120/hour for 1 hour
o============o  minimum for professional proofreading & technical assessment.
terrence brannon * brannon@kappa.usc.edu * http://rana.usc.edu:8376/~brannon


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

Date: Tue, 15 Apr 1997 14:01:23 -0400
From: Scott Blanksteen <sib@worldnet.att.net>
Subject: Re: Need  a math program
Message-Id: <3353C273.5BB7@worldnet.att.net>

netwatch@ix.netcom.com wrote:
> 
> I need a perl program that will add.sub, multi, amd div. numbers.
> It must have 3 levels of difficulty. Level 1 use numbers from 1 to 5,
> level 2  use numbers from 1 to 20, and level 3 use numbers from 1 to
> 50.

--------------%< cut here --------------
#!/usr/bin/perl

exec "bc" or die "Oh, well..";
--------------%< cut here --------------

This will give you as many "levels of difficulty" as you want.

Scott


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

Date: 15 Apr 1997 19:30:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Opening Files That Match *.TXT Wildcard - How?
Message-Id: <5j0l1f$eq2$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    frank@primemail.com writes:
:What can I use to read in all files that match *.txt and then perform
:operations on them in a perl script?
:
:$files = <>;  reads in all of the files from the command line but it
:also reads the contents of each file too.  I only want to read in all
:of the matching wildcard filenames so I can open each file and perform
:some edit operations on them.
:
:For example, if I have the following files
:
:1.txt
:2.txt
:3.txt
:
:I'd like to start my script like this:
:
:unix prompt> perl modify.pl *.txt
:
:
:and inside the script:
:
:open 1.txt for read
:read into some variables
:edit some of those variables
:
:open 1.txt for write
:print variables out (update the file)
:close file
:
:loop to get next .txt file (2.txt and then 3.txt)
:
:and have the script exit after opening all three .txt files
:
:All I could see in my perl book was the $file = <>;

    perl -i -pe s/foo/bar/g *.txt

Go read the FAQ, http://www.perl.com/perl/faq/

Q.  How do I change one line in a file/delete a line in a file/insert a line
    in the middle of a file/append to the beginning of a file?

A.  Although humans have an easy time thinking of a text file as being a
    sequence of lines that operates much like a stack of playing cards --
    or punch cards -- computers usually see the text file as a sequence
    of bytes. In general, there's no direct way for Perl to seek to a
    particular line of a file, insert text into a file, or remove text
    from a file.

    (There are exceptions in special circumstances. Replacing a sequence
    of bytes with another sequence of the same length is one. Another is
    using the `$DB_RECNO' array bindings as documented in the DB_File
    manpage. Yet another is manipulating files with all lines the same
    length.)

    The general solution is to create a temporary copy of the text file
    with the changes you want, then copy that over the original.

	$old = $file;
	$new = "$file.tmp.$$";
	$bak = "$file.bak";

	open(OLD, "< $old")         or die "can't open $old: $!";
	open(NEW, "> $new")         or die "can't open $new: $!";

	# Correct typos, preserving case
	while (<OLD>) {
	    s/\b(p)earl\b/${1}erl/i;
	    (print NEW $_)          or die "can't write to $new: $!";
	}

	close(OLD)                  or die "can't close $old: $!";
	close(NEW)                  or die "can't close $new: $!";

	rename($old, $bak)          or die "can't rename $old to $bak: $!";
	rename($new, $old)          or die "can't rename $new to $old: $!";

    Perl can do this sort of thing for you automatically with the `-i'
    command-line switch or the closely-related `$^I' variable (see the
    perlrun manpage for more details). Note that `-i' may require a suffix
    on some non-Unix systems; see the platform-specific documentation
    that came with your port.

	# Renumber a series of tests from the command line
	perl -pi -e 's/(^\s+test\s+)\d+/ $1 . ++$count /e' t/op/taint.t

	# form a script
	local($^I, @ARGV) = ('.bak', glob("*.c"));
	while (<>) {
	    if ($. == 1) {
		print "This line should appear at the top of each file\n";
	    }
	    s/\b(p)earl\b/${1}erl/i;        # Correct typos, preserving case
	    print;
	    close ARGV if eof;              # Reset $.
	}

    If you need to seek to an arbitrary line of a file that changes
    infrequently, you could build up an index of byte positions of where
    the line ends are in the file.  If the file is large, an index of
    every tenth or hundredth line end would allow you to seek and read
    fairly efficiently. If the file is sorted, try the look.pl library
    (part of the standard perl distribution).

    In the unique case of deleting lines at the end of a file, you can use tell() and
    truncate(). The following code snippet deletes the last line of a file without
    making a copy or reading the whole file into memory:

	    open (FH, "+< $file");
	    while ( <FH> ) { $addr = tell(FH) unless eof(FH) } 
	    truncate(FH, $addr);

    Error checking is left as an exercise for the reader.

-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    The autodecrement is not magical.
            --Larry Wall in the perl man page


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

Date: Tue, 15 Apr 1997 13:39:47 -0600
From: John Call <johnc@interactive.ibm.com>
Subject: Re: Passing How Do I Send Parseable values via the Command Line
Message-Id: <3353D971.3FF2@interactive.ibm.com>

>What does this have to do with Perl?  Perl != CGI.  Are you >aware that
>there are newsgroups for CGI and HTML issues?  I can't >>>
>swear that your
>question isn't Perl-related, but it sure smells like a CGI >question,
>which quite frankly, are seldom well-received in these >>
>parts.

>--tom
>-- 
>        Tom Christiansen        tchrist@jhereg.perl.com

>    #define NULL 0           /* silly thing is, we don't >>
>even use this */
>        --Larry Wall in perl.c from the v4.0 perl source >
>code

What's so funny to me is that by the time it took to write your message
and waste bandwith you could have answered his question which in my
opinion is enough related to Perl to be relevant.

John


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

Date: Tue, 15 Apr 1997 15:58:48 -0400
From: Keat Lim <ragloh@menger.eecs.stevens-tech.edu>
Subject: Perl code for POST and GET?
Message-Id: <3353DDF8.41C6@menger.eecs.stevens-tech.edu>

does anyone know if there is a way to push data equivalent to a POST or
GET from a html form? i'm trying to get around a server with a password
but i do not want the people to fill in the user+password, but instead
have a cgi-bin script to do it so i can have only certain people to get
into it without typing the user+pass.

thanks

keat lim


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

Date: 15 Apr 1997 18:50:45 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Curses with pdcurses2.2 on DOS... help?
Message-Id: <5j0im5$cbe$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<jtitus18@interoffice.net>],
who wrote in article <861089176.6009@dejanews.com>:
> I've been working on getting some sort of curses support into Perl for
> DOS so I can do some more advanced UI in DOS, but I'm having a hard time
> making the make file for Curses 1.01 (MakeMaker isn't ported to
> AvtiveWare's Perl yet).  It seems so close - djgpp w/ pdcurses there, perl
> curses library (and the perlmenu module to be layered on over that)...
> Has anyone already tried this?  Any ideas what it would take to roll a
> makefile for Perl Curses from scratch?
> 
> Any help would be much appreciated, and I imagine would prove useful for
> alot of other folks...

Note that the EMX-compiled perl executable includes statically linked
BSD curses (with a tiny patch which might make them useful - they are
useless without the patch).  Look on CPAN/ports/os2/latest.

Ilya


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

Date: 15 Apr 1997 13:49:51 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Perl to Oracle on a NT-Server
Message-Id: <5j0f3v$h52$1@pascal.cse.psu.edu>

See http://www.coe.missouri.edu/~faq/lists/dbiusers/index.html
This has been discussed previously on the DBI-Users list.
John
groenvel@cse.psu.edu


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

Date: Tue, 15 Apr 1997 14:17:32 -0400
From: Scott Blanksteen <sib@worldnet.att.net>
Subject: Re: question: How does one substitute into something other $_?
Message-Id: <3353C63C.6A80@worldnet.att.net>

Terrence M. Brannon wrote:
> 
> Every example I have seen in \\(learning\\|programming\\) perl uses $_
> for the substiution examples. Hence I have no idea how to do
> substitution in other variables.

$name = 'Fred';
$name =~ s/re/rie/;            # now $name eq 'Fried'
($out = $name) =~ s/r/l/;      # now $out eq 'Flied'
                               # and $name eq 'Fried'

Scott


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

Date: 15 Apr 1997 19:23:40 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: Re: reading in password file
Message-Id: <5j0kjs$469@news.fsu.edu>

Eric D. Friedman (friedman@medusa.acs.uci.edu) wrote:
: [mailed, posted]

[snip]

: sub read_password_file {
:    my @entry  = ();
:    my @pwfile = ();
:    while (@entry = getpwent) {
:      push @pwfile, \@entry;
:    }
:    return \@pwfile;
: }
: 
: Getting rid of @pwent is small potatoes, but returning a reference instead
: of a giant list from your function should make a significant difference.

Getting rid of @pwent doesn't work.  It is always pushing the same reference
onto @pwfile even though the contents of @entry are changing.  The extra
variable is necessary so that a new array is created for each iteration, and a
reference to it may be pushed onto @pwfile.

JcL

-- 
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant                phone: 904/644-0559
Department of Computer Science             email: lloyd@cs.fsu.edu
Florida State University                   www:   http://www.cs.fsu.edu/~lloyd

                                 P + L = :)


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

Date: Tue, 15 Apr 1997 19:08:19 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <MPG.dbdce361ec1911f989770@news.demon.co.uk>

With a mighty <joswig-ya023180001504971409520001@news.lavielle.com>,
joswig@lavielle.com uttered these wise words...

> In Lisp is not *everything* a list.
> 
> Common Lisp for example has numbers
> (diverse floats, fixnum, bignum, complex, ratio),
> arrays, characters, hashtables, structures, objects, functions,
> cons, symbols, strings, ...
> 
> And guess what, they are ****not**** represented as lists.

This is the point at which we should refer anyone interested to a 
reference for Lisp, or at least one of the Lisp dialects. For Common 
Lisp, there are a couple to choose from:

<URL:http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html>
<URL:http://www.harlequin.com/books/HyperSpec/FrontMatter/>

For Scheme:

<URL:http://swissnet.ai.mit.edu/~jaffer/r4rs_toc.html>

Locating the Lisp FAQ is left as an exercise for the reader. ;-)
-- 
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
  Martin Rodgers | Programmer and Information Broker | London, UK
            Please note: my email address is gubbish.


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

Date: 15 Apr 1997 18:18:45 GMT
From: clin@cs.umd.edu (Charles Lin)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <5j0gq5$jbi@mimsy.cs.umd.edu>

Graham Matthews (graham.matthews@maths.anu.edu.au) wrote:

|| Ok thats fair enough, but for me it raises another question, a question
|| that goes to the heart of why people think JO's article is just
|| advertising hype. Why did JO chose to represent everything as a string?
|| Why not everything as a number. Why not everything as a list? The latter
[...]

    If one had to choose a single type for everything, a string is a
pretty good choice.   Why not a number?  How would you represent a
string with a number?   You can represent a number with a string.
Just put quotes around it.   Code can be represented with a string.
Again, put quotes around it.   The main thing would be to parse the
string.    Should everything be just one type?   Obviously not, because
many languages have many types.   I don't have an answer to that
for a scripting language, however.

--
Charles Lin
clin@cs.umd.edu


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

Date: Tue, 15 Apr 1997 21:17:53 +0200
From: Frederic BONNET <fbonnet@irisa.fr>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <3353D461.58FD@irisa.fr>

Hi all,

Smiljan Grmek wrote:
> Sorry, Smalltalk is infinitesimaly used. There is an ongoing drive by
> IBM (of all companies!) but with little sucess. This can easily be
> verified if you look at job offerings on the Net with Smalltalk as
> keyword.

I don't know where you got this information from, but Smalltalk is far
from being infinitesimaly used. When I was a student at the EMN, my
friends and I were surprised by the number of high-tech software
companies who preferred Smalltalk to C++. And job offering on the Net
is not what I call a trustable reference (I'd rather call it Deep
Bullshit (tm))

> And it is hard to discuss computer languages with someone who can
> seriously entertain the thought  that 'Java is a *subset* (of all
> possible relationships!) of Smalltalk!'

Looking like C++ doesn't make Java one of its subsets. There are _lots_
of semantic changes that makes it closer to Smalltalk.
You should have a look at the Java specs as well as at a good Smalltalk
book (I recommend the "Blue book", "Smalltalk: the language and its
implementation" by Goldberg & Robson). Then you'll see that Java is
merely a Smalltalk with C++-like syntax, a bit more typing in the VM,
and less mature libraries. Maybe you'll look more informed next time ;-)

CU, Fred
--
Frederic BONNET		                                fbonnet@irisa.fr
 Ingenieur Ecole des Mines de Nantes/Ecole des Mines de Nantes Engineer
        IRISA Rennes, France - Projet Solidor/Solidor Project
------------------------------------------------------------------------
  Tcl: can't leave     | "Il ne faut jamais remettre au lendemain ce
$env(HOME) without it! | qu'on peut faire le surlendemain" (Oscar WILDE)


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

Date: Tue, 15 Apr 1997 18:10:49 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Socket problem
Message-Id: <ebohlmanE8oyI1.8F6@netcom.com>

Scott Luebking (phoenixl@netcom.com) wrote:

: Hi,
: I'm trying to set up a client for the web and am using the code below.
: For some reason, the code just hangs in the connect and never returns.
: Is there something I'm missing?

Using LWP would greatly simplify things, and relieve you of the need to 
debug the socket code yourself.



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

Date: 15 Apr 1997 15:37:54 GMT
From: kaz@vision.crest.nt.com (Kaz Kylheku)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j07ci$ltr@bcrkh13.bnr.ca>

In article <bnelsonE8nqKz.190@netcom.com>,
Bob Nelson  <bnelson@netcom.com> wrote:
>Kaz Kylheku <kaz@vision.crest.nt.com> wrote:
>
>> Imho, different jobs should be done by different programs. Gzip does
>> compression, and it does it very well. Tar is a great file archiver.  Files
>> that are ``tarred and gziped'' are usually smaller than archives produced by
>> PKZIP. For one thing, gzip can take advantage of global redundancies across
>> the whole archive file.
>
>> Having small tools as separate processes also lets you take advantage of
>> a multi-processor architecture. I can have tar running on one of my processors,
>> and compress on the other. *ZIP doesn't do this.
>
>It is also my understanding that tar (and possibly) gzip have some standing
>in POSIX. To the best of my knowledge, Katz's compression/archiving tools
>do not. (At least he does use the proper slash as a path separator).

Why would anyone use Katz'z crippleware trash anyway? I use zip and unzip (from
Info-zip), rather than pkzip and pkunzip. From Info-Zip's README file:


    GENERAL INFO
    ------------
    UnZip is an extraction utility for archives compressed in .zip format (also
    called "zipfiles").  Although highly compatible both with PKWARE's PKZIP
    and PKUNZIP utilities for MS-DOS and with Info-ZIP's own Zip program, our
    primary objectives have been portability and non-MSDOS functionality.

    This version of UnZip has been ported to a stupendous array of hardware--
    from micros to supercomputers--and operating systems:  Unix (many flavors),
    VMS, OS/2 (including DLL version), Windows NT and Windows 95 (including DLL
    version), Windows 3.x (including DLL versions), MS-DOS, AmigaDOS, Atari TOS,
    Acorn RISC OS, Macintosh, VM/CMS, MVS (mostly), Human68k (mostly), AOS/VS
    (partly) and TOPS-20 (partly).  UnZip features not found in PKUNZIP include
    source code; default extraction of directory trees (with a switch to defeat
->  ***********
->  ***********

    this, rather than the reverse); OS/2, VMS, Unix, RISC OS and Macintosh ex-
    tended file attributes; and, of course, the ability to run under most of
    your favorite operating systems.  Plus, it's free. :-)

Emphasis mine


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

Date: 15 Apr 1997 19:02:40 GMT
From: "Tim Behrendsen" <tim@a-sis.com>
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <01bc49cf$79567b60$87ee6fce@timpent.a-sis.com>

Jettero Heller <heller@nacs.net> wrote in article <5j06j7$hoh@tracy.nacs.net>...
> Tim Behrendsen (tim@a-sis.com) wrote:
> : I don't accept excuses for my employees, I don't accept excuses
> : for myself, and I don't accept them for Larry Wall.  There is no
> : excuse for code without comments.  Period.
> 
> Oh yes there is. If the code is written for the author only (as is
> the case with perl) then he/she *does not* need to comment didly!
> Don't try to push *your* personal coding beliefs on other people.
> If you can't accept other peoples coding styles, then don't look at
> their code! Larry Wall, Brian Kernighan, or myself *DO NOT* answer
> to you in regards to our code, so basically we don't care what you
> want us to do!

I hope this was a joke.

If not, whether you answer to me or not is irrelevent.  Of course
you can do whatever you want with your code.  That doesn't change
the fact that uncommented code released publically for a significantly
complex program is shamefully bad engineering.

And I'm not claiming perfection, either.  I have made many style
changes over the years when I've noticed that others didn't seem to
be able to follow what I was doing well.  I didn't whine and whimper
and get defensive about it.  Being a good engineer means evolving
through experience, and screaming "Wahh!  Don't criticize my code!"
does not do much for self-improvement.

-- 
==========================================================================
| Tim Behrendsen (tim@a-sis.com)        | http://www.cerfnet.com/~timb   |
| "Judge all, and be prepared to be judged by all."                      |
==========================================================================


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

Date: 15 Apr 1997 18:46:27 GMT
From: "Tim Behrendsen" <tim@a-sis.com>
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <01bc49cd$33e80be0$87ee6fce@timpent.a-sis.com>

Steve Mading <madings@earth.execpc.com> wrote in article
<5j071r$530$1@earth.execpc.com>...
> Tim Behrendsen (tim@a-sis.com) wrote:
> : Steve Mading <madings@earth.execpc.com> wrote in article
> : <5ishq7$slr$1@earth.execpc.com>...
> : > Tim Behrendsen (tim@a-sis.com) wrote:
> : > 
> : > : Hm; compare PKZIP and gzip (PKZIP includes the gzip algorithm, I
> : > : believe).  PKZIP includes support for multiple files, spanning
> : > : multiple floppies, and a zillion other features.
> : > 
> : > All of which are unnessacery on the Unix systems for which gzip
> : > was intended.  That's "tar"'s job.
> 
> : I understand that, and it's a lot less flexible that way.  Can
> : "tar | gzip" span multiple floppies?  No, unless you tar it
> : again after you make the file (assuming your tar supports the
> : feature).  Can I replace files within an archive?  Can I extract
> : one file without having to stream the whole silly file?
> 
> Extract one file without streaming the whole thing:  How do you know
> that pkzip does this?  all you know is that you ask for a particular
<[snip]

It has a directory structure.  It's not possible with tar|gzip
because the directory is compressed along with the data.

> Oh, and can pkzip archive to tape or other non-disk devices?  With
> Unix's everything-is-a-file sytesm, 'tar' can.  I even remember
>[snip]

Well, that's a property of Unix, not the tool necessarily.  I
like Unix, don't get me wrong. :-)

> : And it's also extremely fragile.  One corrupted byte and the
> : rest of the file is trash.  With a reasonable tool like pkzip,
> 
> This I admit is true.  Never had it happen though.  But to be fair,
> the messed up bit has to be in just the right spot.  Otherwise
> you only corrupt that file in the extraction.  The real problem comes
> when bytes are missing or extra bytes are added.  This is what
> hoses a tar file, because the tar format uses the filesize in bytes
> to determine where the next file in the archive starts.

No, one bit and entire rest of the compression stream is trash,
which means all of the rest of the files are trash.

> : you can often access files even if part of it is corrupt, and
> : sometimes even rebuild the directory structure.
> 
> : Or how about self-extracting archives?
> 
> A nice thing if you don't mind limiting yourself to one machine
> archetecture.  (Imagine trying to run a self-extracting exe on
> Windows NT on a non-intel box like Alpha.)  The Unix community
> does not want this feature since the Unix community has zillions
> of different archetectures to pass files between.  Since gzip
> came from Unixy people - it has no self-extracting exe format.
> This has nothing to do with it being free and everything to do
> with it being from Unix.

I must admit this a good point.  It would an interesting project
to write a very small extracter in C that could be imbedded with
the binary data, and all that wrapped in a shell script.  The
shell script could create the binary file and a .c file, compile
it, and then do the extraction.  Of course, not all Unix hosts
have C compilers, so this still wouldn't be a perfect solution.

Or write the extractor using the bourne-shell ... ugh.

-- 
==========================================================================
| Tim Behrendsen (tim@a-sis.com)        | http://www.cerfnet.com/~timb   |
| "Judge all, and be prepared to be judged by all."                      |
==========================================================================


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

Date: 15 Apr 1997 15:54:46 GMT
From: kaz@vision.crest.nt.com (Kaz Kylheku)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j08c6$mjm@bcrkh13.bnr.ca>

In article <01bc491a$6a263f00$87ee6fce@timpent.a-sis.com>,
Tim Behrendsen <tim@a-sis.com> wrote:
>Steve Mading <madings@earth.execpc.com> wrote in article
><5ishq7$slr$1@earth.execpc.com>...
>> Tim Behrendsen (tim@a-sis.com) wrote:
>> 
>> : Hm; compare PKZIP and gzip (PKZIP includes the gzip algorithm, I
>> : believe).  PKZIP includes support for multiple files, spanning
>> : multiple floppies, and a zillion other features.
>> 
>> All of which are unnessacery on the Unix systems for which gzip
>> was intended.  That's "tar"'s job.
>
>I understand that, and it's a lot less flexible that way.  Can
>"tar | gzip" span multiple floppies?  No, unless you tar it

Yes. You just need an additional member in the pipe to do the splitting.
The following script could be modified to do the job in such a way that
input would be read from standard input and the chunks would go directly to
your floppy drive device. Under UNIX, I don't have to bother putting a
filesystem on the floppy either, just dump the sectors to it raw:


    #!/bin/posix/sh

    if [ $# != 1 ] ; then
	    echo usage: $0 '<filename>'
	    exit 1
    fi

    bsize=$(( 1024 * 1024 ))
    i=0

    while
	    ext="000"$i
	    ext=${ext#${ext%???}}
	    ! dd if="$1" of="$1".$ext skip=$i count=1 bs=$bsize 2>&1 |
		    grep "0+1" > /dev/null
    do
	    i=$(( i + 1 ))
    done

Splitting the file into 1.4 megabyte chunks is a logically separate operation
from that of archiving and compression.

>again after you make the file (assuming your tar supports the
>feature).  Can I replace files within an archive?  Can I extract
>one file without having to stream the whole silly file?

This hasn't shown itself to be a problem in practice. At least not to me.
I have Info-Zip/Unzip. It's freely distributed in source form just like
GNU zip and GNU tar. If the disadvantages in the tar + gzip method were
so great, I'd find myself actually using the zip/unzip tools. Somehow,
I do not!

>And it's also extremely fragile.  One corrupted byte and the
>rest of the file is trash.  With a reasonable tool like pkzip,

There is an advantage buried in there too: cryptographic strength.  An
encrypted tar.gz file has less structure and fewer plaintext regularities that
can be exploited for a known plaintext attack.  On the other hand, you can use
a different encryption key for each compressed file in a Zip-like archive.

>you can often access files even if part of it is corrupt, and
>sometimes even rebuild the directory structure.
>
>Or how about self-extracting archives?

How about preserving symbolic links, permissions and ownerships? ;)

How good is a self extracting archive on a machine whose processor can't
execute it? By the time you install an emulator, I can just grab
a decompression tool.

>Don't get me wrong; I use the tar-gzip combination quite often,
>but it's inferior as a tool compared to archive tools, particularly
>in combination with something like WinZip.

WinZip isn't portable to many platforms, which makes it useless. I don't
use windows at all, for example, so I can't benefit from WinZip.


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

Date: 15 Apr 1997 14:30:54 GMT
From: "Tim Behrendsen" <tim@a-sis.com>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <01bc49a9$7eed1aa0$87ee6fce@timpent.a-sis.com>

Mike List <troll@net-link.net> wrote in article <3352312A.662192AE@net-link.net>...
> What reality do you inhabit? I'm sick of the lie retold until it's
> finally true. Socialism did not collapse on its own. It requiresd the
> ful weight of the non-socialist world's resources brought to bear to
> cause it to collapse. It's very comforting to social conservatives to
> think that that EVIL system has been proven to be ineffective. Socialist
> countries have simply chosen to ignore the fact that sharing resources
> ala Marx, if not done willingly will be worked around so I can have just
> a bit more than you. By using purges and prisons, Stalin et al failed to
> allow an ethos that allowed socialism to flourish in the face of
> combined non socialist world pressure. the internal failure was due to
> megalomania on the part of those socialist rulers who couldn't wait for
> their worker's utopia so they would be remembered as "great men"."Alie ,
> told often enough, is still a lie"- every sensible human in history

So, to sum up your point,

"Socialism did not collapse because the system didn't work!  It
collapsed because the people within it didn't work within the system
to make it successful!"

You *do* realize that this is the whole point, don't you?  Socialism
inherently fails because it is diametrically opposed to human
psychology.  Socialists live in a world of beautiful theory.  "Just
imagine if everyone could work together in love and harmony, instead
of all this eeevil competition!"


    Imagine all the people, paying their own way...
    You may say, I'm a dreamer,
    but I'm not the only one...

-- 
==========================================================================
| Tim Behrendsen (tim@a-sis.com)        | http://www.cerfnet.com/~timb   |
| "Judge all, and be prepared to be judged by all."                      |
==========================================================================


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

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

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