[6675] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 300 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 14 17:17:20 1997

Date: Mon, 14 Apr 97 14:00:25 -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           Mon, 14 Apr 1997     Volume: 8 Number: 300

Today's topics:
     Re: "Dummies" book any good? <critter@quack.kfu.com>
     Re: -e command-line option <rra@stanford.edu>
     Re: Beginner - Time constaints <rra@stanford.edu>
     convert a char into ASCII <rachel@cbogate.peel.edu.on.ca>
     coupons,contests,$ and more adpark.com
     Re: Crypt function doesn't appear to work (Brooks Davis)
     Re: help with Perl boundaries (Bill)
     Re: How to set the time? <rra@stanford.edu>
     Re: httpd server for win95 <Chris.King@swindon-fc.demon.co.uk.mars>
     Re: Kudos to Tom Christiansen and problems with OO (Tad McClellan)
     Limiting system use - Perl bombing system (Andrew Daviel)
     MailFolder installation problem <santiago@gambito.com>
     my love/hate relationship the period! (Steven T. Zydek)
     Re: my love/hate relationship the period! (Nathan V. Patwardhan)
     Oraperl (James A Hunter (UG4))
     PERL BUG: ([]) x 3 does not work correctly (Brian Dellert)
     Re: PERL BUG: ([]) x 3 does not work correctly <rra@stanford.edu>
     Perl on Sco System V <dclark@mail.basis.com>
     Perl training in Toronto Canada? (Honrio Cham)
     print errors aren't? (Frank Stuart)
     Re: Problem with code fragment <rra@stanford.edu>
     Re: Problem with code fragment (Tad McClellan)
     Re: Radius, a perl for your thoughts <gnat@elara.frii.com>
     Re: SLEEP (.5) ??? <brett@speedy.speakeasy.org>
     Re: SLEEP (.5) ??? (Charles DeRykus)
     Swatch - Need the FTP site rchannav@transquest.com
     Re: Transliterate from a pattern? <dbenhur@egames.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) (Tom Wheeley)
     Re: Unix and ease of use  (WAS: Who makes more ...) (Ryurick M. Hristev)
     Re: Use of Tcl without Tk (John E Koontz)
     Re: Why is $Line=~ s///; erasing = (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 14 Apr 1997 10:21:11 -0700
From: "Charles F. Ritter" <critter@quack.kfu.com>
Subject: Re: "Dummies" book any good?
Message-Id: <33526787.5252A9FC@quack.kfu.com>

Jeffrey Friedl wrote:
> 
> Robert Ducharme <duchar96@sparky.cs.nyu.edu> wrote:
> |> Has anyone had a chance to take a look at the recently released "Perl
> |> for Dummies" book?
> 

No "dummies" book is any good. I question the writer's respect for the
reader when they give the book such a title.

A good starter book is Learning Perl - the llama book by O'Reilly.
-- 
Charles Ritter

Microsoft NT - when they are finally finished it will be the best
documented unix operating system on the market.


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

Date: 14 Apr 1997 12:35:23 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: -e command-line option
Message-Id: <qumzpv1gzyc.fsf@cyclone.stanford.edu>

Ronald Fischer <rfi@uebemc.siemens.de> writes:

> perl -e 'while(<>){ print "$. $_"; }' -e 'print "DONE\n"' < ~/.login 

perl -pe 'END { print "DONE\n" } print "$. "' < ~/.login

:)

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: 14 Apr 1997 12:43:32 -0700
From: Russ Allbery <rra@stanford.edu>
To: turnerm@cs.man.ac.uk
Subject: Re: Beginner - Time constaints
Message-Id: <qumwwq5gzkr.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Mark Turner <turnerm@cs.man.ac.uk> writes:

> I am writing a Perl program which halfway through executes a C program,
> I would like to put some kind of time constraint on this C program so
> the it carn't get stuck in a continous loop.

> What I need to say in Perl it execute this C program and if it hasn't
> completed within 3 seconds stop it running.

Something along the lines of the following (UNTESTED) should work:

my $pid = fork;
if (not defined $pid) { die "couldn't fork: $!" }
if ($pid) {
    # In parent.
    sleep 3;
    kill $pid;
} else {
    # In child.
    exec 'c-program';
    # NOT REACHED
}

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Mon, 14 Apr 1997 14:25:15 -0400
From: Rachel Mackenzie <rachel@cbogate.peel.edu.on.ca>
Subject: convert a char into ASCII
Message-Id: <3352768B.38F09A7F@cbogate.peel.edu.on.ca>

