[15730] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3143 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 24 00:06:05 2000

Date: Tue, 23 May 2000 21:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959141108-v9-i3143@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 23 May 2000     Volume: 9 Number: 3143

Today's topics:
        @lets = split(/\_/, $value); ? <moltimer@yahoo.com>
    Re: @lets = split(/\_/, $value); ? <jeff@vpservices.com>
    Re: [Help] Processing a REQUEST, then redirect via a PO (Abigail)
        [Q] access remote oracle in perl <baksoo@serome.co.kr>
    Re: array within array revisited <godzilla@stomp.stomp.tokyo>
    Re: array within array revisited <r28629@email.sps.mot.com>
    Re: array within array revisited <uri@sysarch.com>
    Re: array within array revisited <r28629@email.sps.mot.com>
    Re: array within array revisited <uri@sysarch.com>
    Re: Exec() returned - Script exection Error (Abigail)
    Re: file locking <dan@tuatha.sidhe.org>
    Re: Finding IP addresses+ (Sweth Chandramouli)
        How to read a float type data? <umlinj@cc.umanitoba.ca>
        odd behavior printing after randomizing an array from S <kiera@nnickee.com>
    Re: opinion on libwww arpith@my-deja.com
    Re: pl2exe missing from ActivePerl <r28629@email.sps.mot.com>
    Re: SDBM_File - %HASH not returning all records ? <bwalton@rochester.rr.com>
    Re: SDBM_File - %HASH not returning all records ? <jeff@vpservices.com>
    Re: Split a number up? <asound40NOasSPAM@hotmail.com.invalid>
    Re: Testing the getstore function in the LWP::Simple mo (Sordid One)
    Re: timeout a perl script? <brondsemadp@student.mps.k12.mi.us>
    Re: use english <uri@sysarch.com>
    Re: use english (James W. Sandoz)
    Re: valid email address (Neil Kandalgaonkar)
    Re: Win32::ODBC and -w <kmsproule@worldnet.att.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 24 May 2000 12:09:30 +0900
From: "Moltimer" <moltimer@yahoo.com>
Subject: @lets = split(/\_/, $value); ?
Message-Id: <8gfgql$fej$1@news2.kornet.net>

I split a value by "_"
The odinary value should have only two of "_" like "A_B_C".

If there are many "_"s in middle word like "A_B-1_B-2_B-3_C,
How can I get value like "A", "B-1_B-2_B-3" and "C"
instead of "A", "B-1" and "B-2" ?

@lets = split(/\_/, $value);
$lets[0] should be "A"
$lets[0] should be "B-1_B-2_B-3"
$lets[0] should be "C"

Thanks.





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

Date: Tue, 23 May 2000 20:37:41 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: @lets = split(/\_/, $value); ?
Message-Id: <392B4E85.CAF1D41F@vpservices.com>

Moltimer wrote:
> 
> I split a value by "_"
> The odinary value should have only two of "_" like "A_B_C".
> 
> If there are many "_"s in middle word like "A_B-1_B-2_B-3_C,
> How can I get value like "A", "B-1_B-2_B-3" and "C"
> instead of "A", "B-1" and "B-2" ?
> 
> @lets = split(/\_/, $value);
> $lets[0] should be "A"
> $lets[0] should be "B-1_B-2_B-3"
> $lets[0] should be "C"

Easiest is a regex instead of split I think:

my $value = 'A_B-1_B-2_B-3_C';
my @lets = $value =~ /^([^_]*)_(.*)_([^_]*)$/;

-- 
Jeff


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

Date: 24 May 2000 01:19:03 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: [Help] Processing a REQUEST, then redirect via a POST method
Message-Id: <8gfam7$fft$2@news.panix.com>

On Tue, 23 May 2000 23:49:18 GMT, David Potosky <oozi@yahoo.com> wrote:
++ Hi,
++ 
++ A few weeks ago I was working with PERL, and we tried to do some text
++ processing on a HTML request, then redirect the extracted/processed
++ text to another URL via a POST.
++ 
++ We were unsuccessful, and as far as I could determine it in fact
++ couldn't be done.  I couldn't send it through a GET method (too big) or
++ store it in a cookie (apparently Netscape standard is 2k - data is too
++ big again).
++ 
++ Could it have been done, and I was missing something?  If not, is there
++ another way to do it?

