[19283] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1478 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 9 18:06:32 2001

Date: Thu, 9 Aug 2001 15:05:19 -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: <997394719-v10-i1478@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 9 Aug 2001     Volume: 10 Number: 1478

Today's topics:
        (Perl) programming contest loosely based on the prisone <tsee@gmx.net>
    Re: -w option changes filename variable <gnarinn@hotmail.com>
    Re: -w option changes filename variable (Pete)
        Comparing data in two different files (shaz)
    Re: Comparing data in two different files <krahnj@acm.org>
    Re: Converting a string to an Integer <pne-news-20010809@newton.digitalspace.net>
    Re: error with signal handling (yawnmoth)
        FAQ: How do I verify a credit card checksum? <faq@denver.pm.org>
    Re: File::Find : cannot figure it out. <if.xoboi@jks.invalid>
    Re: find the next Friday date in Perl <gnarinn@hotmail.com>
    Re: FLATTEXT:  Have it display random entries? <goldbb2@earthlink.net>
        glob AIX4.3 truncating long filenames (Patrick Manning)
    Re: How to get Mac and IP address of computers over a n <rsherman@ce.gatech.edu>
    Re: how to get perlscript <bart.lateur@skynet.be>
        Is arbitrary binary data in a hash value a problem? <wcatlan@optonline.net>
    Re: Is arbitrary binary data in a hash value a problem? <brentdax1@earthlink.net>
    Re: Is it a number? <bart.lateur@skynet.be>
    Re: list in scalar context: what's the expression to co <bjoern@hoehrmann.de>
    Re: mySQL - More records or longer records - Speed? (Logan Shaw)
        Perl 5.6 Pollute <eric@mizuhocap.com>
    Re: Perl 5.6 Pollute <brentdax1@earthlink.net>
    Re: Perl dumps core :-(. <shah@typhoon.xnet.com>
    Re: Perl for VMS - use IO::Socket::INET <dan@tuatha.sidhe.org>
    Re: Perl Search Engine (Peter Scott)
        perl to database <t_boss75@hotmail.com>
    Re: perl to database <bart.lateur@skynet.be>
        permuting extremely large string <citykid@nospam.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 9 Aug 2001 21:08:38 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: (Perl) programming contest loosely based on the prisoners' dilemma
Message-Id: <9kumv8$nvu$04$1@news.t-online.com>

Hi NG,

(note: this post is based on a German post to de.comp.lang.perl.misc but
cross-posting didn't make a lot of sense, did it?)

I am considering starting a programming contest that's loosely based on the
iterated prisoners' dilemma. If you've never heard of that you can get some
background information from this web page:
http://www.lifl.fr/IPD/ipd.frame.html.en
If you get some odd errors, just click on the *.en files to open the english
version of the page.

The details aren't cooked up yet. I am just wondering whether or not there
is any demand for this kind of contest.
The (very basic) idea is: All entries are submitted in form of a
module/package (or maybe a single function). The entries face each other in
a round-robin tournament and the winner is the entry that earns the most
points.
Basically, all the entries do is decide whether to cooperate or defect.
Depending on how the entries decided, points are awarded as follows:
- both cooperate: both get 3 points
- both defect: both get 1 point
- one defects, one cooperates: defecting entry gets 5, cooperating entry
gets no points

Then, the decision-making is repeated (the functions are called again), but
the entries get to analyse the behaviour of the opponent.

This is the basic prisoners' dilemma and has been thoroughly researched. (In
case you followed that link, you might know that the winning strategy was
Tit for Tat - do what opponent did last turn.) It is not meant to be used
for a *programming* contest but rather for research. That's why I am not
going to pose this exact task, but a more complicated one. I will post a
follow-up with a more detailed description soon, but thought I'd give you
the basic idea of what I'm after first.

I need to know whether any of you are interested in such a contest. There
are no prizes planned. It's all for fun or your ego. Perhaps I could get
some sponsoring, but not in a dimension that would pay for the effort.

eMails to my (valid) address are very welcome (even to just state that
you're interested), but if you have any suggestions, you might want to share
it with the others in the ng.

Regards,
Steffen Müller





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

Date: Thu, 9 Aug 2001 17:47:31 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: -w option changes filename variable
Message-Id: <997379251.949942796025425.gnarinn@hotmail.com>

In article <3b72be98.91662146@news.btinternet.com>,
Pete <Peter@angeltec.fsnetNOTTHIS.co.uk> wrote:
>
>when running perl with the -w option :
>print $0 gives filename
>
>without the -w it gives ./filename.

there must be something you are not telling us

are you running the file with:
  perl filename
or (it being executable):
  filename
?

gnari


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

Date: Thu, 09 Aug 2001 20:38:08 GMT
From: Peter@angeltec.NOTHISfsnet.co.uk (Pete)
Subject: Re: -w option changes filename variable
Message-Id: <3b72f43d.2076995@news.freeserve.net>

perl -w filename when testing then just filename when finished

Pete

On Thu, 9 Aug 2001 17:47:31 +0000, gnari <gnarinn@hotmail.com> wrote:

>In article <3b72be98.91662146@news.btinternet.com>,
>Pete <Peter@angeltec.fsnetNOTTHIS.co.uk> wrote:
>>
>>when running perl with the -w option :
>>print $0 gives filename
>>
>>without the -w it gives ./filename.
>
>there must be something you are not telling us
>
>are you running the file with:
>  perl filename
>or (it being executable):
>  filename
>?
>
>gnari



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

Date: 9 Aug 2001 11:23:57 -0700
From: ssa1701@yahoo.co.uk (shaz)
Subject: Comparing data in two different files
Message-Id: <23e71812.0108091023.2a0be11c@posting.google.com>

I have a program which reads in some a txt file and counts each word.
There are some words which I do not want counted. I have put these into a
seperate file (called list.txt).

I have created a hash, called %words which contains $word and $no.

How do I change the code below to remove all the words in the hash, which
are also present in the list.txt file?
 
delete @words{qw(a is or of it the and)}; #stop list

I have tried two ways(using list as a variable and an array)

1)  $list="./list.txt";
    delete @words{qq($list)}; #stop list


2)  $list="./list.txt";
    if (exists ($list{$word}))
    {
      delete $words{$word};
    }


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