How do you change a character to ascii???

how do you change ascii to character????

Thanks for any help
rach


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

Date: Fri, 11 Apr 1997 09:51:31
From: adpark.com
Subject: coupons,contests,$ and more
Message-Id: <5ilqmn$bi2@taurus.adnc.com>

Coupons, contests, Free chance at $100,000.
 Earn $$ passing out isp diskettes almost anywhere in the country.
All this and more see: http://www.adpark.com


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

Date: 14 Apr 1997 18:08:02 GMT
From: brdavis@orion.ac.hmc.edu (Brooks Davis)
Subject: Re: Crypt function doesn't appear to work
Message-Id: <5itrq2$hl0$1@cinenews.claremont.edu>

Jeff Thistle (jthistle@cancom.net) wrote:
: I've written a routine that is _supposed_ to encrypt a string that a user
: enters and add it to a .passwd file for use by NCSA Basic Authentication.
: 
: This is the snippet I'm using to do the encryption:
: 
: $Salt = int(rand(100))+1;
: $Encrypted = crypt ($String,$Salt);
: 
: What the heck am I doing wrong?

I think the problem is your salt selection.  Salts are two character strings
made up of the characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./

A random int dosen't give you that.

-- Brooks

--
Brooks Davis            +------------------------------------------------+
brdavis@hmc.edu         | "_Slackware_ [Linux] is the MacOS of UNIXes."  |
Harvey Mudd College     |                    -- Richard Garnish          |
340 E. Foothill Blvd.   |                       on alt.sysadmin.recovery |
Claremont, CA 91711     +------------------------------------------------+


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

Date: 14 Apr 1997 19:26:43 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: help with Perl boundaries
Message-Id: <slrn5l517j.n3q.bill@granite.sover.net>

In article <01bc4749$76d3ada0$ad2185d0@perdue-1>, David Perdue wrote:
>Hi
>
>I working my way thru  the "Learning Perl" book and I've run into a
>problem.
>
>From the Perl Book:
>
>/\b\+/\b/;  # matches "x+y" but not "++" or " + "
>
>I really don't get this. to me the expression means that it is trying to
>match a "+" with a boundary in each side. or " + ".  Could someone help me
>out here?

   \b means the boundary between a word character (\w) and a non-word 
character (\W).  \w is just the character class [a-zA-Z_0-9], which 
DOESN'T include '+'.  So, the boundaries fall like x\b+\by in x+y, but in 
"++' and " + " there are no word characters at all (as defined by \w) and so 
there are no boundaries.  

>Second example from the Perl book:
>
>/abc\bdef/;  #never matches (impossible for boundary here)   
>
>Why wouldn't the string  "abc def" be a match? would not the space between
>"c" and "d" be the boundary?
>
>Your help is appreciated greatly!
>
>--dp

   "abc def" doesn't match because there is no space in the pattern.  The 
pattern says to look for abc followed by a word boundary, followed by 
def.  The thing to remember here is that a boundary isn't an actual 
character; it's a boundary between different types of characters, in this 
case between word characters and non-word characters.  

						Bill
-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.



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

Date: 14 Apr 1997 12:57:36 -0700
From: Russ Allbery <rra@stanford.edu>
To: posenj@lancet.co.za
Subject: Re: How to set the time?
Message-Id: <qumohbhgyxb.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Kevin Posen <posenj@lancet.co.za> writes:

> I know how to get the time with localtime() and gmttime(), but how do I
> set the current time of the computer?

This is highly OS-dependent (it varies by brand of Unix, if I recall
correctly) and requires that you be root to do.  I doubt that there is any
standard module to do this (it would have to be written in C most likely
for portability reasons).

I wonder how many platforms settimeofday() works correctly on.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Mon, 14 Apr 1997 12:45:40 +0100
From: Chris King <Chris.King@swindon-fc.demon.co.uk.mars>
Subject: Re: httpd server for win95
Message-Id: <k$4yqGAkjhUzEwiU@swindon-fc.demon.co.uk>

In article <335187A3.203A@dcc.net.au>, Goce Dimitroski <goce@dcc.net.au>
writes
>
>where can i get a httpd server for win95 so that i can test out my cgi
>stuff ?

