[12612] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 21 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 6 18:47:15 1999

Date: Tue, 6 Jul 1999 15:36:31 -0700 (PDT)
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, 6 Jul 1999     Volume: 9 Number: 21

Today's topics:
        @INC blues (Eric Smith)
    Re: @INC blues (Anno Siegel)
    Re: @INC blues <toby@venice.cas.utk.edu>
    Re: @INC blues <gellyfish@gellyfish.com>
    Re: @INC blues (John Borwick)
    Re: @INC blues <cassell@mail.cor.epa.gov>
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
    Re: [Q]: access hashes from a sub? <Jochen.Stenzel.gp@icn.siemens.de>
    Re: A foreach question gary.okeefe@hydro.co.uk
        Accessing Mac printer-modem port <john.neale@debitel.net>
    Re: Accessing MS SQL Server from UNIX Perl... somebodysysop@my-deja.com
        Accessing POP mail? <breville@mpce.mq.edu.au>
    Re: Accessing POP mail? <swiftkid@bigfoot.com>
        accessing web pages using PERL <hannak@rochester.rr.com>
    Re: accessing web pages using PERL <jdsv@hotmailSpAmSuX.com>
    Re: accessing web pages using PERL <john@add.com>
        Active Perl and Win200 <tdnguyen@metricom.com>
        Active Perl regex problems <paullyb8@fnol.net>
    Re: Active Perl regex problems (John Borwick)
    Re: Afraid to ask about Y2K! <Russell_Schulz@locutus.ofB.ORG>
    Re: Afraid to ask about Y2K! (Chris Nandor)
        Allocation too large <techwolf_@_flash.net>
    Re: Allocation too large <swiftkid@bigfoot.com>
        an array problem? <adams1015@worldnet.att.net>
    Re: an array problem? <mjcarman@zeus.ia.net>
    Re: an array problem? <adams1015@worldnet.att.net>
        Announcment: Web Professional '99 CD-ROM Available <rkidd@hsonline.net>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 5 Jul 1999 23:11:11 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: @INC blues
Message-Id: <slrn7o2et1.5qb.eric@plum.fruitcom.com>


Hi

I recently upgraded my perl installation as below.

I am continually getting the following complaints when running scripts:

Can't locate News/NNTPClient.pm in @INC (@INC contains:
/usr/lib/perl5/5.0050 <snip>

Now many of my modules are installed in /usr/lib/perl5/site_perl/
I would like to:
1. avoid hacking with perl -I<module location> and moving of the modules
around
2. avoid upsetting the apple-cart everytime I reinstall my favourite parser.
3. add (say) /usr/lib/perl5/site_perl _permanently_ to my @INC

Please tell me what I am doing wrong to bring all this grief upon myself
and how I can short-term fix and long-term avoid it.

Thanx :)


This is perl, version 5.005_03 built for i386-linux

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.1-ac1, archname=i386-linux
    uname='linux porky.devel.redhat.com 2.2.1-ac1 #1 <snip>
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990<snip>
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Apr  6 1999 23:34:07
  @INC:
    /usr/lib/perl5/5.00503/i386-linux
    /usr/lib/perl5/5.00503
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    .

-- 
Eric Smith
<eric@fruitcom.com> 
www.fruitcom.com
Tel. 021 423 6111



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

Date: 6 Jul 1999 04:23:27 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: @INC blues
Message-Id: <7ls0bv$24e$1@lublin.zrz.tu-berlin.de>

Eric Smith <eric@fruitcom.com> wrote in comp.lang.perl.misc:
>
>Hi
>
>I recently upgraded my perl installation as below.
>
>I am continually getting the following complaints when running scripts:
>
>Can't locate News/NNTPClient.pm in @INC (@INC contains:
>/usr/lib/perl5/5.0050 <snip>
>
>Now many of my modules are installed in /usr/lib/perl5/site_perl/
>I would like to:
>1. avoid hacking with perl -I<module location> and moving of the modules
>around