Date: Thu, 09 Aug 2001 20:20:43 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Comparing data in two different files
Message-Id: <3B72F100.886A95BC@acm.org>

shaz wrote:
> 
> I have a program which reads in some a txt file and counts each word.
> There are some words which I do not want counted. I have put these into a
> seperate file (called list.txt).
> 
> I have created a hash, called %words which contains $word and $no.
> 
> How do I change the code below to remove all the words in the hash, which
> are also present in the list.txt file?
> 
> delete @words{qw(a is or of it the and)}; #stop list
> 
> I have tried two ways(using list as a variable and an array)
> 
> 1)  $list="./list.txt";
>     delete @words{qq($list)}; #stop list
> 
> 2)  $list="./list.txt";
>     if (exists ($list{$word}))
>     {
>       delete $words{$word};
>     }

open LIST, 'list.txt' or die "Cannot open list.txt: $!";
chomp( my @list = <LIST> );
delete @words{@list};




John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 09 Aug 2001 22:32:53 +0200
From: Philip Newton <pne-news-20010809@newton.digitalspace.net>
Subject: Re: Converting a string to an Integer
Message-Id: <7bs5nt49vecvohot15ruas0n2k62ubg6um@4ax.com>

[Ilya, you seem to have left the attribution out when you quoted Peter
Mann.]

On 09 Aug 2001 21:24:27 +0400, Ilya Martynov <ilya@martynov.org> wrote:

[Peter Mann wrote:]
> PM>     I have some code that retrieves a string from a database but I
> PM> need to convert it into an integer.