Beats me - why not ask in a cgi newsgroup?
-- 
Chris King
The similarity of any fact mentioned within this post and
any in reality, living or dead, is purely coincidental.
Remove 'mars' from address when replying. I hate spam.
I like corned beef though.


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

Date: Mon, 14 Apr 1997 13:41:51 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Kudos to Tom Christiansen and problems with OO
Message-Id: <fptti5.hm.ln@localhost>

Will Morse (will@Starbase.NeoSoft.COM) wrote:
: I just thought I'd mention that Tom is also an outstanding pianist.

I had three puppies.


I named one "Blacky" 'cause he was the blackest.

I named one "Whitey" 'cause he was the whitest.

I named one "Tom" 'cause he was the pianist. 


(no aspersions cast here, but it reminded me of this (poor) joke  ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 14 Apr 1997 20:29:55 GMT
From: andrew@andrew.triumf.ca (Andrew Daviel)
Subject: Limiting system use - Perl bombing system
Message-Id: <5iu443$rmb$1@nntp.ucs.ubc.ca>

Maybe everyone knew but me. Then again, maybe they didn't....

I was running a Perl script to analyse logfiles, started from crontab
on a Linux system. When the logfile got too large before being reset
at the end of the week, the system bombed (every night at 04:26-ish)
when the process had managed to get through 90Mb odd of virtual memory.
Fortunately the watchdog circuit actually works :-)
(http://vancouver-webpages.com/watchdog/) 

In Perl it's easy to forget about system resources and just assume
that virtual memory will handle it. One guy told me of LateX2HTML
running up to 600Mb ...)

I later found the shell command "ulimit", set by default to unlimited
on my system, so I can now do

ulimit -d 40000 -t 7200 ; log-analysis.pl

Just making the swap space bigger is only postponing the problem ... :-)


Andrew Daviel, TRIUMF


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

Date: 14 Apr 1997 17:34:32 GMT
From: "Santiago Alvarez Rojo" <santiago@gambito.com>
Subject: MailFolder installation problem
Message-Id: <01bc48fc$6050d580$635135c3@jimmy.iponet.es>

Hi, I'm trying to install MailFolder0.06 and when I do 'make test', it
complains about a MIME method: header (see log below). I've previously
installed MIME-parser-1.13, isn't this the last version?

Anyone has a hint?

TIA
Ps. email reply will be appreciated

-- 
Santiago Alvarez Rojo
     santiago@gambito.com
     http://www.gambito.com/santiago
-----------------

CREATING MailFolder-0.006
-------------------------

linux:/tmp/mail/MailFolder-0.06# perl Makefile.PL 
Writing Makefile for Mail


linux:/tmp/mail/MailFolder-0.06# make
Manifying ./blib/man3/Mail::Folder::NNTP.3
Manifying ./blib/man3/Mail::Folder.3
Manifying ./blib/man3/Mail::Folder::Maildir.3
Manifying ./blib/man3/Mail::Folder::Emaul.3
Manifying ./blib/man3/Mail::Folder::Mbox.3


linux:/tmp/mail/MailFolder-0.06# make test
/usr/bin/perl t/TEST 0
emaul/01_emaul......ok
emaul/02_empty......ok
emaul/03_sync.......ok
emaul/04_curr.......ok
emaul/05_get........Can't locate object method "header" via package
"MIME::Head" at ../blib/lib/Mail/Folder.pm line 537.
dubious
        Test returned status 9 (wstat 2304)
DIED. FAILED tests 11-24
        Failed 14/24 tests, 41.67% okay