Would you consider using the PERL5LIB environment variable?
Or to use lib?

>2. avoid upsetting the apple-cart everytime I reinstall my favourite parser.
>3. add (say) /usr/lib/perl5/site_perl _permanently_ to my @INC

There is probably a way to build perl so that it codes more than the
standard places into its @INC, though I couldn't find it in a hurry.
In any case, you would have to think of *that* each time you rebuild
perl.

Anno


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

Date: Tue, 06 Jul 1999 11:32:38 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: @INC blues
Message-Id: <37822196.68A1BEAE@venice.cas.utk.edu>

Where is NEWS::NNTPClient? If is is in a non-standard place (which would be
strange) then you can put this bit of code in and force the modules into @INC


>use lib '<path to module>';

This assumes that 'lib' is in @INC.

T.


>



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

Date: 6 Jul 1999 16:58:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: @INC blues
Message-Id: <3782278a@newsread3.dircon.co.uk>

toby <toby@venice.cas.utk.edu> wrote:
> Where is NEWS::NNTPClient? If is is in a non-standard place (which would be
> strange) then you can put this bit of code in and force the modules into @INC
> 
> 
>>use lib '<path to module>';
> 
> This assumes that 'lib' is in @INC.
> 

If it isnt you're in deep deep do do anyhow ...

/J\
-- 
"While we've been on the air we've had reports that Prince Charles has
eaten beef on the bone" - Justin Webb, BBC One O'Clock News


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

Date: Tue, 6 Jul 1999 16:24:39 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: @INC blues
Message-Id: <37842d98.15542579@newshost.unx.sas.com>

On Tue, 06 Jul 1999 11:32:38 -0400, toby <toby@venice.cas.utk.edu>
wrote:

>Where is NEWS::NNTPClient? If is is in a non-standard place (which would be
>strange) then you can put this bit of code in and force the modules into @INC
>>use lib '<path to module>';
>This assumes that 'lib' is in @INC.

When would C<use lib 'path'> not add to @INC?

-- 
John Borwick


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

Date: Tue, 06 Jul 1999 13:30:36 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: @INC blues
Message-Id: <3782676C.4B1E4451@mail.cor.epa.gov>

John Borwick wrote: 
> On Tue, 06 Jul 1999 11:32:38 -0400, toby <toby@venice.cas.utk.edu>
> wrote:
>
> >Where is NEWS::NNTPClient? If is is in a non-standard place (which would be
> >strange) then you can put this bit of code in and force the modules into @INC
> >>use lib '<path to module>';
> >This assumes that 'lib' is in @INC.
> 
> When would C<use lib 'path'> not add to @INC?

If someone has been tricked into using a copy of Perl so badly installed
that lib.pm didn't get installed either.  I believe that was toby's point,
although I could be mistaken since he's a Vol.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 05 Jul 1999 10:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage931170242.17065@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://cpan.perl.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

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

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://cpan.perl.org/
    http://www.perl.com/CPAN/
    http://cpan.perl.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:

    setdir usenet-by-group/news.announce.newusers
    send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List

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

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Mon, 05 Jul 1999 16:56:17 +0200
From: "Hr. Jochen Stenzel" <Jochen.Stenzel.gp@icn.siemens.de>
Subject: Re: [Q]: access hashes from a sub?
Message-Id: <3780C791.D525459A@icn.siemens.de>

Hello, Jih-Shin Suen,

> 2). What's is storable module? like DB?

This is a Perl library (called "module") which provides funtions for
data serialization. It's very fast and easy to use:

- snip --

use strict;

# load the module
use Storable;

# init data
my @data=(1, 2, {bla=>"blu"});

# save data
Storable::store(\@data, "data.saved");

 ...

# restore data
my $dataRef=Storable::retrieve("data.saved");

- snip --

$dataRef finally points to a data structure which is a copy of the
original @data. The "..." represents any actions, and of course you can
store by one script and retrieve by another.