Do you have any Perl (not PERL, Perl (the language) or perl (the binary))
question? This group is about a programming language, not the HTML markup
language, the HTTP specification, the Cookies RFC, and not even the quirks
of a particular browser.

++ We solved the problem doing something else, but my curiousity has got
++ the best of me (I am a Java programmer - not a PERL expert) and I
++ wanted to know how I could do it.

Here's a hint: solve it Java. Then port the solution to Perl.


Abigail


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

Date: Wed, 24 May 2000 01:33:58 GMT
From: "±èµ¿¿í" <baksoo@serome.co.kr>
Subject: [Q] access remote oracle in perl
Message-Id: <akGW4.2017$%E1.29383@news2.bora.net>

We have a problem with accessing remote oracle DB from perl script in
another machine
Our system configuration is as follows:
site A : linux, apache web server, perl scripts running here
site B : solaris, oracle database server

We have to access oracle(site B) from perl script(site A).
I am told that DBI and DBD are required.
My question arises at this point.

Question 1. Does Oracle have to be installed in site A to install DBD?
        1-1. Is it possible that DBD binary is built in another machine and
moved to site A?

Question 2. After DBD is built successfully, sql*net is still required in
site A?

Any comments about this would be a great help for us.
Thanks in advance.
--
-----------------------------------------------------





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

Date: Tue, 23 May 2000 19:08:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: array within array revisited
Message-Id: <392B398B.19890CF1@stomp.stomp.tokyo>

j555@my-deja.com wrote:

> I know people have asked about putting arrays within
> arrays before, and I know there is SUPPOSED TO BE
> an actual answer in the FAQ answer list. But the thing is,
> the answer is pretty limited and doesn't answer my question.
 
> My question is, why does this not print out 3 and 3?
 
> @a = (1,2,3);
> @b = (4,5,[@a]);
> @c = @b[2]; # should be same as @a
> $d = @b[2]; # should be even more reliable
> print $#c + 1; # number of elements in @c should be 3
> print $#d + 1; # should also be three
> # This prints out 1 and 1.
 
> Thanks for any info.


One of the most powerful diagnostic tools available
to us as programmers, is a tool we rarely consider.
This tool, one I suggest constantly and use constantly,
is a simple print statement.

Look over these printed results highlighting your
original code, and finally showing results of my
modification of your code. You should be able
to figure out the problem by simple comparison.


Godzilla!



PRINTED RESULTS:
________________


      Begin Test Of Original Code.
      _______________________

Step One, Array a elements:

123

Step Two, Array b elements:

45ARRAY(0xd2cc8)

Step Three, Array c elements:

ARRAY(0xd2cc8)

Step Four, Print d variable:

ARRAY(0xd2cc8)

10



      Begin Test Of Modified Version:
      _______________________________

Step One, Array a elements:

123

Step Two, Array b elements:

45123

Step Three, Array c elements:

123

Step Four, Array d elements:

123

Array c holds 3 elements. 

Array d holds 3 elements.




TEST SCRIPT:
____________

#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";

print "\n
      Begin Test Of Original Code.
      _______________________\n\n";


@a = (1,2,3);

print "Step One, Array a elements:\n\n";
foreach $a_element (@a)
 { print $a_element; }

print "\n\n";

@b = (4,5,[@a]);

print "Step Two, Array b elements:\n\n";
foreach $b_element (@b)
 { print $b_element; }

print "\n\n";

@c = @b[2]; # should be same as @a

print "Step Three, Array c elements:\n\n";
foreach $c_element (@c)
 { print $c_element; }

print "\n\n";

$d = @b[2]; # should be even more reliable

print "Step Four, Print d variable:\n\n";

print $d;

print "\n\n";

print $#c + 1; # number of elements in @c should be 3
print $#d + 1; # should also be three

# This prints out 1 and 1.



## Modified Version

print "\n\n\n
      Begin Test Of Modified Version:
      _______________________________\n\n";

@a = (1, 2, 3);

print "Step One, Array a elements:\n\n";
foreach $a_element (@a)
 { print $a_element; }

print "\n\n";


@b = (4, 5, @a);

print "Step Two, Array b elements:\n\n";
foreach $b_element (@b)
 { print $b_element; }