emaul/06_label......ok
emaul/07_del........ok
emaul/08_sort.......ok
emaul/09_select.....ok
emaul/10_append.....ok
emaul/11_pack.......ok
emaul/12_refile.....ok
emaul/13_update.....ok
mbox/01_mbox........ok
mbox/02_empty.......ok
mbox/03_sync........ok
mbox/04_curr........ok
mbox/05_get.........Can't locate object method "header" via package
"MIME::Head" at ../blib/lib/Mail/Folder.pm line 537.
dubious
        Test returned status 2 (wstat 512
DIED. FAILED tests 11-24
        Failed 14/24 tests, 41.67% okay
mbox/06_label.......ok
mbox/07_del.........ok
mbox/08_sort........ok
mbox/09_select......ok
mbox/10_append......ok
mbox/11_pack........ok
mbox/12_refile......ok
mbox/13_update......ok
maildir/01_maildir..ok
maildir/02_empty....ok
maildir/03_sync.....ok
maildir/04_curr.....ok
maildir/05_get......Can't locate object method "header" via package
"MIME::Head" at ../blib/lib/Mail/Folder.pm line 537.
dubious
        Test returned status 2 (wstat 512)
DIED. FAILED tests 11-24
        Failed 14/24 tests, 41.67% okay
maildir/06_label....ok
maildir/07_del......ok
maildir/08_sort.....ok
maildir/09_select...ok
maildir/10_append...ok
maildir/11_pack.....ok
maildir/12_refile...ok
maildir/13_update...ok
Failed Test  Status Wstat Total Fail  Failed  List of failed
----------------------------------------------------------------------------
--
emaul/05_get.t    9  2304    24   14  58.33%  11-24
maildir/05_get.   2   512    24   14  58.33%  11-24
mbox/05_get.t     2   512    24   14  58.33%  11-24
Failed 3/39 test scripts, 92.31% okay. 42/565 subtests failed, 92.57% okay.
make: *** [test] Error 29



CREATING MIME-parser-1.13
-------------------------

linux:/tmp/mail/MIME-parser-1.13# perl Makefile.PL
Writing Makefile for MIME


linux:/tmp/mail/MIME-parser-1.13# make
Manifying ./blib/man3/MIME::Decoder.3
Manifying ./blib/man3/MIME::Head.3
Manifying ./blib/man3/MIME::Entity.3
/usr/bin/podman: MIME/Entity.pm is missing required section: SYNOPSIS
Manifying ./blib/man3/MIME::Parser.3

linux:/tmp/mail/MIME-parser-1.13# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -I./blib/arch -I./blib/lib
-I/usr/lib/perl5/i486
-linux/5.00397 -I/usr/lib/perl5 -e 'use Test::Harness qw(&runtests
$verbose); $a
verbose=0; runtests @ARGV;' t/*.t
t/Head..............
        test 1: read a bogus file (this had better fail...)
open BLAHBLAH: No such file or directory at blib/lib/MIME/Head.pm line 136.
        test 2: parse in the crlf.hdr file:
        test 3: did we get all the fields?
        test 4: could we get() the 'subject'?
        test 5: could we set() the 'Subject', and get it as 'SUBJECT'?
        test 6: does the exists() method work?
        test 7-11: create a custom structured field, and extract parameters
ok
t/Parser............"my" variable $parser masks earlier declaration in same
scoa
pe at t/Parser.t line 68.
"my" variable $entity masks earlier declaration in same scope at t/Parser.t
line
 71.

        test 1: read a nested multipart MIME message
I'm ignoring an evil recommended filename (/evil/filename) at t/Parser.t
line 17
, <IN> chunk 77.
        test 2-7: check the various output files
        test 8: same message, but CRLF-terminated and no output path hook
Desired filename '/evil/filename' is evil... I'm ignoring it
ok
All tests successful.
Files=2,  Tests=19,  2 secs ( 1.00 cusr  0.16 csys =  1.16 cpu)


linux:/tmp/mail/MIME-parser-1.13# make install
Skipping /usr/lib/perl5/site_perl/./MIME/Decoder.pm (unchanged)
Skipping /usr/lib/perl5/site_perl/./MIME/Head.pm (unchanged)
Skipping /usr/lib/perl5/site_perl/./MIME/Parser.pm (unchanged)
Skipping /usr/lib/perl5/site_perl/./MIME/Entity.pm (unchanged)
Skipping /usr/lib/perl5/man/man3/./MIME::Decoder.3 (unchanged)
Skipping /usr/lib/perl5/man/man3/./MIME::Head.3 (unchanged)
Skipping /usr/lib/perl5/man/man3/./MIME::Entity.3 (unchanged)
Skipping /usr/lib/perl5/man/man3/./MIME::Parser.3 (unchanged)
Writing /usr/lib/perl5/site_perl/i486-linux/auto/MIME/.packlist
Appending installation info to
/usr/lib/perl5/i486-linux/5.00397/perllocal.pod



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

Date: 14 Apr 1997 20:24:26 GMT
From: stzydek@rs6000.cmp.ilstu.edu (Steven T. Zydek)
Subject: my love/hate relationship the period!
Message-Id: <5iu3pq$ktf@thor.cmp.ilstu.edu>