Storable offers a number of additional features: it supports data
transfers via network connections and data structure copies.

You can find the module on CPAN, e.g. you can search for the latest
release on http://theory.uwinnipeg.ca/search/cpan-search.html.

Greetings

                    Jochen






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

Date: 5 Jul 99 10:11:58 GMT
From: gary.okeefe@hydro.co.uk
Subject: Re: A foreach question
Message-Id: <378084ee.0@ivsn03.hydro.co.uk>

In article <7kr8iv$ebn$1@nnrp1.deja.com>, photoguy@my-deja.com writes:

>I'm reading a text file into an array, then using foreach to loop
>through the array looking for a specific pattern.  Once I find the
>pattern I want to look at the next element in the array to check for 2
>other patterns.  Sample below:
>
>open (FILENAME, "somefile");
>@file_lines = FILENAME;
>
>foreach $file_line (@file_lines)
>{
>  # check for first pattern
>  # if matched, increment the element $file_line points to
>
>  # check for patterns in $file_line
>}

You might what to try an ordinary 'for' loop:

for ( $i = $[; $i <= $#file_line; $i++ ) {
	if ( $file_file[$i] =~ /pattern/ ) {
		if ( $file_line[++$i] =~ /another pattern/ ||
			$file_line[++$i] =~ /yet another pattern/ ) {
				# do stuff
		}
	}
}

The prefix increment operator will increment the index variable and, if the 
initial pattern is matched, then the loop will start checking again after the 2 
lines.

$[ is the index of the first element in a list.
$#file_line is the index of the last element in @file_line.

Gary

p.s. of course I could be completely wrong...
--
Gary O'Keefe | rl: gary@onegoodidea.com | work: gary@hydro.co.uk
You know the score - my current employer is not responsible for what I post.


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

Date: Tue, 06 Jul 1999 18:43:20 +0200
From: John Neale <john.neale@debitel.net>
Subject: Accessing Mac printer-modem port
Message-Id: <37823222.31F9@debitel.net>

I'm fairly new to Perl. I've got my first program running turning raw
data into pretty HTML pages... (yippee!)

However... how do I read and write data to and from the serial port? Can
someone point me in the right direction?

I'm using MacPerl on a PowerBook 1400c (OS8.6), and I want to
communicate with a piece of medical equipment plugged into the
Printer-Modem port.

Any guidance much appreciated.

John
--
mailto:jneale@webshowcase.net
http://www.webshowcase.net/johnneale/



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

Date: Mon, 05 Jul 1999 22:17:11 GMT
From: somebodysysop@my-deja.com
Subject: Re: Accessing MS SQL Server from UNIX Perl...
Message-Id: <7lrasv$td8$1@nnrp1.deja.com>

I don't know if someone already replied, but yes you can.
Look at the Multi-Tiered ODBC drivers at: http://www.openlinksw.com.
I have a remote sql program written in perl which I run on a Linux box
to maintain an MS Access SQL database on an NT box.

Good luck.

In article <375C7ADD.6E759368@redcloud.org>,
  Steve Gilbert <sgilbert@redcloud.org> wrote:
> Is this possible?  I know there's an ODBC module for WIN32 perl, but
is
> it possible for Perl, say on my Linux box, to access my SQL Server on
a
> remote NT box?
>
> - Steve
>
> Steve Gilbert
> MCSE
> Production Systems Manager
> The Charlotte Observer
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 7 Jul 1999 00:04:18 +1000
From: "Brendan Reville" <breville@mpce.mq.edu.au>
Subject: Accessing POP mail?
Message-Id: <7lt2fa$191$1@sunb.ocs.mq.edu.au>

hi

I want to write a Perl script on my web server which pulls incoming mail out
of a local POP account.  This incoming mail is stored in a mail spool file
on a mail server, so I can't access the file directly.  Is there any other
way to pull the mail out of this POP server?

Thanks for any advice!




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

Date: Tue, 6 Jul 1999 19:25:25 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Accessing POP mail?
Message-Id: <7lu6um$ed43@news.cyber.net.pk>

Brendan Reville <breville@mpce.mq.edu.au> wrote in message
news:7lt2fa$191$1@sunb.ocs.mq.edu.au...
> hi
>
> I want to write a Perl script on my web server which pulls incoming mail
out
> of a local POP account.  This incoming mail is stored in a mail spool file
> on a mail server, so I can't access the file directly.  Is there any other
> way to pull the mail out of this POP server?

Check out Mail::POP3Client @ cpan.org/

>
> Thanks for any advice!

You're always welcome.

--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift  ICQ: 4265451
FAX: (815) 846-2877




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

Date: Tue, 06 Jul 1999 14:40:20 -0400
From: Victor Hannak <hannak@rochester.rr.com>
Subject: accessing web pages using PERL
Message-Id: <37824D94.38256BB7@rochester.rr.com>

Is there any way to open and read a remote web page using Perl?  I would
like my script to download several web pages and then parse their
content.  Any suggestions for sample scripts with this type of
functionality?

Thanks.



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

Date: Tue, 6 Jul 1999 13:47:16 -0600
From: "Jeremy" <jdsv@hotmailSpAmSuX.com>
Subject: Re: accessing web pages using PERL
Message-Id: <93tg3.2787$Fh7.51429@news.uswest.net>

 http://www.linpro.no/lwp/

Victor Hannak <hannak@rochester.rr.com> wrote in message
news:37824D94.38256BB7@rochester.rr.com...
> Is there any way to open and read a remote web page using Perl?  I would
> like my script to download several web pages and then parse their
> content.  Any suggestions for sample scripts with this type of
> functionality?
>
> Thanks.
>




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

Date: Tue, 6 Jul 1999 13:43:49 -0700
From: "John" <john@add.com>
Subject: Re: accessing web pages using PERL
Message-Id: <931293947.594.17@news.remarQ.com>

also if u don't want to use LWP just use lynx:

$url=`lynx -source www.foo.bar`


Jorge

Victor Hannak wrote in message <37824D94.38256BB7@rochester.rr.com>...
>Is there any way to open and read a remote web page using Perl?  I would
>like my script to download several web pages and then parse their
>content.  Any suggestions for sample scripts with this type of
>functionality?
>
>Thanks.
>




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

Date: Tue, 6 Jul 1999 09:14:10 -0700
From: "TDN" <tdnguyen@metricom.com>
Subject: Active Perl and Win200
Message-Id: <931277654.474.35@news.remarQ.com>

Has anyone verify that active perl and it's module are compatible with
win2000 yet?  Or are we assuming that if it works on NT service pack 4 then
it should be able to work on win 2000

TDN




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

Date: Tue, 6 Jul 1999 13:05:50 -0400
From: "Paul Bruno" <paullyb8@fnol.net>
Subject: Active Perl regex problems
Message-Id: <931280877.847.41@news.remarQ.com>

Dear all,

When I tried to use Perl's regular expressions to root out a particular XML
tag in a file.  This file's contents had already been loaded into a variable
for processing.  However, when I tried to use a pattern which contained a
newline (\n) character in it, the script would not match any of the contents
in the file.  I have read much of the llama book, and didn't think I was
missing anything.  I check both in that book, and in the camel for further
relavent information, finding none.  Finally, I found a sample of some Perl
code on a web site, using a newline in their reg ex pattern to do exactly
what I wanted to do.  However, to my suprise, tacked on to the back of the
second forward slash (/) in the pattern was a letter s, being used much like
a i or g would be to ignore case when matching and replace globally,
respectively!  I never knew or saw anything that would make me believe that
I needed to use an "s" parameter for my pattern so that it could match
across newlines...

If anyone could please help by either emailing me, or writing a reply
message to this post about why this is so, if this occurs on all systems,
and why the two most reputable books on Perl don't mention this (to my
knowledge), please, DO!  Because of the amount I am going to be using Perl
for various projects, not the least of which being web applications written
for CGI, the answers to these questions are really important.

To all those who reply, thanks a whole lot!  I really apprechiate the time
you've taken to read and reply to this message!  And, one day, perhaps maybe
I'll be a part of those giving Perl newbies answers, namely, you guys!

Have a wonderful day!

Sincerely,

Paul




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

Date: Tue, 6 Jul 1999 17:51:30 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Active Perl regex problems
Message-Id: <378741c7.20708867@newshost.unx.sas.com>

On Tue, 6 Jul 1999 13:05:50 -0400, "Paul Bruno" <paullyb8@fnol.net>
wrote:

>what I wanted to do.  However, to my suprise, tacked on to the back of the
>second forward slash (/) in the pattern was a letter s, being used much like

>and why the two most reputable books on Perl don't mention this (to my
>knowledge), please, DO!  Because of the amount I am going to be using Perl

