[13562] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 972 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 2 12:07:16 1999

Date: Sat, 2 Oct 1999 09:05:09 -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: <938880309-v9-i972@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 2 Oct 1999     Volume: 9 Number: 972

Today's topics:
    Re: Browser Toolbar Buttons (Marc)
    Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca (Clinton Pierce)
        CGI testing on a Win95 machine (Marc)
    Re: CGI testing on a Win95 machine (Bill Moseley)
    Re: Email Address Syntax Checking. (Chris Nandor)
    Re: explicit package name error? <JFedor@datacom-css.com>
        getting server errors <zzzbrono@uq.net.au>
    Re: getting server errors (Bill Moseley)
    Re: How to retreive the size of a directory on NT (Clinton Pierce)
    Re: I am having a problem setting cookies in perl <JFedor@datacom-css.com>
    Re: Install CPAN module in ActiveState Windows version  <fwr@ga.prestige.net>
        Killing child processes on NT? jduell@alumni.princeton.edu
        LWP questions and SSL, too (Bill Moseley)
        Perl/CGI security (Bill Moseley)
    Re: Perl <gellyfish@gellyfish.com>
    Re: perlcc compile problem? <gellyfish@gellyfish.com>
    Re: Ples Hep Me!  adding users to mysql is impossible! <gellyfish@gellyfish.com>
    Re: Runtime exception driving me crazy (Clinton Pierce)
    Re: Trouble w/ Regex in ActivePerl for Win32 <flavell@mail.cern.ch>
    Re: Trouble w/ Regex in ActivePerl for Win32 <skilchen@swissonline.ch>
    Re: Using SS Numbers as DBM Index: Best Way to Encrypt  <fwr@ga.prestige.net>
    Re: using tr? (Clinton Pierce)
    Re: Values of thousand (Marc)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 02 Oct 1999 15:01:36 GMT
From: puma@mailandnews.com (Marc)
Subject: Re: Browser Toolbar Buttons
Message-Id: <7t3d6k.3vseghf.0@pumamarcmailandnews.h681E4B47.invalid>

Larry Rosler wrote in <MPG.125edf0c383121bd98a023@nntp.hpl.hp.com>:

>Next time you have a question, use your newsreader's cross-posting 
>capability instead of posting independently to more than one newsgroup.
>

    	Or better yet, post to one appropriate group. Much nicer...

Marc


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

Date: Thu, 30 Sep 1999 19:51:26 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <37f4bec1.283624670@news.ford.com>

On Thu, 30 Sep 1999 17:30:36 GMT, Scratchie <AgitatorsBand@yahoo.com>
wrote:
>What are you implying? That because Tom has contributed a lot of work to
>the perl community that we should pretend that he isn't a condescending
>jerk when he posts?

"AgitatorsBand@yahoo.com"?  You sir, are a troll of the worst kind.

Those with talent, who are willing to share their gifts, should always be
cut a little slack.  At least he's contributed.  

All you've done so far is bitch.

*plonk*

-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Sat, 02 Oct 1999 15:01:22 GMT
From: puma@mailandnews.com (Marc)
Subject: CGI testing on a Win95 machine
Message-Id: <7t3dfk.3vseghf.0@pumamarcmailandnews.h59C8916E.invalid>

Hi,
    	Just curious, runing ActiveState Perl on a Win95 machine. Wondering if 
there was a way I could test out Perl CGI on it.

Marc


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

Date: Sat, 2 Oct 1999 08:39:25 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: CGI testing on a Win95 machine
Message-Id: <MPG.125fc70cd795095b9897bd@206.184.139.132>

Marc (puma@mailandnews.com) seems to say...
>     	Just curious, runing ActiveState Perl on a Win95 machine. Wondering if 
> there was a way I could test out Perl CGI on it.

Sure, and this is really good advice:  Run the program and look at what 
it outputs.

After you have done that, you can install and run a web server.  
http://www.apache.org is one I like.  There are others, too.  Just 
search the web.

There's a special CGI usenet group where you can ask CGI questions, too, 
when you have them.

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 02 Oct 1999 12:02:17 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Email Address Syntax Checking.
Message-Id: <pudge-0210990802250001@192.168.0.77>