I am having trouble splitting a string by a period.  here's what I am doing:

example:

-----------------------beginning--------------------------------------

$love = "138.87.2.240";
($hate, $hate1, $hate2, $hate3)=split(/./, $love, 4);
print "\n$hate, $hate1, $hate2, $hate3";

-----------------------cut here---------------------------------------

This has not worked for me.  I have tried different characters (i.e.,
I replace the periods in $love with "+" or "=" or " " and it has worked.)
Try it out tell me what you think!  
Is there an alternative way of splitting with periods?  
Does PERL see periods as decimal points only?  hmmmm...

Take Care,
Steve Zydek
-- 
Networking Systems * Jul 146 * 309-438-5343 * M+W 10-4 TU+TR 9-12 F 8-4  
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
| "The Mechanics of a Word with respect to the Amplitude of a Second" |
| SwimSuit International, a division of Kulprit Konnextion Recordings |
|    *   Soon to Come: Everything Makes a Sound.  Bear in Trap.  *    |
*---------------------------------------------------------------------*
www.ilstu.edu/~stzydek * PO Box 953,Normal IL 61761 * stzydek@ilstu.edu


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

Date: 14 Apr 1997 20:52:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: my love/hate relationship the period!
Message-Id: <5iu5en$49f@fridge-nf0.shore.net>

Steven T. Zydek (stzydek@rs6000.cmp.ilstu.edu) wrote:

: I am having trouble splitting a string by a period.  here's what I am doing:

: $love = "138.87.2.240";
: ($hate, $hate1, $hate2, $hate3)=split(/./, $love, 4);
: print "\n$hate, $hate1, $hate2, $hate3";

$love = "138.87.2.240";
(@hated) = split(/\./, $hate);
foreach (@hated) {
   print $_,"\n";
}

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 14 Apr 1997 19:55:14 GMT
From: jah@cs.stir.ac.uk (James A Hunter (UG4))
Subject: Oraperl
Message-Id: <5iu232$6g0@lorne.stir.ac.uk>

Just a short note about oraperl and probably something simple to someone who has
done alot of programming in the area.

The problem is that I have written a search program to search my database and all
it seems to do is bring back the first result found, even though their is other
matches after the one it has found.  See below my program:

#!/usr/local/bin/oraperl
require "cgi-lib.pl";

# reads the information typed in via the web
&ReadParse(*input);

# print correct information to start runnung the program
# on the Web
print &PrintHeader;
print &HtmlTop ("Link Search\n");


$ora_debug = shift if $ARGV[0] =~ /^-#/;
$lda = &ora_login('t:ora:cs', '', '');

$csr = &ora_open($lda, 'SELECT address FROM jah.search WHERE look=:1');

while(<STDIN>)
{
  &ora_bind($csr, $input{'search'});
  if (($address) = &ora_fetch($csr))
  {
    print "The link for this search is :-  ";
    print "<A HREF=\"$address\">";
    print "$address</A>";
  }
  else
  {
    print "No data on that, sorry!<BR>";
  }
}
&ora_close($scr);
&ora_logoff($lda);
print &HtmlBottom;

exit 0;

Thank you to anyone who can help.

James Hunter 

jah@cs.stir.ac.uk



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

Date: Mon, 14 Apr 1997 19:22:42 GMT
From: xpress@pobox.com (Brian Dellert)
Subject: PERL BUG: ([]) x 3 does not work correctly
Message-Id: <33528293.11576368@news.real-time.com>

I think I've found a possible bug or at least a confusing "feature".
Below is sample code to create an array of 3 array references. I can
create this okay, but you'll notice that when I push items onto one of
the array references, it turns out all 3 array references refer to the
exact same array!

---begin---
#!/usr/bin/perl -w

# Create an array of 3 array references, ie ([], [], [])
my @arrays = ([]) x 3;

# Print out the addresses of each of the @arrays
# Notice: They're all the same!
print join(',', @arrays), "\n";

# Print out the contents of each of the @arrays
# Right now, everything is empty
print map ({"[" . join(',', @$_). "]"} @arrays), "\n";

# Push "2" onto the first arrays in @arrays
push(@{$arrays[0]}, 2);