print "\n\n";


@c = @a;

print "Step Three, Array c elements:\n\n";
foreach $c_element (@c)
 { print $c_element; }

print "\n\n";


@d = @c;

print "Step Four, Array d elements:\n\n";
foreach $d_element (@d)
 { print $d_element; }

print "\n\n";


$count1 = ($#c + 1);
$count2 = ($#d + 1);

print "Array c holds $count1 elements. \n\n";
print "Array d holds $count2 elements.";

exit;


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

Date: Wed, 24 May 2000 10:10:46 +0800
From: Tk Soh <r28629@email.sps.mot.com>
To: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: array within array revisited
Message-Id: <392B3A26.25F3CB94@email.sps.mot.com>

[posted to clpm and cc'ed author]

Makarand Kulkarni wrote:
> 
> > @a = (1,2,3);
> > @b = (4,5,[@a]);
> > @c = @b[2]; # should be same as @a
> 
> Now c is an array with a single element which is a ref to a.
> 
> > $d = @b[2]; # should be even more reliable
> > print $#c + 1; # number of elements in @c should be 3
> 
> $#c has a single element. Hence 1 as answer.
> 
> > print $#d + 1; # should also be three
> 
> @d does not exist. Hence $#d  will be zero.

actually, $#d should be -1


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

Date: Wed, 24 May 2000 03:16:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: array within array revisited
Message-Id: <x7n1lgbptw.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> ARRAY(0xd2cc8)

ooooh, that isn't output from perl4!!! looks like a perl5 ref! shame on you!!

  G> @a = (1, 2, 3);

  G> foreach $a_element (@a)
  G>  { print $a_element; }

  G> @b = (4, 5, @a);

and where is the array ref he wanted now? 


  G> @c = @a;

  G> print "Step Three, Array c elements:\n\n";
  G> foreach $c_element (@c)
  G>  { print $c_element; }

thiat is useful? printing @c when you just printed @a and assigned it to
@c? talk about idiotic coding. 

  G> @d = @c;

  G> print "Step Four, Array d elements:\n\n";
  G> foreach $d_element (@d)
  G>  { print $d_element; }

and again???

  G> $count1 = ($#c + 1);
  G> $count2 = ($#d + 1);

  G> print "Array c holds $count1 elements. \n\n";
  G> print "Array d holds $count2 elements.";

and then printing their sizes? what the hell does this have to do with
his interest in array refs? your code has none!

here are the working lines together just to clarify what you really did:

  G> @a = (1, 2, 3);
  G> @b = (4, 5, @a);
  G> @c = @a;
  G> @d = @c;

highly illuminating! actually is shows the clarity of your mind, as you
can see right through it.

so your first foray into references was a total failure. what else could
we expect. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 24 May 2000 11:07:14 +0800
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: array within array revisited
Message-Id: <392B4762.45B80A09@email.sps.mot.com>

"Godzilla!" wrote:
> 
> j555@my-deja.com wrote:
> 
> > I know people have asked about putting arrays within
> > arrays before, and I know there is SUPPOSED TO BE
> > an actual answer in the FAQ answer list. But the thing is,
> > the answer is pretty limited and doesn't answer my question.
> 
> > My question is, why does this not print out 3 and 3?
> 
> > @a = (1,2,3);
> > @b = (4,5,[@a]);
> > @c = @b[2]; # should be same as @a
> > $d = @b[2]; # should be even more reliable
> > print $#c + 1; # number of elements in @c should be 3
> > print $#d + 1; # should also be three
> > # This prints out 1 and 1.
> 
> > Thanks for any info.
> 
> One of the most powerful diagnostic tools available
> to us as programmers, is a tool we rarely consider.
> This tool, one I suggest constantly and use constantly,
> is a simple print statement.

Spraying a bunch of print statements in the program for debugging
purpose is hardly a good programming practice, and that already assumes
you remember to clean them up after they did their job. 

Perl already has a pretty good debugging tool, use it:

   perldoc perldebug


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

Date: Wed, 24 May 2000 03:44:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: array within array revisited
Message-Id: <x7k8gkboi7.fsf@home.sysarch.com>

>>>>> "TS" == Tk Soh <r28629@email.sps.mot.com> writes:

  TS> Spraying a bunch of print statements in the program for debugging
  TS> purpose is hardly a good programming practice, and that already
  TS> assumes you remember to clean them up after they did their job.

you forget the troll only runs her perl under webservers. so print is
all she has. and as she showed in the previous post, she doesn't even
know what to print let alone how to analyze. her comment to compare the
output of the two scripts was ludicrous as they did totally different
things.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 24 May 2000 01:13:37 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Exec() returned - Script exection Error
Message-Id: <8gfac1$fft$1@news.panix.com>

On Tue, 23 May 2000 20:59:24 -0300, Michael <passagewd@primus.ca> wrote:
++ How can I learn to fix the problem if I don't ask experts like yourself... I
++ am trying to learn but don't have a webmaster to ask.


Asking here about your webserver configurations problems is like
asking an expert car mechanic about the problems with your heart.

You will never be able to learn from others if you ask the wrong people.


Abigail


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

Date: Wed, 24 May 2000 01:17:02 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: file locking
Message-Id: <i4GW4.90667$hT2.382821@news1.rdc1.ct.home.com>

Bart Lateur <bart.lateur@skynet.be> wrote:
> Larry Rosler wrote:

>>$| = 1;
>>
>>'Short' (< 8K?) prints to append.
>>
>>No buffering.
>>
>>No locking.
>>
>>No problem.

> Gee, I'm really gonna try to break this "rule" with one counter-example.

> If I fail, life will be a lot easier...   :-)

No, it won't, unfortunately. Breaking the rule means the rule was wrong.
Failing to break it doesn't mean the rule is right, just that you didn't
break it.

				Dan


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

Date: Wed, 24 May 2000 01:07:14 GMT
From: sweth+shell@gwu.edu (Sweth Chandramouli)
Subject: Re: Finding IP addresses+
Message-Id: <6XFW4.98037$E85.1953833@news1.rdc1.md.home.com>

In article <39260C12.48BF6F8B@aPpcAi.nMet>,
Craig Peterein  <NniOtroS@aPpcAi.nMet> wrote:
>Neil W Rickert wrote:
>> Craig Peterein <NniOtroS@aPpcAi.nMet> writes:
>> >I tested it and it seems to work.  Or did I miss a case?
>> 
>> Does it match 249.249.249.249 ?
>
>Good catch.
>
>I knew I forgot something.  Try it now.
>
>byte='(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|0?[0-9]?[1-9]|0?[1-9][0-9])'
>egrep "(^|[^0-9])($byte\.){3}$byte([^0-9]|$)"
	Here's the version I whacked together a while ago
to match in perl; I'm fairly certain that it matches all of the cases
and no invalid cases:

   chomp ($_[0]);
   my $dq_regex = "([01]?[0-9][0-9]?|2([0-4][0-9]|5[0-5]))";
   ($_[0] =~ m/^(${dq_regex}\.){3}${dq_regex}$/);

	I've actually got a fairly robust set of perl functions
for matching/parsing IPv4 addresses and netmasks in a variety of formats,
that I was thinking of posting to CPAN; does anyone know if something like
that already exists?  (I spent a fair amount of time looking for such a
module before writing mine, so I _think_ it doesn't, but I never bothered
to just ask.)

	-- Sweth.

-- 
Sweth Chandramouli ; <sweth@sweth.net>
<a href="http://www.sweth.net/legal/disc.html">*</a>


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

Date: Tue, 23 May 2000 21:26:51 -0500
From: "Jian Lin" <umlinj@cc.umanitoba.ca>
Subject: How to read a float type data?
Message-Id: <8gfelv$q8u$1@canopus.cc.umanitoba.ca>

Hi There
How can I read a float type data from a text file using Perl script.
For example, a text file contains three data: 129  3.44 7.5
I want to read the third data(7.5)
Is it possible to convert the ASCII code(7.5) into a float type variable ?
Thank you in advance.
Jian




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

Date: Tue, 23 May 2000 22:45:03 -0500
From: Kiera <kiera@nnickee.com>
Subject: odd behavior printing after randomizing an array from STDIN
Message-Id: <84BF13308AFA8255.1CFB92267BA562CA.0F5E9952FEF66BDA@lp.airnews.net>

Ok, the basics:  running win98 with ActivePerl (version 5.005_03,
build 522)

Am working thru the Exercises in "Learning Perl on Win32 Systems" and
I get to the 3rd exercise in the 3rd chapter:

"Write a program that reads a list of strings and then selects and
prints a random string from the list."

Easy.

#!perl -w
srand;
print "List of strings: "; 
my @b = <STDIN>;
print "Answer: $b[rand(@b)]";
#__END__

Right?  Cept.. it didn't print anything.  Not even the word "Answer:".
No warnings, no nuthin'.  Oh, and that code above is almost character
for character from the Answer page in the book (I added the -w and the
my - behavior didn't change when I removed them).

What did change the outcome was adding a \n right before Answer:
	print "\nAnswer: $b[rand(@b)]";

Ok, so I guess my question is... is this behavior specific to win98?
Is it because of the ctrl-z needed to stop reading in strings from the
command window?  Is this documented anywhere (I've been looking but
haven't found it yet)?  Why is the sky blue? [0]

TIA
Kiera

[0] erm.. sorry... just kinda got on a roll there :)



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

Date: Wed, 24 May 2000 01:19:37 GMT
From: arpith@my-deja.com
Subject: Re: opinion on libwww
Message-Id: <8gfamt$cco$1@nnrp1.deja.com>


> > I am planning on snatching a lot of URLs, simultaneously, and
quickly.
> > Is this the best method ?
>
> Don't neglect the Robot Rules. Cheers!
>

Are there any laws ? :)

Anyway, I read this in someone else's resume:

"Finding out the Urls for 20 search engines was done . The script
operates on an client server basis . One server script can have
numerous client scripts running in different domains . The server
scripts hands out necessary keywords , logs submission time , spidered
time and clicked time."

Is that a good idea ? To have many clients ? I think the reason for
using different clients on many domains was to use different IPs to
avoid getting banned from search engines, but does it generally
increase the processing time ? Or is it a more efficient method of
doing things ?

Thanks
Arpith



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 24 May 2000 10:02:34 +0800
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: pl2exe missing from ActivePerl
Message-Id: <392B383A.1A8FD42A@email.sps.mot.com>

Tom Phoenix wrote:
> 
> On Tue, 23 May 2000, Tk Soh wrote:
> 
> > > > I have been looking for the pl2exe utility which, per the FAQ, should be
> > > > bundled with the installation,
> > >
> > > Can you tell me where in the FAQ you read this?
> 
> > ---------
> > ./faq/Windows/ActivePerl-Winfaq4.html:
> > <P>The pl2exe utility is similar to pl2bat, but it puts an executable
> > header on your perl script, that have been run through pl2exe.</P>
> >
> > ./faq/Windows/ActivePerl-Winfaq5.html:
> > file association feature. You can use pl2exe or pl2bat to convert a Perl
> > script to an executable or
> > ---------
> 
> Can you tell me where in the FAQ you read that pl2exe should be bundled
> with the installation?
> 

You are right, nowhere in the FAQ says that pl2exe is bundled with the
installation. It was my 'logical' conclusion, since pl2bat is bundled
with the installation. Perhaps I mis-interpreted the text. My apology.

Having said that, is there a place I can find pl2exe?


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

Date: Wed, 24 May 2000 01:40:21 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: SDBM_File - %HASH not returning all records ?
Message-Id: <392B3342.88FD23B3@rochester.rr.com>

Miggy wrote:
> 
> Bob, you are a bloody life-saver. I've been trying all kinds of
> key sizes and values to narrow down the problem, and yes,
> whatever I did, a percentage of the records never came back !
> 
> I am surprised that this isn't more fully documented - I mean, I
> downloaded ActivePerl 613 for Windows 95/98/NT. I would have
> expected somewhere in the SDBM_File docs a header with big
> bloody letters - BTW THIS DOES NOT WORK ON FAT, ONLY NTFS !
I agree -- although Windows 9x *is* a pretty crappy OS in comparison
with the others out there, and I can't blame serious folks for not
paying much attention to it (although I am running on it right now :-). 
I likewise wasted a bit of time learning that SDBM didn't work on FAT a
while back.  Plus, I think the problem is with the FAT file system, not
with SDBM or Perl, and so could be properly ignored.  Plus Perl can't
waste bytes on every glitch of every OS out there.  And maybe they'll
fix it, which would make the warning obsolete.  But a one-sentence
warning in the release notes for the Windows version *would* be nice.
> 
> Now, regarding DB_File. I did download the DB_File module from
> CPAN, but one of the prerequisites IS to have a copy of Berkeley
> DB on the computer. Berkeley will give me a source code for
> their latest version (3.xx ?), but not a pre-compiled Windows 98
> SE .EXE file. And as my VC++ CD is now a coffee mug holder after
> I got angry with it, I have no VC++ on my box - so I can't
> compile the damn source.
> 
> So, I'm now looking for a nice helpful type person who would
> download the Berkeley DB source from www.sleepycat.com, compile
> it on a Windows 98 (NOT NT) box, ZIP or TAR/GZIP it, and mail it
> to me ?
I think DB_File is already included in the ActiveState distribution.  If
it isn't, a precompiled autoinstalling copy can be obtained from
ActiveState by saying:

    ppm install DB_File

at a command prompt.  You don't need to do anything else to run it on
Windows -- about five seconds later, you have DB_File working, complete
with docs.  I just tested it on FAT32 on Windows 98 SE on Perl build
613, and it didn't drop a bit on a dataset where SDBM dropped about 10%
of the records.  Plus it generates only one database file, and it was
about 1/3 the size of the combined SDBM files.  And it saved typing four
characters in the program.
> 
> Any volunteers ?
> 
> Failing that, are there any other modules available for database
> creation and access that don't require a working copy of the
> underlying database application on the system. The scripts I'm
> working on are intended for different flavour UNIX boxes, I'd
> like them to be as portable as possible, but the database must
> also work on Windows 98, as that's what I'm using here at home
> to test and debug them.
mysql might be a choice, with Perl's awesome DBI module as the
interface. I would advise against placing multiuser databases on Windows
9x, as 9x doesn't really do multitasking very well.  Does the database
itself need to work on all the boxes, or just the interface to the
database?  If the later, recognize that you will have contention
problems if more than one script is accessing a DB_File or SDBM database
at once, if one or more is writing.  That raises the ante on getting
everything right several notches.  Especially given that flock, like
SDBM, doesn't work on Windows 9x either. In fact, if you actually insist
on an OS where things work, Windows is a pretty poor choice -- Linux is
a good choice.
> 
> More Ideas Please !
 ...
-- 
Bob Walton


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

Date: Tue, 23 May 2000 19:09:24 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: SDBM_File - %HASH not returning all records ?
Message-Id: <392B39D4.970EBECA@vpservices.com>

Bob Walton wrote:
> 
> Miggy wrote:
> >
> I think DB_File is already included in the ActiveState distribution.  If
> it isn't, a precompiled autoinstalling copy can be obtained from
> ActiveState by saying:
> 
>     ppm install DB_File

Yes, true.  What is missing is the new BerkeleyDB.pm module that works
with the updated 3.x Berekeley DB setup.  I have tried compiling it with
VC++ but without success.  Any hints or binary sources?

> > Failing that, are there any other modules available for database
> > creation and access that don't require a working copy of the
> > underlying database application on the system. The scripts I'm
> > working on are intended for different flavour UNIX boxes, I'd
> > like them to be as portable as possible, but the database must
> > also work on Windows 98, as that's what I'm using here at home
> > to test and debug them.

Well, you could use one of the DBD modules that works with DBI that
doesn't require an rdbms.  They are certainly easy enough to port from
one platform to another and then eventually very easy to port to a true
rdbms when/if you need one.  The options are DBD::Xbase (handles
dbaseIII type files), DBD::CSV (handles CSV and other "delimited" files)
and DBD::RAM (handles XML, CSV, fixed-width records, and other types of
files).

MySQL works for testing and debugging fine on windows so that is another
option.

-- 
Jeff


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

Date: Tue, 23 May 2000 18:06:34 -0700
From: asound <asound40NOasSPAM@hotmail.com.invalid>
Subject: Re: Split a number up?
Message-Id: <13e2c2e4.c10aa2fc@usw-ex0104-033.remarq.com>

In article <MPG.1394c817b46862a998aac8@nntp.hpl.hp.com>, Larry
Rosler <lr@hpl.hp.com> wrote:
>In article <03be2378.b0a14227@usw-ex0104-033.remarq.com> on Tue,
23 May
>2000 17:03:40 -0700, asound
<asound40NOasSPAM@hotmail.com.invalid>
>says...
>> In article <MPG.1394b7507749a70f98aac5@nntp.hpl.hp.com>, Larry
>> Rosler <lr@hpl.hp.com> wrote:
>
>....
>
>> >OK, cool.  Now, what about dealing with an odd-length string,
>> >especially with the final digit 0?
>> >
>> >Stripped of some extra punctuation, these should handle that
>> >situation also:
>> >
>> >  my @num = $number =~ /\d{1,2}/g;
>> >
>> >  my @num2 = grep { length } split /(\d{2})/ => $number;
>>
>> Ok cool, but who said that you have to print out the last odd
0?
>
>No one.  Incomplete specification.  But the original regex
approach
>would have lost any trailing single digit, not just a zero.  And
the two
>original approaches were described as alternate Ways To Do It,
so they
>should Do It the same Way for all data.

Yes you're right. I misunderstood what you ment. It's pretty late
here and I am hacking java for my lab so I am confusing things.



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Wed, 24 May 2000 02:27:20 GMT
From: sordid@hotmail.com (Sordid One)
Subject: Re: Testing the getstore function in the LWP::Simple module
Message-Id: <392b3d39.27416771@news.wolf>

Hey Tom! I've spent the last few hours trying to work with this
problem, but I'm still stumped! I do have some more information on the
matter though :)

I have tried to eval the code, but the program still dies. I've
switched to the LWP::UserAgent module where there is a timeout feature
and still the program dies. In fact, when fetching the "slow" URL,
I've witnessed the timeout being ignored!! I've set the timeout to 0
seconds and it still gets stuck on this URL. I did try something that
you made me think of...pinging the server to see if it's
reachable...but the server returned a ping and then the page couldn't
be fetched....so I'm still at a loss here.

I've noticed, or rather stumbled upon some more info on this
matter.....the URL's that cause the death of my program return a
"There was no response" error in Netscape, but that doesn't help me
out too much.

Anymore insights into this dilema??

Scott

On Tue, 23 May 2000 09:33:26 -0700, Tom Phoenix <rootbeer@redcat.com>
wrote:

>On Tue, 23 May 2000, Sordid One wrote:
>
>> So, what I'd like to do is somehow test this line of code, and not by
>> killing the program if it fails :
>
>Do you want eval on a block? Do you want to change the default timeout? Do
>you want to simply check that the URL can be fetched, without storing the
>resultant data? Cheers!
>
>-- 
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>



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

Date: Wed, 24 May 2000 02:06:11 GMT
From: "Dave Brondsema" <brondsemadp@student.mps.k12.mi.us>
Subject: Re: timeout a perl script?
Message-Id: <nOGW4.86333$h01.621319@news1.rdc1.mi.home.com>

"David Efflandt" <efflandt@xnet.com> wrote in message
news:slrn8ie89d.m66.efflandt@efflandt.xnet.com...
> On Sat, 20 May 2000, Dave Brondsema <qbasicguy@unitedstates.com> wrote:
> >How could I make a perl script timeout after a while (like an infinite
> >loop)?
> >
> >I've tried the alarm function, but that was unsupported.  Is this
something
> >that I perl can do, or do I need to do it on the server?  The server is
> >running NT with Active Perl 5.
>
> $timeout = 30; # seconds
>
> $timeout += $^T; # add start time of script
> while (1) {
>      # do something useful in endless loop
>      last if time > $timeout;
> }
>

That's all and good, but is there any way to do it automatically?  What I'd
like to do is code a few lines at the top and not worry about it anywhere
else.  This is mostly preventitive so any mistakes won't be troublesome.

Thanks



> --
> David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
> http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/
>




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

Date: Wed, 24 May 2000 03:07:44 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: use english
Message-Id: <x7puqcbq80.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> That is irrelevant, as there is no Boolean test involved, just a string-
  LR> wise xor of a null string against another string, which is an identity 
  LR> operation.

d'oh! i forgot no logical xor, only bitwise, string or integer. logical
xor makes no logical sense.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 23 May 2000 23:27:44 -0400
From: sandoz@umbc.edu (James W. Sandoz)
Subject: Re: use english
Message-Id: <8gfi7g$6oj5g$1@umbc7.umbc.edu>

Sandy Barnabas <barnabas@cis.ohio-state.edu> wrote:
>I'm a fairly new perl programmer, and I "use english" in most (if not all)
>my scripts.  Recently, a friend has told me that "use english" is not used
>by serious perl programmers and is against the perl idiom; and that I should
>learn the shorthand form of the variable names.  I was wondering if this is
>indeed the case or not.

I dunno about peer pressure, but there is a time penalty to load the
module.  This may or may not be a concern, but you may want to re-write
one of your scripts without 'use English' and see if you can detect the
difference.
    Jim Sandoz

--Benchmark Script--
#!/usr/local/bin/perl -w
use strict;
use Benchmark;

timethese(100, {
        'use English' => sub{`perl file1`},
        'No use English' => sub{`perl file2`}
});

--file1--
use strict;
use English;

--file2--
use strict;

--Output--
Benchmark: timing 100 iterations of No use English, use English...
No use English: 12 wallclock secs 
        ( 0.10 usr  0.76 sys +  2.06 cusr  5.05 csys =  0.00 CPU)
use English: 39 wallclock secs 
        ( 0.09 usr  0.79 sys + 14.67 cusr  7.07 csys =  0.00 CPU)
-- 
Mr. James W. Sandoz, Instructor, UMBC Dept of Biol Sciences,  
				 1000 Hilltop Circle
				 Catonsville, MD 21250
voice: (410) 455-3497; fax: 455-3875; net: sandoz@umbc.edu


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

Date: 24 May 2000 02:34:29 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: valid email address
Message-Id: <8gff3l$tcm$1@newsflash.concordia.ca>

In article <392AA6F6.8B5FA982@mail.uca.edu>,
Cameron Dorey  <camerond@mail.uca.edu> wrote:
>Neil Kandalgaonkar wrote:
>> 
>> 
>> A safe assumption for most addresses...
>> 
>> But I did a quick poll, for fun. These machines
>> are accessible simply with the country code:
>
>I'm just curious, how did you do such a poll?

I got a list of country codes from the web, and ran a 
perl one-liner on it.

-- ccodes.txt --
AD   Andorra
AE   United Arab Emirates
AF   Afghanistan
AG   Antigua and Barbuda
AI   Anguilla 
( etc...)

perl -wlne 'my ($code, $country) = split; if (`nslookup $code` =~ 
/$code\nAddress:  ([\d.]+)\n\n$/) { print "$code $country -> $1" }' 
ccodes.txt > found.txt   

dig would have yielded MX records too, as someone pointed
out. This code is somewhat lame, but it only took me a few
seconds to write. I could have used ping or other services,
I suppose. 


-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Wed, 24 May 2000 02:52:51 GMT
From: "Kevin M. Sproule" <kmsproule@worldnet.att.net>
Subject: Re: Win32::ODBC and -w
Message-Id: <7uHW4.1603$hL1.106266@bgtnsc04-news.ops.worldnet.att.net>


"Bob M" <slipper@canada.com> wrote in message
news:UilV4.5409$714.158362@news.magma.ca...
> If I run the following code using -w, I get the warning:
>
> "Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 261"
>
> for every call to $db->Data().  I get the same thing if I rewrite using
> $db->DataHash().  However, everything seems to work fine if I don’t use -w
(or
> if I put "local $^W=0;" within the while loop).  Is it the normal behavior
of
> Win32::ODBC to spew this warning or am I making some stupid newbie
mistake?
>
> Thanks
> Bob
> SNIP

Bob,

No, you are not nuts.  Look at the ODBC.pm code and you should see something
like:

sub GetData{
    my($self) = @_;
    my(@Results, $num);
 ...
        $self->{'data'}->{ ${$self->{'fnames'}}[$num] } = $_;
        $num++;
 ...

The scalar $num is defined with my but never set to an initial value.  A
quick fix would be:

   my(@Results);
   my($num) = 0;

This should stop the warning messages.  There may be other areas in ODBC.pm
that require similar fixes.  In general Perl modules are quite handy and bug
free but they are not holy scripture.

Digitally yours,

Kevin Sproule




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3143
**************************************


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