You probably don't need to do that. Normally, Perl converts between
strings and numbers as needed, and they behave nearly identically in
expressions[1].

> my $int = int($str);

This will take a number (or a string which will be converted to a
number) and gives you a number containing only the integral part of the
original number; it throws the fractional part away.

The number you get back may be a floating-point number internally, but
you shouldn't have to worry about that. So even this is not suited if
you absolutely want an integer (well, if you want that, Perl is not the
right language for you). But all of the following should work
identically for you in nearly all circumstances:

    '16'
    16.0
    16

Basically, you shouldn't need to worry about it[2].

Cheers,
Philip

[1] some exceptions are when dealing with bitwise operators and
auto-increment.

[2] On the other hand, I'm making an assumption here: that the string
you retrieve from the database will look like a number, for example
'3842'. If it's instead something like 'MMMDCCCXLII' or 'three thousand
eight hundred and forty-two', then you'll need to convert it to a number
before you can do normal arithmetic with it.
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 9 Aug 2001 11:17:32 -0700
From: terra1024@yahoo.com (yawnmoth)
Subject: Re: error with signal handling
Message-Id: <a0d63404.0108091017.48554ff1@posting.google.com>

"Chas Friedman" <friedman@math.utexas.edu> wrote in message news:<9ku7tr$cpi$1@geraldo.cc.utexas.edu>...
> yawnmoth <terra1024@yahoo.com> wrote in message
> news:a0d63404.0108090605.28039dd6@posting.google.com...
> > I wrote a script to test signal handling, and...
> > it doesn't seem to work (as in, when I hit a break key - crtl+c, or
> ...
> I works fine for me on Windows and Linux. However, I don't see why you
> need to re set $SIG{INT}=\&end inside the definition of the sub end.
> You might try putting a sleep statement inside your loop. Your machine
> may be so busy executing the loop that it ignores the <CTRL>C. [That
> has happened to me (on Windows.)]
>                                      cf

I added sleep(1); to it, but that makes it kinda slow.  Adding
sleep(.2) or sleep(.9) doesn't seem to have any effect - it goes just
as fast as it did before (I'm guessing it thinks that .2 is equiv to
0).  Is there anyway I can make it a tad faster, but not to fast, or
would this be machine dependant, upon the number of proccessors and
types?
Anyhow, I was playing around with the script some more, and it does
break, but only after 30 sec or so.  I guess I can just work with
that!
Well, thanks for the help, so far! :)


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

Date: Thu, 09 Aug 2001 18:17:02 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I verify a credit card checksum?
Message-Id: <ysAc7.28$B2j.170779648@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I verify a credit card checksum?

    Get the Business::CreditCard module from CPAN.

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.73
-- 
    This space intentionally left blank


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

Date: Thu, 9 Aug 2001 13:36:04 +0300
From: Sami Jarvinen <if.xoboi@jks.invalid>
Subject: Re: File::Find : cannot figure it out.
Message-Id: <MPG.15dbdf2068bf60f79896a6@news.yhteys.mtv3.fi>

Logan Shaw wrote:
> After looking at the documentation for File::Find, I can't see where it
> says that "find" will do anything in particular with the return value
> of your code.

Btw, the documentation for File::Find seems to have nothing to say 
about _find()'s return value_.

-- 
To demunge e-mail address, remove ".invalid" and reverse the rest.
See <URL:http://www.faqs.org/faqs/net-abuse-faq/munging-address/>
for details on "spam-blocking".


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

Date: Thu, 9 Aug 2001 21:08:08 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: find the next Friday date in Perl
Message-Id: <997391288.901331156026572.gnarinn@hotmail.com>

On 9 Aug 2001 08:46:16 -0700, Larry S <dime0000@yahoo.com> wrote:
> i'd like to know if anyone has a solution in finding the next Friday
> date in Perl.

  use Date::Manip;
  print UnixDate('next friday','%D\n');