# Print out the contents again of all the @arrays
# Notice -- "2" is now in all three arrays,
# even though we only pushed it onto the first array!
print map ({"[" . join(',', @$_). "]"} @arrays), "\n";

---end---

Here's my version info:

[~/rabble/cgi-bin/community] perl -V
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=solaris, osver=2.5.1, archname=sun4-solaris
    uname='sunos mage 5.5.1 generic sun4m sparc sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib'
    libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib'

@INC: /usr/local/lib/perl5/sun4-solaris/5.003 /usr/local/lib/perl5
/usr/local/lib/perl5/si
te_perl/sun4-solaris /usr/local/lib/perl5/site_perl .

thanks for your comments & help,
brian



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

Date: 14 Apr 1997 13:47:41 -0700
From: Russ Allbery <rra@stanford.edu>
To: xpress@pobox.com (Brian Dellert)
Subject: Re: PERL BUG: ([]) x 3 does not work correctly
Message-Id: <qumk9m5gwlu.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Brian Dellert <xpress@pobox.com> writes:

> I think I've found a possible bug or at least a confusing "feature".
> Below is sample code to create an array of 3 array references. I can
> create this okay, but you'll notice that when I push items onto one of
> the array references, it turns out all 3 array references refer to the
> exact same array!

> # Create an array of 3 array references, ie ([], [], [])
> my @arrays = ([]) x 3;

Umm...this is exactly what I would expect to happen.  With the x operator,
you're asking Perl to make three exact copies of ([]).  An exact copy of
an array reference isn't a new array reference; it's a reference to the
same array.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Mon, 14 Apr 1997 12:59:26 -0500
From: Dan Clark <dclark@mail.basis.com>
Subject: Perl on Sco System V
Message-Id: <3352707D.13C2@mail.basis.com>

Has anyone got Perl 5 running on SCO SV5.  I'm having a heck of a time
getting a good make going.  Any suggestions, experience, etc. would be
greatly appreciated.

Thanks,

Dan Clark


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

Date: 14 Apr 97 18:43:59 UTC
From: honrio@idirect.com (Honrio Cham)
Subject: Perl training in Toronto Canada?
Message-Id: <3352A4D0.106A@idirect.com>

Can anyone recommend an good place to get some perl courses in Toronto?


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

Date: 14 Apr 1997 19:28:12 GMT
From: fstuart@vetmed.auburn.edu (Frank Stuart)
Subject: print errors aren't?
Message-Id: <5iu0gc$7a8@ultranews.duc.auburn.edu>

Could someone explain why this doesn't die:

   #!/usr/local/bin/perl
   
   print STDIN "foo\n" || die "print to STDIN failed: $!\n";

$! does get set to "Bad file number", but the print statement returns a
newline (true) rather than false, so the || is short-circuited.

I tested this with perl 5.000 and perl 5.003 running on Solaris 2.5.1.

                          | (Douglas) Hofstadter's Law:
Frank Stuart              | It always takes longer than you expect, even 
fstuart@vetmed.auburn.edu | when you take into account Hofstadter's Law.


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

Date: 14 Apr 1997 12:51:00 -0700
From: Russ Allbery <rra@stanford.edu>
To: Dale Manemann <manemann@dubuque.net>
Subject: Re: Problem with code fragment
Message-Id: <qumsp0tgz8b.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

Dale Manemann <manemann@dubuque.net> writes:

> I'm having a hell of a time trying to figure out a script that generates
> a hit report from a server log. This thing worked correctly for a few
> months and now it chokes.

> #Begin example data from $datafile
> 205.139.56.102 - Sally [07/Apr/1997:00:00:32 -0400] "GET /usr.hts?id=311 
> HTTP/1.0" 200 -
> 205.229.224.24 - - [07/Apr/1997:00:02:16 -0400] "GET / HTTP/1.0" 200 4545
> 207.48.110.35 - - [07/Apr/1997:00:04:42 -0400] "POST /search.cgi HTTP/1.0" 
> 200 641
> #End example data from $datafile

(I assume each of these are actually one line.)

>     if (m/(\d+\.\d+\.\d+\.\d+) \- (\-|\w+) \[(\d+\/\w+\/\d+:\d+:\d+:\d+) 
> \-0500\] "(GET|POST|HEAD) (.*) HTTP.*" (\d\d\d) (\-|\d+)/)