In article <slrn7vboat.1dd.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:

# package RFC::822::Address;

Ack!  Apparently, 5.004 does not recognize this package name.

So I changed it to Eight22, and because I am using MacPerl, also did this:

  (my $data = <DATA>) =~ s/\015\012?/\012/g;
  my $parser = Parse::RecDescent -> new ($data) or die "Compilation error.\n";


Now, I run the test and get:

1..1
ok 1
# Goto undefined subroutine &Parse::RecDescent::valid, <DATA> chunk 1.
File '(eval 93)'; Line 13


Any thoughts?

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


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

Date: Sat, 2 Oct 1999 12:25:34 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: explicit package name error?
Message-Id: <7t59bl$hmn$1@plonk.apk.net>


Abigail wrote in message ...
>
>But since $cartid is my'ed inside the sub, it doesn't exist outside
>of it. Better let getpathvars return the splitted list and assign
>when you call the sub.


using:

my ($cartid, $pageid);
&getpathvars;

It worked fine.  I thought using strict only forced you to define your
variables before using them.  I understand the concept of global
and local variables but, when using strict, do you define variables
globally like I did, before the subroutine or at the top?

Also, when using the "return $cartid;" in a subroutine, would
this provide $cartid globally or must you call the subroutine
like this:   $cartid = &getpathvars;  to assign the local($cartid)
to the global($cartid)?

Jody

http://www.onlysupplies.com






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

Date: Sat, 02 Oct 1999 22:01:46 +1000
From: Outlaw Jim <zzzbrono@uq.net.au>
Subject: getting server errors
Message-Id: <37F5F42A.C9CAC895@uq.net.au>

This is a multi-part message in MIME format.
--------------C282C278E436CC9455AB0E34
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've got a really big problem with getdoc.pl(attached), it doesn't work.
This is some of the first(worst) perl I've ever written in a long time
so please don't email me telling me how crap it is unless you can fix it
:). I used chmod 755 for permissions so that's out. I have no idea what
I've done wrong.


-
Cheers,
Outlaw Jim

-----------------------
check out LinuxGamer at
http://linux.gamers.net
-----------------------


--------------C282C278E436CC9455AB0E34
Content-Type: application/x-perl;
 name="getdoc.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="getdoc.pl"

#!/usr/bin/perl

#######################################################################
# getdoc.pl
# 
# Created by Dariush Bronowicki (zzzbrono@uq.net.au)
#
# created spring of '99
#
# (c)1999 Tempest Networks.  
#
#	Freely distributable as long as you keep header intact
#	but really, why?
#	
#
#	No known bugs so far....
#					....apart from the fact that
#						it doesn't work :)
#
# Version 0.000000000000000000000000000000000000000000000000000001 beta
#
#######################################################################

#define
$rlocation="/web/gamers.net/subdomains/linux/"


open(INF, "$sourcefile"); or &dienice("Can't find the file requested");
@data = <INF>;
close(INF)

foreach $line(@data)
{
	chomp($line);
	print "$line\n";
}



##########################
# Page Template          #
##########################

print <<HTMLcode;

#begin HTML
<html>
<head>
   <meta name="KeyWords" content="linux, games, gamer, newswire, editorials, future, tempest networks, copyleft, free software, beneath a steel sky, xbass,  outlaw jim, blackheart, lucifer,">
   <meta name="Author" content="Tempest Networks">
   <meta name="Description" content="The ultimate site for Linux Game Content">
   <title>LinuxGamer - linux.gamers.net</title>
</head>
<a NAME="top">
	<body text="#000000" bgcolor="#FF6700" link="#FFCC00" vlink="#FFCC00" alink="#CC0000">
		<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="719" >
			<tr>
<td BGCOLOR="#003060" BACKGROUND="img/bg.jpg">
<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="719" HEIGHT="123" >
<tr>
<td WIDTH="511"><img SRC="img/head_tf.jpg" BORDER=0 height=123 width=511></td>
<td VALIGN=TOP WIDTH="208">