Paul,

try pages 69 and 70 of the camel book (2nd ed)

man perlre
 might also be helpful.

-- 
John Borwick


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

Date: Sat, 3 Jul 1999 00:56:45 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Afraid to ask about Y2K!
Message-Id: <19990703.005645.3w7.rnr.w164w@locutus.ofB.ORG>

pudge@pobox.com (Chris Nandor) writes:

> 3.  Read the documentation when you are unclear of something

This would prevent the people from posting asking why it returns 100
instead of 0, but won't prevent people from writing the incorrect
code in the first place.  When someone writes `printf("%02d/%02d/%d",
day,1+month,year);' it probably seems clear at the time.

> You are blaming the language, which is nonsense.  That's like blaming
> English because people can incite riots using it.

If the English words for `hello' and `I want to throw you on the floor
and jump on your painful parts' were `mah' and `meh', respectively, then
that would be a more valid comparison.

You could still correctly claim that people should be more careful when
using the `m' words (as you can correctly claim that people need to read
the localtime documentation); but it wouldn't change the fact that the
`m' words were unhelpful for peaceful communication (much like the
localtime implementation is unhelpful for avoiding y2k problems).
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sun, 04 Jul 1999 15:08:40 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <pudge-0407991108410001@192.168.0.17>

In article <19990703.005645.3w7.rnr.w164w@locutus.ofB.ORG>, Russell Schulz
<Russell_Schulz@locutus.ofB.ORG> wrote:

# pudge@pobox.com (Chris Nandor) writes:
# 
# > 3.  Read the documentation when you are unclear of something
# 
# This would prevent the people from posting asking why it returns 100
# instead of 0, but won't prevent people from writing the incorrect
# code in the first place.  When someone writes `printf("%02d/%02d/%d",
# day,1+month,year);' it probably seems clear at the time.

I cannot fathom using a function in Real Code without checking what it
does first.  If I have never used localtime before, I will print out its
return values:

  print join ":", localtime;

I would then see that it returns 99 for the year, and think, "hm, why does
it do that?," at which point the only logical thing to do is to read the
docs.

So here we are: if you 1. use a function without testing it to see what it
does, or 2. see what it does but make assumptions about the "strange"
behavior instead of reading the docs, then you deserve to get burned. 
Sorry.


# > You are blaming the language, which is nonsense.  That's like blaming
# > English because people can incite riots using it.
# 
# If the English words for `hello' and `I want to throw you on the floor
# and jump on your painful parts' were `mah' and `meh', respectively, then
# that would be a more valid comparison.

I wish I understood what point you are trying to make.  It doesn't seem to
have anything to do with what I am saying.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Tue, 06 Jul 1999 15:02:18 GMT
From: Jeremy Tinley <techwolf_@_flash.net>
Subject: Allocation too large
Message-Id: <37821AB3.A601B9CB@_flash.net>

Howdy!

Working with a large hash db (>10mb) and it appears that a
key/value/both is too large for perl to process.  In fact, I can't do
much with the hash at all.  I suppose my question is, does anyone have
any suggestions for extracting the data from this hash db file?  Perhaps
a way to delete the offending entry or to step over it?

Below is a sample of what I tried to do to get to the data.  Actaully
processing the hash, using a 'while(($key,$value) = each %db)' loop
gives me about 26000 lines of the database and dies with the same error.



# -- begin code --
#!/usr/local/bin/perl
use DB_File;

$db_file = '/path/to/dbfile';
$db_obj = tie(%db, DB_File, $db_file, O_RDWR, 0666) or die $!;

$total_unique = scalar keys %db;
print "$total_unique\n";

undef $db_obj;
untie(%db);
# -- end code --


Running the above though perl results in "Allocation too large" error
message (which is just basically a memory error from what I
understand).  Throwing it at the debugger....


# -- begin snippet --
main::(count.cgi:8):    $total_unique = scalar keys %db;
  DB<1> 

Allocation too large at /usr/local/lib/perl5/perl5db.pl line 1134.
DB::fake::(/usr/local/lib/perl5/perl5db.pl:2083):
2083:     "Debugged program terminated.  Use `q' to quit or `R' to
restart.";
# -- end snippet --



System Specific Info:
Perl 5.004_04, DB_File 1.85

> perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos caligula 5.6 generic_105181-05 sun4u sparc
sunw,ultra-enterprise '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef


The box had 140mb of real RAM free when I tried to process the hash (not
to mention 5GB of swap :)  I am limited to using 5.004_04 on this
machine, since it is a production environment.  From what I gather
though, the only difference I would see is a different error message
(Out of memory). 


-Jeremy
(note the underscores in the reply address)


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

Date: Tue, 6 Jul 1999 20:14:22 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Allocation too large
Message-Id: <7lu9q9$dfl11@news.cyber.net.pk>

Jeremy Tinley <techwolf_@_flash.net> wrote in message
news:37821AB3.A601B9CB@_flash.net...
> Howdy!
>
> Working with a large hash db (>10mb) and it appears that a
> key/value/both is too large for perl to process.  In fact, I can't do
> much with the hash at all.  I suppose my question is, does anyone have
> any suggestions for extracting the data from this hash db file?  Perhaps
> a way to delete the offending entry or to step over it?


#!/usr/local/bin/perl
use DB_File;

$db_file = '/blah';

print "writing...\n";

tie(%db, DB_File, $db_file, O_CREAT | O_RDWR , 0666) or die $!;
    for ( 0 .. 10000 )
    { $db { $_ } = 'f' x 10000; }
untie(%db);

print "reading...\n";

tie(%db, DB_File, $db_file, O_RDWR, 0666) or die $!;
  $total_unique = scalar keys %db;
  print "$total_unique\n";
untie %db;


Creates a 164mb file, and then read it, it works fine on my system!


> The box had 140mb of real RAM free when I tried to process the hash (not
> to mention 5GB of swap :)  I am limited to using 5.004_04 on this
> machine, since it is a production environment.  From what I gather
> though, the only difference I would see is a different error message
> (Out of memory).

This is: PII 400mhz, 64mb ram.

Go for Perl 5.005_57...

I can't access internet on Linux, so that is done on Perl 5.005_3, Win98.

--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift  ICQ: 4265451
FAX: (815) 846-2877




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

Date: Sat, 3 Jul 1999 16:06:02 -0700
From: "Jeremiah and Veronica Adams" <adams1015@worldnet.att.net>
Subject: an array problem?
Message-Id: <7lltv5$rtf$1@bgtnsc01.worldnet.att.net>

What am I doing wrong here??
# I went ahead and set the scalars to a value for debugging purposes.
# these are normally picked out of a form
$log_name="adams24";
$pass="toad";
&Log_In;

sub Log_In {
 open(PASSLOG, "./thankyou") || die print "can't open file\n";
 @lines=PASSLOG;
 close (PASSLOG);
 foreach $line (@lines){

     chop $line;
     ($realname, $realpassword) = split(/\|/,$line);
  }
I think the problem is with ($realname, $realpassword)=....
because I get an uninitialized variable error. what am I doing wrong? It
checks the array lines and for each element splits it at the |  and calls
the left $realname and right $realpassword. Thanks




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

Date: Sat, 03 Jul 1999 17:15:44 -0500
From: Michael Carman <mjcarman@zeus.ia.net>
Subject: Re: an array problem?
Message-Id: <377E8B90.4B7E7659@zeus.ia.net>

Jeremiah and Veronica Adams wrote:

> What am I doing wrong here??

Standard stuff: Did you use -w and 'use strict'?

>
> # I went ahead and set the scalars to a value for debugging purposes.
> # these are normally picked out of a form
> $log_name="adams24";
> $pass="toad";
> &Log_In;
>
> sub Log_In {
>  open(PASSLOG, "./thankyou") || die print "can't open file\n";
>  @lines=PASSLOG;

That's not how you read from a filehandle. This should be
@lines = <PASSLOG>;

>
>  close (PASSLOG);
>  foreach $line (@lines){
>
>      chop $line;

chomp() is generally preferred for this sort of thing because it will remove
the last character only if it matches the input line seperator ("\n" by
default). chop() will munch off the last character regardless of what it is.

>
>      ($realname, $realpassword) = split(/\|/,$line);
>   }
> I think the problem is with ($realname, $realpassword)=....
> because I get an uninitialized variable error. what am I doing wrong? It
> checks the array lines and for each element splits it at the |  and calls
> the left $realname and right $realpassword. Thanks



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

Date: Sat, 3 Jul 1999 22:44:02 -0700
From: "Jeremiah and Veronica Adams" <adams1015@worldnet.att.net>
Subject: Re: an array problem?
Message-Id: <7lml9a$6nm$1@bgtnsc01.worldnet.att.net>

Yes, I used -w. That's how I found out about the uninitialized scalar.




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

Date: Sun, 4 Jul 1999 21:22:41 -0500
From: "Roger Kidd" <rkidd@hsonline.net>
Subject: Announcment: Web Professional '99 CD-ROM Available
Message-Id: <7lp5f5$3qr@news.hsonline.net>

ANNOUNCEMENT: Web Professional '99 CD-ROM is now available for only $12.00.
This cd rom contains everything you need to build professional money making
websites including...

HTML Editors
Graphics and Image editing tools
Website Promotion Utilities
FTP Clients
HTML Tools
Logs / Web Statistics
Thousands of Web Graphics
Clickable Buttons
 Lines and Bars
Backgrounds
Blank Banners you can edit.
Webpage Headers
Welcome Logos
Clipart
Setting up your own Shopping Cart system for FREE.
Making Money with Sponsors
Sponsor & Referral program database -
Website Promotion Tips
HTML Tutorials
CGI SCRIPTS
Banner Advertising management scripts
Guestbooks
Form Mailers / Form Return
Counter CGI
Message Board / Forums
Real Java Applets
Text Scrollers
Website Development tools that WORK in your web browser.
Webmaster Software Downloads
Hundreds of thousands of web graphics
2,000+ CGI Script Download Resources
3,000+ JavaScript Download Resources
Web Promotion Resources & Sites
Thousands of Webpage Backgrounds
More Sponsors and Banner programs
Chat Room Boards
Internet Services
Free Internet Access & Web Hosting
Web Hosting Resources

This CD-ROM is available for $12.00 postage paid, No shipping charges. To
order, please send a check or money order to:

ROGER KIDD
PO BOX 298
AUSTIN, IN 47102

(Please make a note that your ordering "WEB PROFESSIONAL '99"

Thank You Kindly,
Indysoft Online




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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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 V9 Issue 21
************************************


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