You're going to hit yourself when you see this one.  Look at the time zone
your regex is looking for (-0500 or five hours behind GMT) and the time
zone in the logs (-0400 or four hours behind GMT).  You got bit by
Daylight Saving's Time.  :)

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Mon, 14 Apr 1997 14:06:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Problem with code fragment
Message-Id: <f7vti5.rr.ln@localhost>

Dale Manemann (manemann@dubuque.net) wrote:
: Hello...
: 	I'm having a hell of a time trying to figure out a script that 
: generates a hit report from a server log. This thing worked correctly for a 
: few months and now it chokes. (It is possible that the file was overwritten 
: with a previous version). The data hasn't changed. I can only guess that the 
: problem is in the second if statement. But it looks OK to me:

: #Begin example data from $datafile
: 205.139.56.102 - Sally [07/Apr/1997:00:00:32 -0400] "GET /usr.hts?id=311 
                                                ^^^^
                                                ^^^^
: HTTP/1.0" 200 -
: 205.229.224.24 - - [07/Apr/1997:00:02:16 -0400] "GET / HTTP/1.0" 200 4545
                                            ^^^^
                                            ^^^^
: 207.48.110.35 - - [07/Apr/1997:00:04:42 -0400] "POST /search.cgi HTTP/1.0" 
                                           ^^^^
                                           ^^^^
: 200 641
: #End example data from $datafile

: #Begin code fragment
: $logrec=$other=0;
: if (open (FILE, "<" . $datafile))
: {
:   while (<FILE>)
:   {
:     if (m/(\d+\.\d+\.\d+\.\d+) \- (\-|\w+) \[(\d+\/\w+\/\d+:\d+:\d+:\d+) 
: \-0500\] "(GET|POST|HEAD) (.*) HTTP.*" (\d\d\d) (\-|\d+)/)
    ^^^^
    ^^^^
    ^^^^

Oops!

You don't need to be escaping all of those hyphens either (they are
'meta' in char classes, but you're not using them in char classes...


:     {
:       $host=$1;$user=$2;$date=$3;$method=$4;$guts=$5;$ret=$6;$bytes=$7;
:       #manipuate_parsed_info ...
:       $logrec++;
:     }
:     else
:     {
:       $other++;
:     }
: }
: #End code fragment

: At the end, $other = #number_of_lines_in_datafile and $logrec=0

: Any suggestions???


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 14 Apr 1997 12:14:02 -0600
From: Nathan Torkington <gnat@elara.frii.com>
Subject: Re: Radius, a perl for your thoughts
Message-Id: <5q7mi5xyj9.fsf@elara.frii.com>

Andrew Brigham <abrigham@mail.foxnet.net> writes:

> Got a problem parsing radius logs... script below
> does anybody have nice simple code...???

Yours is pretty good.  I just hacked the radius daemon to write an
'activity' log that has username, date/time, duration,
term.server/port, and IP.  That makes the job a lot easier :-)

I *hate* radius detail logs.  They provide too much information for
almost any task you want to use them for.  The detail logs are also
about 140 times larger than the activity logs that we use for billing
and usage tracking.

Nat


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

Date: 14 Apr 1997 11:24:58 -0700
From: Brett McCormick <brett@speedy.speakeasy.org>
Subject: Re: SLEEP (.5) ???
Message-Id: <7vzpv1o41w.fsf@speedy.speakeasy.org>


You could use select.  (man perlfunc)

Larry Honig <lonewolf@driveway1.com> writes:

> 
> Yup, this is probably real easy.. Howtheheck can I make a perl script
> sleep for , let's say, half a second, or in the WINTEL world, one tick
> (1/18.2 seconds) ??
> 
> Can't seem to find this anywhere..
> 
> 
> Thanks
> 
> /Larry Honig
> 
> larhonig@hdex.com


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

Date: Mon, 14 Apr 1997 19:15:00 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: SLEEP (.5) ???
Message-Id: <E8n6t1.4Ms@bcstec.ca.boeing.com>

In article <slrn5l24nr.h4f.Alain.Deckers@nessie.mcc.ac.uk>,
A. Deckers <Alain.Deckers@man.ac.uk> wrote:
 >In <33510D39.194@driveway1.com>,
 >
 >I guess that means you didn't consult the FAQ. Search for the four
 >argument version of undef.
 >
 >  undef 0, 0, 0, $sleep_time


You meant "select" rather than "undef" but that's an interesting
way of losing sleep :)