<td VALIGN=TOP WIDTH="208">
<div align=right><b><font face="Arial,Helvetica"><font size=-1>Issue: Coming
Soon!</font></font></b><img SRC="img/search.jpg" height=30 width=126><form action="/cgi-bin/search.cgi"><input type=text name=Q size="13"><input type=hidden name=E value=1><input type=hidden name=X value=0><br><img SRC="img/searchbutton.jpg" height=14 width=59></form></div></td>
</tr>

<tr>
<td COLSPAN="3" WIDTH="100%"><img SRC="img/head_mf.jpg" BORDER=0 height=11 width=719></td>
</tr>

<tr>
<td COLSPAN="3" WIDTH="100%"><img SRC="img/strip.jpg" ISMAP USEMAP="#strip" BORDER=0 height=23 width=719></td>
</tr>

					</table></center>
				</td>
			</tr>

<tr>
<td>

<br>
<center><!--#include virtual="banner.shtml" --></center>
<br>

print @data

<br>
<center><!--#include virtual="banner.shtml" --></center>
<br>
			</td>
		</tr>

<tr>
<td BGCOLOR="#003060" BACKGROUND="img/bg.jpg">
<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" HEIGHT="100%" >

<tr>
<td><img SRC="img/strip.jpg" ISMAP USEMAP="#strip" BORDER=0 height=23 width=719></td>
</tr>

<tr>
<td><img SRC="img/footer.jpg" ISMAP USEMAP="#footer" BORDER=0 height=28 width=719></td>
</tr>

</table></center>
</center>
</td>
			</tr>
		</table></center>
<MAP NAME="strip">
<AREA COORDS="9,2,115,20" HREF="newswire.html" alt="NewsWire">
<AREA COORDS="146,2,264,20" HREF="editorials.html" alt="Editorials">
<AREA COORDS="293,2,389,20" HREF="content.html" alt="Content">
<AREA COORDS="414,2,475,20" HREF="tech.html" alt="Tech">
<AREA COORDS="504,2,575,20" HREF="about.html" alt="About">
<AREA COORDS="606,2,706,20" HREF="sitemap.html" alt="Site Map">
</MAP>

<MAP NAME="footer">
<AREA COORDS="372,9,551,25" HREF="tempest.html" alt="Tempest Networks" target=_newwindow>
<AREA COORDS="642,4,715,24" HREF="#top" alt="Top">
</MAP>
	</body>
</html>
#end HTMLcode
HTMLcode
--------------C282C278E436CC9455AB0E34--



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

Date: Sat, 2 Oct 1999 06:21:42 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: getting server errors
Message-Id: <MPG.125fa6befaf0bbd39897b9@206.184.139.132>

Outlaw Jim (zzzbrono@uq.net.au) seems to say...
> I've got a really big problem with getdoc.pl(attached), it doesn't work.

Now that's helpful.  My programs don't work either.  They hang around 
the house all day drinking beer and watching TV.

> open(INF, "$sourcefile"); or &dienice("Can't find the file requested");
Hum....

Come back after doing a bit of debugging from the command line.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Fri, 01 Oct 1999 13:42:48 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: How to retreive the size of a directory on NT
Message-Id: <37f7b6d0.347127292@news.ford.com>