Date::Manip may be an overkill for this single case, but if you have to do a
lot of date manipulations of different kinds, then it is great.

gnari



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

Date: Thu, 09 Aug 2001 17:40:58 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: FLATTEXT:  Have it display random entries?
Message-Id: <3B73036A.F7D76ECE@earthlink.net>

Anno Siegel wrote:
> 
> According to charles <charles@vortus.com>:
> > Hello.  I have had great success with FLATTEXT and the Zip Code
> > Locator section of the software.  However, one step is causing
> > problems.  I would like to have it pull three RANDOM entires from
> > the text file that meet the criteria.  For example, if I do a search
> > for stores in Chicago, I want it to just return three random stores
> > in Chicago.  Right now, I can only get it to return the first or
> > last three alphabetically.
> 
> Have FLATTEXT (whatever that is) deliver all the hits and store them
> in an array.  Then select three random elements like so:
> 
>     my @selection = map splice( @array, rand @array, 1), 1 .. 3;
> 
> "splice" removes the element selected by "rand @array" from @array,
> so no duplicates will occur.  If there are fewer than three elements
> to begin with, only so many will be delivered (instead of giving
> you undefs).  This is probably what it should do.
> 
> Oh, and when you replace "3" with @array, it gives you a random
> permutation.

Yes, but don't use this method to get random permutations, since it's
an O(N**2) algorithm (splice is O(N), and you're doing N of them).

Use a real shuffle instead (this is in the faq).

-- 
I need more taglines. This one is getting old.


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

Date: 9 Aug 2001 13:29:14 -0700
From: pat.manning@pgs.com (Patrick Manning)
Subject: glob AIX4.3 truncating long filenames
Message-Id: <b12f4172.0108091229.a1a44a4@posting.google.com>

for the following simple code run on an AIX4.3 machine:

my $path = '/some/not_unreasonable/length/path' ;
my @allfiles = glob($path/*) ;

foreach $file (@allfiles) {
  print "$file\n";
}

I get output such as this:
/some/not_unreasonable/length/path
/some/not_unreasonable/length/path/fullfilename
/some/not_unreasonable/length/path/trunca
/some/not_unreasonable/length/path/filena
/some/not_unreasonable/length/path/shortl

This list is both truncated and not complete.  This is true for both
the glob function and its <$path/*> equivalent.  This all works
correctly and as expected on a Solaris box.  Perl version is 5.1.6.  I
could not find a similar post or explanation, so I can only assume
something is up with my AIX installation. Can anyone offer insight?


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

Date: Thu, 09 Aug 2001 16:17:45 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: How to get Mac and IP address of computers over a network?
Message-Id: <3B727159.8EB02193@ce.gatech.edu>

Fred wrote:
> 
> helgi@NOSPAMdecode.is (Helgi Briem) wrote in message news:<3b727bba.1481552429@news.isholf.is>...
> > The command ipconfig /all can be used to get network info
> > on a NT box so you can try:
> >
> > my @network_info = qx/ipconfig \/all/
> > or die "Cannot run ipconfig:$?\n";
> > print @network_info;
> 
> Thanks Helgi that does work, but it only works for getting the info on
> my machine.  I need to get the IP and Mac addresses of other machines
> on the network as well.  It appears to me that ipconfig cannot be used
> for this.  If I am overlooking something that you wrote and it can be
> used for getting other's info or if you know of a way to get other's
> info as well please let me know.
> Thanks again,
> 
> Fred

NBTScan is a nice tool for getting netbios info and mac addresses from
windows boxes...and there is a perl version, which might help you out:

http://www.inetcat.org/software/nbtscan.txt

though it does seem all it really does is ping and arp, then parse the
results...

--
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa


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

Date: Thu, 09 Aug 2001 19:57:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to get perlscript
Message-Id: <lrq5nt8ljoag32vcsns9hdkkq3kk8astba@4ax.com>

Helgi Briem wrote:

>>How do I configure Microsoft IIS 4.0 to support Perl for Win32?
>
>This question is off topic in this newsgroup.  Ask
>in a newsgroup devoted to the topic of web servers
>and their configuration

It wasn't a question. It was the title of a little article.

-- 
	Bart.


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

Date: Thu, 09 Aug 2001 21:15:48 GMT
From: "Bill Catlan" <wcatlan@optonline.net>
Subject: Is arbitrary binary data in a hash value a problem?
Message-Id: <84Dc7.2341$up.715296@news02.optonline.net>

Hello,

There are two ways to get the request content from an HTTP::Request object into
CGI.pm.  One is to parse the request and dump it to disk in a certain format
supported by CGI.pm and then read the file into a CGI.pm object.  CGI.pm
provides a method for importing this file, but it's kind of kludgy for my
purpose and I'm not sure whether the file handling method is designed to handle
arbitrary binary values properly.  Plus, I don't require persistence, so I'd
rather avoid disk accesses.

The other way is to load up a hash:

$query = new CGI({'dinosaur'=>'barney',
                  'song'=>'I love you',
                  'friends'=>[qw/Jessica George Nancy/]});

My question with the hash solution is ultimately a basic qustion about perl.
Are there any issues with or tips with regard to putting arbitrary binary data
into a hash value?  I don't want to get involved with base64 encoding my binary
stuff, but I will if I have to! :)  The memory footprint will be small for each
request, so I'm not concerned with resources.

Thanks!

Bill Catlan

----
William Catlan, J.D.
Programmer Analyst - Internet Strategist
"Early Insights That Make A Difference"
v: 631.956.0780
f: 631.956.0026
e: wcatlan@optonline.net







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

Date: Thu, 09 Aug 2001 21:47:56 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Is arbitrary binary data in a hash value a problem?
Message-Id: <gyDc7.1231$q46.103851@newsread2.prod.itd.earthlink.net>

"Bill Catlan" <wcatlan@optonline.net> wrote in message
news:84Dc7.2341$up.715296@news02.optonline.net...
 ...
> My question with the hash solution is ultimately a basic qustion about
perl.
> Are there any issues with or tips with regard to putting arbitrary binary
data
> into a hash value?
 ...

No.  Perl has supported binary data in strings since version 2 or 3
(although I can't remember which).  And even that only meant removing the
specialness of a null in a string.

HTH,
--Brent Dax
brentdax1@earthlink.net




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

Date: Thu, 09 Aug 2001 21:41:35 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is it a number?
Message-Id: <6r06ntcbkreevmibjkf6cbcsf15dtq8c3u@4ax.com>

Philippe PERRIN wrote:

>for float : $x =~ /^(\d+)(\.?)(\d*)$/;

Why the parens?

Plus: you may just allow a "-" sign. Provisions for an exponent
(/[eE][+-]?\d+/) could be added too. And finally, you might allow a
sting like ".1" as well.

-- 
	Bart.


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

Date: Thu, 09 Aug 2001 22:30:17 +0200
From: Bjoern Hoehrmann <bjoern@hoehrmann.de>
Subject: Re: list in scalar context: what's the expression to count its elements?
Message-Id: <3c1bed45.95224074@news.bjoern.hoehrmann.de>

* John Lin wrote in comp.lang.perl.misc:
>For a constant list sub:
>
>sub foo { 6,7,8 }
>
>I know the STATEMENT to count its elements:
>
>my $count =()= foo;   # result is 3
>
>But what about the EXPRESSION?
>For example, I use the following expression:
>
>scalar @{[foo]}  to count the elements, which is 3

>Yes, the ugly code can get what I want.
>But will perl stupidly construct an anonymous array to count?
>Is there a better EXPRESSION for this?

  % perl -wmstrict -e "sub l { qw/a b c/ } print scalar( () = l )"
-- 
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/


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

Date: 9 Aug 2001 15:26:44 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: mySQL - More records or longer records - Speed?
Message-Id: <9kurm4$o1$1@charity.cs.utexas.edu>

In article <20f405bf.0108081725.317cbb9b@posting.google.com>,
Mark Deibert <area31@mail.com> wrote:
>What would be faster in mySQL (or any really), creating a table that
>will store 1000 records with 4 fields in each record, or 4 records
>with 1000 fields in each record?

You've asked about creating the table.  Creating the table
will probably not be a significant performance problem.

If you want to access it after it's created, that's a
different story.  The answer probably depends on lots of
things, like whether there are indices on certain columns,
whether or not there are any variable-length records (and
whether you access them much), and how big the fields are.

In other words, this question is sort of like asking, "Which data
structure is faster -- a binary search tree, or an unsorted array?"
The answer is, it depends on what you want to accomplish with it.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


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

Date: Thu, 09 Aug 2001 15:56:32 -0400
From: Eric <eric@mizuhocap.com>
Subject: Perl 5.6 Pollute
Message-Id: <3B72EAF0.E66175FF@mizuhocap.com>

Does anyone know of a way to enable the POLLUTE option in perl 5.6 on a
one off basis ( a switch perhaps ),  rather then having to recompile the
whole thing and forcing this environment POLLUTION in all cases?

thanks,
Eric




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

Date: Thu, 09 Aug 2001 21:49:35 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Perl 5.6 Pollute
Message-Id: <PzDc7.1338$2M3.108683@newsread1.prod.itd.earthlink.net>

"Eric" <eric@mizuhocap.com> wrote in message
news:3B72EAF0.E66175FF@mizuhocap.com...
> Does anyone know of a way to enable the POLLUTE option in perl 5.6 on a
> one off basis ( a switch perhaps ),  rather then having to recompile the
> whole thing and forcing this environment POLLUTION in all cases?

I don't believe there's a way to do that.  You could compile two versions of
Perl (/usr/bin/perl and /usr/bin/perl-superfund?) and just make sure you
call the right one when you need pollution.

(However, I could be wrong.)

--Brent Dax
brentdax1@earthlink.net




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

Date: Thu, 9 Aug 2001 21:28:40 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Re: Perl dumps core :-(.
Message-Id: <9kuva8$44u$1@flood.xnet.com>

While stranded on information super highway Ilmari Karonen wrote:
:)In article <9kf02f$65b$2@flood.xnet.com>, Hemant Shah wrote:
:)>
:)>   The script that scans Java code dies with segmentation fault in some of the
:)>   program. It fails on the different lines in Java programs, but at the same
:)>   point in perl script. 
:)
:)Well, that definitely looks like a bug in perl.  You ought to use the
:)'perlbug' program to report it.
:)
:)If you wanted to be really helpful, you could test it on the latest perl
:)release you can find (preferably a development snapshot, read 'perldoc
:)perlhack' to find out how to get one) compiled with -Doptimize=-g to see
:)if the bug is still there and to get better debugger output.  But just
:)submitting a bug report should generally be enough.

   I tested the script on perl 5.6.1 with same result. In perl 5.6.0 I was
   getting segmentation fault, in perl 5.6.1 I am getting memory fault.

   I will re-compile perl 5.6.1 with -Doptimize=-g to get better output.


:)
:)
:)>Segmentation fault in free_y at 0xd016cf18
:)>0xd016cf18 (free_y+0x16c) 8107000c        lwz   r8,0xc(r7)
:)>(dbx) t
:)>free_y(??, ??) at 0xd016cf18
:)>free(??) at 0xd016b0a0
:)>Perl_safefree(??) at 0x10023e64
:)>Perl_mg_free(??) at 0x1000fb60
:)>Perl_leave_scope(??) at 0x1000be8c
:)>Perl_pop_scope() at 0x100094f0
:)>Perl_pp_leavesub() at 0x10006d6c
:)
:)Looks like another scoping bug.  One of the easier ways to get segfaults
:)in perl.  I hope perl6 will have something more stable than the current
:)savestack mess.
:)
:)One of the side effects of the current implementation is that, depending
:)on what the exact cause is, you could have trouble reproducing the bug.
:)The problem is that it's easy for sloppy scope clearing to get swept
:)under the carpet, where it may or may not stay safely hidden.
:)
:)-- 
:)Ilmari Karonen -- http://www.sci.fi/~iltzu/
:)"Get real!  This is a discussion group, not a helpdesk.  You post something,
:)we discuss its implications.  If the discussion happens to answer a question
:)you've asked, that's incidental."           -- nobull in comp.lang.perl.misc
:)

-- 
Hemant Shah                           /"\  ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.           
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


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

Date: Thu, 09 Aug 2001 21:34:51 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl for VMS - use IO::Socket::INET
Message-Id: <%lDc7.230740$v5.23710582@news1.rdc1.ct.home.com>

Tom Steuver <steuver@nku.edu> wrote:
> Is there an equivalent in Perl for VMS for use IO::Socket::INET?

Doesn't that work? It ought, as VMS does TCP/IP fine.

				Dan


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

Date: Thu, 09 Aug 2001 18:06:11 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Perl Search Engine
Message-Id: <niAc7.40248$2J4.13600837@news2.rdc1.bc.home.com>

In article <9Mkc7.105408$TM5.15369395@typhoon.southeast.rr.com>,
 "Antoine Hall" <AHALL5@nc.rr.com> writes:
>Does anyone know where I can find a simple but fast search engine?

The Harvest-NG project at http://sourceforge.net/projects/webharvest/
is a pure Perl, fully scalable web search engine.  However it is not what
I would call simple.

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Thu, 9 Aug 2001 15:48:23 -0400
From: "R.Vic" <t_boss75@hotmail.com>
Subject: perl to database
Message-Id: <jOBc7.106749$%7.759109@news6.giganews.com>

I'm trying to create a script thas trasfer data to an access database.

I'm trying to use win32:odbc, but can't get it to work.

To create an system dsn, do I need an sql server software?

Can this be done with MYSQL?






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

Date: Thu, 09 Aug 2001 20:17:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: perl to database
Message-Id: <omr5ntk83pc8rgnvkv8bo0f7ntp2qdk395@4ax.com>

R.Vic wrote:

>To create an system dsn, do I need an sql server software?

No, you need the ODBC control panel (see the control panels) and the
Access driver. I'm not sure if it's the only source, but if you install
Access, you get it all.

And here's how you add a system DSN: open the ODBC data sources control
panel, pick the "system DSN" tab, click on the "Add" button, select
"Microsoft Access driver (*.mdb)", and now you get the chance to choose
the database file. Give it a name, which is the name you'll use to
connect to the database. Click "OK", and you're done.

-- 
	Bart.


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

Date: Thu, 9 Aug 2001 11:42:23 -0700
From: Les Ander <citykid@nospam.edu>
Subject: permuting extremely large string
Message-Id: <Pine.LNX.4.33.0108091115180.2586-100000@schewanella.stanford.edu>

Hi,
i need to permute a string which is about 4 Mb!
I experience  memory problems if i convert it to an array (the program
crashes). So I need to permute the string inplace without converting
it into an array.
A simple strategy i am thinking of is follows...

sub perm_string
{
  my $str_ref=shift @_;
  my $len=length $$str_ref;
  for (1..1000){
     my $start=int rand($len-1);
     my $size=int rand($len-$start-1);
     my $temp_str=substr($$str_ref, $start,$size);
     substr($$str_ref, $start, $size)='';
     $$str_ref.=$temp_str;
  }
}

it took about 45 seconds when i tried it on a string of length about
5,000,0000 characters.
Is there a way to speed it up?
also, can some one think of a better algorithm?
thanks
nizar



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1478
***************************************


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