Regards,

--
Charles DeRykus
ced@carios2.ca.boeing.com



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

Date: Mon, 14 Apr 1997 16:10:15 -0400
From: rchannav@transquest.com
Subject: Swatch - Need the FTP site
Message-Id: <33528F27.719E@transquest.com>

Hi All,

Can someone point out the FTP site that which has swatch utility. 
Swatch is the realtime monitoring of syslog file, that sends out
E-mails, pages based on what is being monitored.

Thanks

--
Opinions are my own.


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

Date: Sun, 13 Apr 1997 20:10:03 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
Subject: Re: Transliterate from a pattern?
Message-Id: <3351A00A.1339@egames.com>

Andrew Johnson wrote:
> Devin Ben-Hur wrote:
> !    $str =~ s/^\w+//; $str =~ s/\w+$//;
> 
> of course you meant \s* and not \w+ right?
> $str=~s/^\s*//;
> $str=~s/\s*$//;

Well, yes I did mean \s not \w, but the + is preferable 
to the *.  No point in doing the replace if there's
nothing to replace (ie. it's a tad bit more efficient
with \s+ than \s*).

--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"It's people like you wot cause unrest!"




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

Date: Mon, 14 Apr 97 17:49:59 GMT
From: tomw@tsys.demon.co.uk (Tom Wheeley)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <861040199snz@tsys.demon.co.uk>

In article <5ishq7$slr$1@earth.execpc.com>
           madings@earth.execpc.com "Steve Mading" writes:

> 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.
> 
> Oh, and gzip also includes the pkzip algorithm too, so there's
> no win either way there.

Note that tar+gzip using pkzip algorithm will give better compression on
archives than pkzip too, as pkzip compresses each file singly, rather than
all the files at once.

-- 
:sb)



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

Date: 15 Apr 1997 08:20:06 +1200
From: physrmh@ANTISPAMphys.canterbury.ac.nz (Ryurick M. Hristev)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <qv6208dpdag.fsf@ANTISPAMphys.canterbury.ac.nz>

tomw@tsys.demon.co.uk (Tom Wheeley) writes:

> Note that tar+gzip using pkzip algorithm will give better compression on
> archives than pkzip too, as pkzip compresses each file singly, rather than
> all the files at once.

You forgot to mention the *advantage* of compressing each file
separately. This is why I prefer afio.

-- 
Delete ANTISPAM to reply. Apologies for inconvenience. (Spam,Grrrrr :)
______________________________________________________________________
Ryurick M. Hristev                    ()..()/^\/^\               -<:-)
physrmh@ANTISPAMphys.canterbury.ac.nz   \/ \#/\#/\)    What opinions ?
______________________________________________________________________


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

Date: 14 Apr 1997 18:31:06 GMT
From: koontz@cam.nist.gov (John E Koontz)
Subject: Re: Use of Tcl without Tk
Message-Id: <5itt5a$b611@news.nist.gov>

In article <335252D8.794B@ks.uiuc.edu>, Andrew Dalke <dalke@ks.uiuc.edu> writes:
|> Or if you use something else for the GUI -- our code uses XForms
|> for the GUI and Tcl for the embedded scripting language.  It
|> is a molecular visualization program and doesn't fit under the
|> listed categories.

Bingo.  We're using it with cgi.tcl in a project called
WebSubmit, in which the GUI is provided by HTML forms.

----
John E. Koontz (koontz@bldr.nist.gov)

Disclaimer:  Views and recommendations, express or implied, are my own, and
do not reflect the opinion or policy of my employers.


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

Date: Mon, 14 Apr 1997 14:10:09 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Why is $Line=~ s///; erasing =
Message-Id: <hevti5.rr.ln@localhost>

Kevin Swope (obsidian@shore.net) wrote:
: hello,

: why does:

: $Blank_var="";

: $Tag=~ s/$Blank_var//;


I don't know. How about showing us a code snippet that does that?


: occasionally erase the = from variable $Tag when it contains a =
  ^^^^^^^^^^^^
  ^^^^^^^^^^^^

Highly suspicious...


: the line:

: $Tag=~ s///;

: does the same thing.


: any ideas.
  ^^^^^^^^^

One idea would be to give us code that does what you don't understand.

It will not delete anything from $Tag, something else is wrong, but we
can't tell 'cause we can't see the code...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

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

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