[poster cc'd in e-mail]

On 1 Oct 1999 01:32:49 GMT, "s5dw" <s5dw@telecom.co.nz> wrote:
>Is there an easy way to get the size of a directory without adding up the
>size of all the files in that directory.

Then what do you mean by the "size" of the directory?  There's only three
things I can make of that. 

1. The size of the directory.

   Oh!  You mean the length of the pathname!  Do that like this:

   print length("c:/windows/system/foo/bar/baz");


2. The size of the directory.

   Oh!  You mean the number of entries in the directory!  Do that like 
   this:

   opendir(D, "c:/windows/system/foo/bar/baz") || die;
   @junk=readdir D;
   closedir(D);
   print scalar(@junk);

3. The size of the directory.

   Oh!  You mean the... sum of the sizes.. of all of the... files in
   the directory.  But you said that's not what you want, so this can't 
   possibly be the right answer.  See answers #1 and #2.

But if your question is, "Is there a way to get the sum of the sizes of
files contained in a directory, without adding them up?" The answer is a
resounding no. Designing a filesystem where the directory entry contains
the sizes of the files stored within is silly. (That alone wouldn't rule
out Microsoft having done that, though...)

What's so hard about

	$path='c:/windows/system/foo/bar/baz';
	$sum=0;
	opendir(D, $path) || die;
	foreach(readdir D) {
		if (-f "$path/$_") {
			$sum+=(-s _);
		}
	}
	closedir(D);

anyway?  Yeah it's 1-stat() per file, but so what?




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

Date: Sat, 2 Oct 1999 12:41:38 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: I am having a problem setting cookies in perl
Message-Id: <7t5a9u$in4$1@plonk.apk.net>


Derek Lavine wrote in message ...
>but as soon as I do this
>
>  print << "__end__";
>Content-type: text/html
>Refresh: 1; URL=$ENV{ HTTP_REFERER }
>Set-Cookie: var1=this is var 1; $path
>Set-Cookie: var2=and this is var 2; $path
>__end__
>
>print "Location: my_html_page.html\n\n";
>
>
>the cookies no longer get set. This is driving me nuts. I must be doing
>something really dumb but I cannot see it.


Cookies must be set before you issue the Content-type!

Jody




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

Date: Sat, 2 Oct 1999 11:46:54 -0400
From: "Fred Reimer" <fwr@ga.prestige.net>
Subject: Re: Install CPAN module in ActiveState Windows version of Perl?
Message-Id: <FKpJ3.7977$t%3.687944@typ11.nn.bcandid.com>


Bill Moseley <moseley@best.com> wrote in message
news:MPG.125e7461e742433f9897ad@206.184.139.132...
> John P Walsh (walsh@averstar.com) seems to say...
> > If possible, I would like to be able to use a simple process to install
CPAN
> > modules into the ActiveState-Windows directory structure, and maintain
the
> > latest versions of these modules. From what I see posted on the net, I
need
> > to maintain both the ActiveState ppm software, and the set of
> > CPAN-installation modules normally used with non-ActiveState Perl.  Is
this
> > correct?
>
> You don't need ppm if you are using CPAN.  Well, you don't need either,
> but CPAN.pm makes it really easy.

Not if you're using ActiveState perl on Win32, as it's setup to use MS
Visual C, which most people are not going to want to purchase just to
compile CPAN modules.  ActiveState is good for what it comes with, but
inability to use cygwin or ming32 "out of the box" severely diminishes the
value of the product.

>
> > Jonathan Stowe <jns@gellyfish.com> says:
> > > If a module has no XS components then you might be able to install it
> > > if you obtain 'nmake' (microsofts make utility) which is available
from
> > > microsofts ftp server.
>
> Or get one of the free win32 ported make utilities that are around the
> net (Cygnwin and Ming32 are two).

Useless if you're using ActiveState...





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

Date: Sat, 02 Oct 1999 11:49:20 GMT
From: jduell@alumni.princeton.edu
Subject: Killing child processes on NT?
Message-Id: <7t4rfv$jof$1@nnrp1.deja.com>

I'm trying to write a test framework that lets users run a server
program, then startup a client program that tests the server. To run the
server process, users just write a little batch file called
"RunServerinBackground.bat", etc., and my framework runs the server in
the background for them, then executes (and waits for) the client(s),
capturing any errors.

I'd like to be able to stop the server after the clients have finished
running, but am having great troubles making this work on NT.  I can use
the Win32::Process module to start a process ("notepad.exe") and stop
it, but when a batch file is involved, I wind up killing only the
cmd.exe that interprets the batch file, and not the server that cmd.exe
spawned!

I'm considering a workaround for this that would make users name their
files "RunServerinBackgroundSpawn", etc., and if "spawn" is in the name
I'll have perl itself read the file and call Win32::Process->Create on
it.  But before resorting to such kludginess, I thought I'd ask the
world if there's any other way to accomplish what I'm trying to do. Any
way to make child processes on NT die when the parent dies? Any way to
find out a process's children, and then use some sort of kill()
lookalike to destroy them?

Sidenote: on my perl install (ActiveState 517) the
Win32::Console::GenerateCtrlEvent() function doesn't work at all (it
can't find the function _GenerateCtrlEvent in the DLL). Anyone gotten
this function to work?

Thanks,

Jason Duell


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


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

Date: Sat, 2 Oct 1999 06:32:20 -0700
From: moseley@best.com (Bill Moseley)
Subject: LWP questions and SSL, too
Message-Id: <MPG.125fa9425550227d9897bb@206.184.139.132>

[++$posted]

Howdy,

I have two LWP questions asked here, with additional details included 
below (please remove the extra details before responding).


1) I'm using LWP::UserAgent, which returns on https:// requests:

501 Can't locate object method "new" via package "LWP::Protocol::https"

What do I need to do to get https requests to work with LWP::UserAgent?
(see below for what I tried to install).


2) On LWP request to http://www.hawaii.net/ I get a 302 "moved" response 
with the Location header set as '/cgi-bin/hhp?'

In LWP::UserAgent it says:

  # And then we update the URL based on the Location:-header.
  my $referral_uri = $response->header('Location');
  {
      # Some servers erroneously return a relative URL for redirects,
      # so make it absolute if it not already is.

So I thought the Location would be converted into an absolute URL.  Do I 
need to set something in LWP to make it convert '/cgi-bin/hhp?' to an 
absolute URL?




My attempts at installing SSL support
-------------------------------------

I just tried to Install Net::SSL using CPAN.pm, but that failed with

In file included from SSLeay.xs:21:
crypt_ssleay_version.h:1: ssl.h: No such file or directory
crypt_ssleay_version.h:2: crypto.h: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `SSLeay.o'

So I then tried install Net::SSLeay and got:

I could not find your OpenSSL in `PREFIX=/home/cleita/perl_lib'
Please provide OpenSSL-0.9.3a installation directory (get from
 http://www.openssl.org/ if you don't have it; please note that
 SSLeay is no longer supported, see README)

And the readme didn't clear up my confusion.

Thanks,



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Sat, 2 Oct 1999 06:28:43 -0700
From: moseley@best.com (Bill Moseley)
Subject: Perl/CGI security
Message-Id: <MPG.125fa866102e6f3f9897ba@206.184.139.132>

I hope there are more good than bad around here.

If you write CGI apps with perl you might take a look at
  http://hispahack.ccc.de/en/mi019en.htm
and see what hackers attempt.  They hacked a site just because someone 
forgot to check the return value of rename().

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 2 Oct 1999 11:03:22 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl
Message-Id: <7t4opq$68g$1@gellyfish.btinternet.com>

On Sat, 2 Oct 1999 13:52:16 +0400 ii wrote:
> Народ, помогите.
> Я тут недавно начал писать на Perl и очень мне это язык понравился.
> Но так как приходится работать под NT (а что делать, нормальная операционка
> (в офисе)), то использую очень,по-моему, гарный редактор MultiEdit. Нород
> просьба если кто знает где взять дополнительные макросы или шаблоны к
> MultiEdit для Perl налейте URL или намыльте на адрес aleksei@boka.cmw.ru
> 

<http://www.perl.com/reference/query.cgi?editors>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Oct 1999 09:49:12 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perlcc compile problem?
Message-Id: <7t4keo$5h8$1@gellyfish.btinternet.com>

On Sat, 02 Oct 1999 08:17:44 GMT Jason Romo wrote:
> This is a multi-part message in MIME format.
> --------------33B7C904CCFFBB0EFD2D848F
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 

Dont do this.  this vCard crap has no meaning on Usenet and just annoys
people.

> I am trying to compile the DBI.pm DBD.pm and Socket.pm.
> 
> perlcc *.pm
> 
> I test them with the perl script.
> 
> I use the
> require 'module.so';
> 
> it fails with
> 
> Unrecognized character \177 at /usr/lib/perl5/5.00503/i386-linux/Socket.so
> line 1.
> 
> Any clues?
> 

Yes.  module.so is not a Perl module anymore is it - it is a dynamic library.

You cannot do that and I cant quite get my head round how you thought it
would work and why you wanted to do it ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 2 Oct 1999 11:02:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Ples Hep Me!  adding users to mysql is impossible!
Message-Id: <7t4ooj$68d$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Jeff Greer <jgreer@showmethenet.com> wrote:
> I thought making perl connect to mysql through DBI was hard to set up, but that
> is nothing compared to adding a new user to mysql.  I set up Apache, DBI, Perl,
> and DBD::mysql.  I can send and retrieve values to my database from web pages
> that call perl scripts, but I can't add a new user to mysql.  I can only access
> the database as root.
> 
> Can anybody please explain the steps in adding a new user to mysql.  I'll never
> figure this out from the manual.  In all respects I think the mysql manual is
> pretty good except in the area of users and access privileges.

However you might be accessing the MySQL database this is still not a Perl
question - there is a mailing list for discussing MySQL you should
subscribe to that and ask there.

There are also 'C' and Java interfaces to MySQL did you post to those
groups too ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 30 Sep 1999 17:20:41 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Runtime exception driving me crazy
Message-Id: <37f3980e.273717785@news.ford.com>

[poster cc'd in e-mail]

On Thu, 30 Sep 1999 12:11:09 -0400, "David Stiff" <dstiff@symantec.com>
wrote:
>Hi,
>
>I am migrating a Perl process from one machine to another. The new machine
>is a very high end dual Pentium system with 512 MB of RAM (clone machine).
>The Perl code has not changed but I am receiving a Runtime exception when
>comparing two arrays.

There's nothing here that would trigger a "runtime exception"--whatever
that is.  It doesn't sound like a Perl error at all. 

>The code looks like this:

Let's look at your code for a moment though.

>    local($refListA, $refListB) = @_;

What an odd combination.  You're using references (a Perl 5-ism) and local
(usually a Perl 4 holdover).  That just looks so...weird together.

> [rest of code deleted]

Why not express this all a little more concisely?  You want everything in
the first list, that's not in the second (case insensitively), returned?
OK, how about (comments added just for following along):

sub listdiff {
        my($arefa, $arefb)=@_;

        my(%tmphash);
	# Build a hash of all of the elements in the first array.
        foreach(@{$arefa}) { 
		# Not any data will do.  We need to store the element
		# because the original code returns the element
		# not-lc'd so we can't just get it out of the hash key...
		$tmphash{lc($_)}=$_;
	}
	# Pass the second array...
        foreach(@{$arefb}) {
		# Remove elements that already exist in the hash
		# from previously.  If they're not there--that's OK.
		delete $tmphash{lc($_)} 
	}
        return(values %tmphash);
}

No messy flags, only 1 temporary structure, and it's much more perlish.

This will run quite a bit faster, too.  (Its O(n) instead of O(n^2)).




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

Date: Sat, 2 Oct 1999 14:50:05 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Trouble w/ Regex in ActivePerl for Win32
Message-Id: <Pine.HPP.3.95a.991002144041.10022A-100000@hpplus01.cern.ch>

On Fri, 1 Oct 1999, Andrew Park stood Usenet on its head with:

> Actually, I already copy the file to a Unix machine using an NFS mount
> and then run dos2unix on it. 

Careful!

"DOS" (if you mean literally "DOS") stores text in a different 8-bit
coding than unix - in a Latin-1 situation this would be CP-850 instead
of iso-8859-1.  Therefore, a properly-constituted program for converting
DOS text files into unix text files would not only deal with the CR/LF
and CTRL/Z situation, it would also map the coding from (in this
instance) CP-850 to iso-8859-1.  And certainly some of the dos2unix
programs that I have met, do this as they should.  Whereas others failed
to do this.  When I originally encountered this problem, neither of them
mentioned this fact one way or the other in their user documentation!! 

Taking a quick look now on an adjacent machine at man dos2unix:

DESCRIPTION
     dos2unix converts characters in the DOS  extended  character
     set to the corresponding ISO standard characters.

That's interesting!  So _this_ one makes a feature of its character code
mapping, and its mention of fixing newline conventions is a throwaway
remark buried later in the text.

It's all rather confusing, really.


VB?  On comp.lang.perl.misc??  You're taking a risk, aren't you?  ;-}



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

Date: Sat, 02 Oct 1999 15:42:05 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Trouble w/ Regex in ActivePerl for Win32
Message-Id: <hJpJ3.21370$m4.80417266@news.magma.ca>

Andrew Park <apark@netcom.com> wrote in:
news:37F50CF5.27E52A83@netcom.com...
> Hi, I have a text file created on a Wintel PC w/ CR & LF embedded in
> them. I would like to strip out the CR and leave the LF to turn this
> into a Unix text file. Using ActivePerl build 519, I've tries all of
> the following
>
Try something like:
binmode(STDOUT); #without this, print() will revert EOL to CRLF
while(<>) {
  tr/\r//d;
  print;
}

(btw: even with VB it _is_ possible to write a file with LF as the line
terminator: open it in binary mode and use the Put statement to write
your data. LF is expressed as CHR(10))




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

Date: Sat, 2 Oct 1999 11:32:00 -0400
From: "Fred Reimer" <fwr@ga.prestige.net>
Subject: Re: Using SS Numbers as DBM Index: Best Way to Encrypt Them
Message-Id: <HwpJ3.7964$t%3.685393@typ11.nn.bcandid.com>


Abigail <abigail@delanet.com> wrote in message
news:slrn7v91ah.8i.abigail@alexandra.delanet.com...
> George Kuetemeyer (george.kuetemeyer@mail.tju.edu) wrote on MMCCXXI
> September MCMXCIII in <URL:news:37F38C5C.B0D60F72@mail.tju.edu>:
> // I need to create several DBM files based on feeds from various campus
> // systems. I want to use social security numbers as indices, but would
> // like to encrypt them for the sake of privacy. Since I want to use the
> // values as unique keys, the encryption method needs to return a unique
> // string for each ssn. I tried the crypt function (my $encrypted =
> // crypt($ssn, $salt) but it appears to disregard the 9th digit in the
ssn,
> // thereby returning the same value for ssn's where the first 8 digits are
> // the same. I don't  care about decryption, since there's no need to
> // retrieve an ssn from the encrypted value. That's why I looked at crypt
> // as a solution.
>
>
> Double the 9th digit and use that as the salt. Then throw away the
> first 2 characters of the result.

It's against several laws to require SSN's for this purpose.  If you're
never going to decrypt them, why use them at all?  I'd use a normal "serial"
number like most RDBM's provide.  Plus, perl has "drivers" for all the
common, and some not-so-common, RDBM's so there's no real reason not to use
them.  Plus, you would then be using a "standard" RDBM language like SQL
within your perl program instead of creating some proprietary work of your
own.  The program's future maintainers will thank you profusely if you'd use
something like PostgreSQL or MySQL or another "free" and "standard" RDBM.

Fred





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

Date: Thu, 30 Sep 1999 20:14:22 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: using tr?
Message-Id: <37f5c381.284840759@news.ford.com>

On 30 Sep 1999 14:23:58 -0500, abigail@delanet.com (Abigail) wrote:
>Uri Guttman (uri@sysarch.com) wrote on MMCCXXI September MCMXCIII in
><URL:news:x7ogekuwoa.fsf@home.sysarch.com>:
>() 
>() please select the next category and question.
>
>
>$400 in world capitals please.

Your question is:

	Name two multi-character "perlfunc" featured functions that appear
	as a portion of a World Capital name.




For example, if this were common Unix Shell commands "Muscat" and "Dublin"
would be correct answers.  ('cat' and 'du')

-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Sat, 02 Oct 1999 15:01:30 GMT
From: puma@mailandnews.com (Marc)
Subject: Re: Values of thousand
Message-Id: <7t3db4.3vseghf.0@pumamarcmailandnews.h3B0BFA44.invalid>

Christopher wrote in <37f53cc1.3845763@PersonalNews.de.uu.net>:

>- 125.000 or 12,900,000 for europe (point)
>

    	Er, not to nitpick too much, but isn't the European method more like

125 900 000,30  Not points used at all, and a coma for the decimal mark?

Marc


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

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


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