[8830] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2446 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 19:08:03 1998

Date: Tue, 28 Apr 98 16:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 28 Apr 1998     Volume: 8 Number: 2446

Today's topics:
    Re: a way to remove files? <lr@hpl.hp.com>
    Re: a way to remove files? (Andrew M. Langmead)
    Re: ANNOUNCE: Perl Builder IDE Now Available (Tom Mornini)
    Re: ANNOUNCE: Perl Builder IDE Now Available (Ilya Zakharevich)
    Re: ANNOUNCE: Perl Builder IDE Now Available (Andrew M. Langmead)
    Re: Auto-generate HTML Tables johnvv@earthling.net
        Can't upgrade that kind of scalar at d:\perl5_402\lib/p <smithr@lexma.meitech.com>
    Re: CGI help for a newbie (Jonathan Stowe)
    Re: Defending Perl (Ilya Zakharevich)
    Re: Getting the filehandle from a typeglob <fecund@fatnet.net>
    Re: Hello people, want to learn Perl ? <gurun@acc.umu.se>
    Re: help for beginer .. (Jonathan Stowe)
        How do I execute a program with Perl? mhannam@gardner-webb.edu
        How do I print one of each group occurance? <poohba@io.com>
    Re: How do I print one of each group occurance? <brianm@kodak.com>
    Re: How do I print one of each group occurance? <danboo@negia.net>
    Re: How do I print one of each group occurance? (brian d foy)
    Re: How to load the module with calculated name? (Tye McQueen)
    Re: http Reg Exp (Earl Hood)
        Is there a distance calculator scrip? <poohba@io.com>
        Matts Script Archive-WWWBoard-FrontPage-Suddenly Not Wo <bobc@jmross.com>
        Newbee build question <rmasse@cnri.reston.va.us>
    Re: Not crying when dying? <fecund@fatnet.net>
        ODBC access via Perl on UNIX box <sassoj@rpi.edu>
    Re: Perl Editor?? (Earl Hood)
    Re: Permutations in hashes make Perl hurt <steve.tolkin@fmr.com>
    Re: Permutations in hashes make Perl hurt (Earl Hood)
    Re: Permutations in hashes make Perl hurt (Ilya Zakharevich)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Apr 1998 14:15:41 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: a way to remove files?
Message-Id: <6i5gu0$76t@hplntx.hpl.hp.com>

Chad Peterson wrote in message
<01bd72dc$ea61ee20$86a72682@P1207393.MDC.COM>...
>Try unlink(FILEHANDLE)
>
> -- I'm positive it's documented in many places.
>
>shane michael harwood <sharwood@cs.uiowa.edu> wrote in article
><3546203F.41C6@cs.uiowa.edu>...
>> hello,
>> is there a way from within a perl script to remove files?


That won't work.  It's documented to delete a list of files *by name*.
And on DOS-based systems the file had better be closed before being
unlinked, or the system call will fail ("File being used by another
process..." or whatever).

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: Tue, 28 Apr 1998 22:26:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: a way to remove files?
Message-Id: <Es5ACI.K1q@world.std.com>

"Chad Peterson" <chad@NOSPAMumr.edu> writes:

>Try unlink(FILEHANDLE)

> -- I'm positive it's documented in many places.

Except that it is documented as "unlink LIST", where LIST is a list of
file names, not opened file handles.
-- 
Andrew Langmead


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

Date: Tue, 28 Apr 1998 20:14:21 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <tmorniniEs547x.93y@netcom.com>

Grinch (grinch@whoville.com) wrote:

: Tool tips, btw, are the little text messages that, in many apps, appear when
: you "hover" the mouse pointer for a second or two. Apple, as usual, insists
: on being different and calls them "Balloon Help." In this case, they display
: the value of the variable over which the pointer is hovering.

Oh, please! Apple has enough problems without this sort of misinformation.

Balloon help was System 7.0. Date - Early 90's?

Tool tips were Windows 95, or perhaps late days of 3.1

As usually, Apple was there first, and Microsoft insisted on being different.

-- Tom Mornini
-- InfoMania


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

Date: 28 Apr 1998 22:07:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5jun$fsf$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Phoenix 
<rootbeer@teleport.com>],
who wrote in article <Pine.GSO.3.96.980428104024.15049M-100000@user2.teleport.com>:

> Of course, there's no way to always get the colors correct unless you have
> an error-proof way of parsing Perl - which no one has yet invented. :-)

Hmm, did you check CPerl lately?  Of course, it will not parse
Randal's example with 

	 sin /foo/;

but I do not think anybody uses this construction ;-).

Ilya


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

Date: Tue, 28 Apr 1998 22:38:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <Es5AvL.4HE@world.std.com>

"Grinch" <grinch@whoville.com> writes:

>Tool tips, btw, are the little text messages that, in many apps, appear when
>you "hover" the mouse pointer for a second or two. Apple, as usual, insists
>on being different and calls them "Balloon Help." In this case, they display
>the value of the variable over which the pointer is hovering.

When they introduced them 6 or 7 years ago, nobody was calling them
"tool tips" either. I can't think of any other system that had them
floating and moving with the mouse curser, but on the other hand, they
are not much more different than what some people put on the status
line of terminals many years before.

-- 
Andrew Langmead


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

Date: Tue, 28 Apr 1998 16:52:30 -0600
From: johnvv@earthling.net
Subject: Re: Auto-generate HTML Tables
Message-Id: <6i5j2u$iqf$1@nnrp1.dejanews.com>



> I've come up with a very simple approach....
Nice..

> you feed my module an
> array of arrys, and it takes that and forms a table from it.  It's also
> expandable.

Actually this looks perfect, however...

Here is my test.
___________________________________________________________________________


use Table ;
$q = [ [ undef  , undef , undef , a , b , c ] , [ 1 , 2 , 3, 4 , 5 ] ] ;
$table = new Table;
$table->{content} = [ {contentstyle->['font color=white','i'],
                        style=>'bgcolor=blue border=5',
                        content=>['Name','Phone Number']
                        }
                        ];

push @{$table->{content}}, @{$q};
print $table->generate();

______________________________________________________________________________


This produced only:


<table >
        <tr >
        </tr>
        <tr>
                <td></td>
                <td></td>
                <td></td>
                <td>a</td>
                <td>b</td>
                <td>c</td>
        </tr>
        <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
        </tr>

</table>

W/O any table attributes.  How do you get it pretty'd up ??

Also, how would you implement HREFS in it ??

I would seriously consider going CPAN w/ it as well.

Thanks again in advance,  John van V.
















-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 28 Apr 1998 18:39:57 -0400
From: "Ray Smith" <smithr@lexma.meitech.com>
Subject: Can't upgrade that kind of scalar at d:\perl5_402\lib/perl5db.pl line 1131, <IN>
Message-Id: <6i5lpu$9q9$1@client3.news.psi.net>

 ...the story goes...I had a working perl script based around some Tk
widgets, e.g. Table, Frame, Text, Label.
I added a new area to my form.  The script appeared to work, and even
support the new code.  But I noticed a small problem which I decided to use
the debugger (-d) to track down.  However, when I ran under the debugger I
got the following problem which stops me in my tracks. Help! Please.

Thanks in advance for your attention,
Ray Smith
smithr@lexma.meitech.com

"OK" session followed by debug session:
s:/crs/r105to11[228] sdflog -e -lsdflog/slex0006.sdl
<==== Works just great (sorry no graphics display)
s:/crs/r105to11[229] . pdon
<==== Defines "$PERL_DEBUG" to "-d"

<==== wich is in exec perl .... line

<==== this is the only way I've found to turn on/off

<==== debugging of a script without editing it
s:/crs/r105to11[230] sdflog -e -lsdflog/slex0006.sdl
Loading DB routines from perl5db.pl version 1
Emacs support available.
Enter h or `h h' for help.
main::(m:/p267-006/tools/sdflog.ksh:20):
20:     eval 'exec perl $PERL_DEBUG -w -S ${0}.ksh ${1+"$@"}'
21:     if 0;
  DB<1> c
Can't upgrade that kind of scalar at d:\perl5_402\lib/perl5db.pl line 1131.
<==== Any ideas why ?
        Tk::Widget::AUTOLOAD('Tk::Frame=HASH(0xde2d54)', '-text', 'SDF
Log:') ca
lled at m:/p267-006/tools/SdfLogEd.pm line 541
        SdfLogEd::info_fixed('SDF Log:', 8, 'SLEX0006',
'Tk::Frame=HASH(0xde115c
)') called at m:/p267-006/tools/SdfLogEd.pm line 828
        SdfLogEd::load_form_info('SdfLog=SCALAR(0xdcfef8)') called at
m:/p267-00
6/tools/SdfLogEd.pm line 666
        SdfLogEd::load_form('SdfLog=SCALAR(0xdcfef8)') called at
m:/p267-006/too
ls/SdfLogEd.pm line 181
        SdfLogEd::edit_data_load('SdfLog=SCALAR(0xdcfef8)') called at
m:/p267-00
6/tools/SdfLogEd.pm line 79
        SdfLogEd::edit(undef, 'ARRAY(0xd2b7fc)') called at
m:/p267-006/tools/sdf
log.ksh line 442
        main::edit_log(undef, 'ARRAY(0xd2b7fc)') called at
m:/p267-006/tools/sdf
log.ksh line 287
DB::fake::(d:\perl5_402\lib/perl5db.pl:2084):
2084:     "Debugged program terminated.  Use `q' to quit or `R' to
restart.";
  DB<1>




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

Date: Tue, 28 Apr 1998 00:34:25 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: CGI help for a newbie
Message-Id: <35451766.12776049@news.btinternet.com>

On Tue, 28 Apr 1998 11:35:07 -0600, mcad999@geb.meteo.fr wrote :

>I am new to cgi scripting with perl.
Eh,oh
>I want my script to create a new file. But this generates
>an "Internal Server Error: The server encountered an internal error
>or misconfiguration and was unable to complete your request."
>
Your script has failed for some reason.  Examination of the servers
log file may reveal the cause.  Creating a new file may file because
of a permission problem for instance.  Some of these problems are
server related rather then Perl related.

You might want to use CGI::Carp module to get more informative error
messages (possibly in the browser).  
 
Alternatively you could you use this piece of code proposed by Larry
Rosler at the beginning of your script to capture errors to your
browser:

## death handler, presumes no output yet
$SIG{'__DIE__'} = $SIG{'__WARN__'} = sub {
  print "Content-type: text/plain\n\n", shift;
  exit 0;
};

>Anyone see anything that could help me ???
>

Without seeing some code its a bit tricky to comment any further.

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: 28 Apr 1998 22:02:29 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Defending Perl
Message-Id: <6i5jll$fdg$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6i58jn$68r$1@client3.news.psi.net>:
> I'm not denying Configure is useful. It is. It just makes installation
> more difficult.

Words, words, words...

Can you *explain* what your problem is/was?  I never need to do
anything harder than

	 ./Configure -des -D usethreads -D prefix=~/perllib
	 make
	 make test
	 make install

Ilya


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

Date: Tue, 28 Apr 1998 14:55:23 -0700
From: "yary h." <fecund@fatnet.net>
Subject: Re: Getting the filehandle from a typeglob
Message-Id: <3546504B.634F@fatnet.net>

OK, I have readable working code that satisfies all my nerosis.
Still, I want to understand what was happening under the hood of
one of my mis-solutions:

#perl -w 
use Socket;
use strict;


my $sockname="Socket0";

sub socket_to_me {
    my $sock = ++$sockname;
    socket(*sock, PF_INET, SOCK_STREAM, getprotobyname('tcp'))
	or die "Can't create socket: $!";;

    return ($sock, *sock{FILEHANDLE});
}

# use it
my ($n1,$s1) = socket_to_me;
my ($n2,$s2) = socket_to_me;

print "$n1 is $s1\n$n2 is $s2\n";

__END__


This produces
Socket1 is IO::Handle=IO(0x8daedc)
Socket2 is IO::Handle=IO(0x8daedc)

I was expecting two different IO handles.

My guess is that "my $sock" creates a single variable, so using
*sock{FILEHANDLE} will always return the same thing once it's
been created.  But doesn't "my" cause the variable to be created
and destroyed each time its scope was entered & exited?


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

Date: Wed, 29 Apr 1998 00:07:01 +0200
From: N i c l a s O l o f s s o n <gurun@acc.umu.se>
Subject: Re: Hello people, want to learn Perl ?
Message-Id: <35465305.249E5012@acc.umu.se>

Randal Schwartz wrote:
> You *definitely* don't want "first time perl people" hacking web
> scripts. You don't.  Trust me.

That's what I would call a friendly advise :)

Men beroende pe vad du dr ute och vilket system ni har (knappast c64:)
efter se kan du ju hvra av dig Mattias se kanske vi kan ordna net...

Cheers,
/Niclas


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

Date: Tue, 28 Apr 1998 00:34:29 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: help for beginer ..
Message-Id: <35451dd6.14368325@news.btinternet.com>

On Tue, 28 Apr 1998 14:26:26 +0200, Steve Hardy wrote :

>Hello,
>I'm a beginer I know how to create html tag but now I want to start
>creating forms on my inet page. I've seen a lot of pgm in CGI and Perl
>but I dont understand the difference.

CGI is an interface between an HTTP server and an external program
that may process input from an HTML form: Perl is a programming
language that is used by some people to write CGI programs.  However
any language that is able to process input and output in the manner
prescribed by the CGI specification can be used.

>Please give me advice on how I should procede to be able to create forms
>for my home page. Should I learn SGI or Perl ??? Where I could find the
>references...

You can have forms in your pages without any CGI:  You can type in the
appropriate HTML tags in an editor and away you go.

If you should choose to use Perl to develop CGI programs you will have
available to you a vast wealth of documentation: both free with your
Perl distribution and on the web and also in your bookstore.

A good first-stop for information on Perl is http://www.perl.com/ 

/J\
Jonathan Stowe
Some of your questions answered http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


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

Date: Tue, 28 Apr 1998 16:48:33 -0600
From: mhannam@gardner-webb.edu
Subject: How do I execute a program with Perl?
Message-Id: <6i5irh$ige$1@nnrp1.dejanews.com>

Hi.  How might one go about executing a program on a remote Win32 host with
Perl?  I want to use a Perl CGI script to call a small program that turns on
an LED light attached to a RS-232 connector.  Can it be done?  Do I need a
special module?  Thanks for any help you can offer.  Matt

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 28 Apr 1998 10:02:24 -0500
From: Chocolate <poohba@io.com>
Subject: How do I print one of each group occurance?
Message-Id: <Pine.BSI.3.96.980428095453.15004B-100000@pentagon.io.com>

I have this flat text file that has information like this
catagory::title::name::site
on each line.  How do I print out the catagories without duplicating them?
Example.
Sports::Basketball::NBA::www.nba.com
Sports::Basketball::NCAA::www.ncaa.org
Sprots::Basketball::WNBA::www.wnba.com
Cars::Pricing::Auto Mall::www.automall.com
Cars::Shoping::Car Max::www.carmax.com
Computers::Shoping::Dell::www.dell.com
Computers::Shoping::Compaq::www.compac.com

How would I print just the first time it is found?  When I do a foreach I
get:
Sports
Sports
Sports
Cars
Cars
Computers
Computers

How would I get:
Sports
Cars
Computers
?
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

			_/_/_/		     _/     _/
		       _/  _/	            _/     _/		
  Web Page Designs    _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ 
    Small Programs   _/     _/   / _/  _/ _/  _/ _/  _/ _/  _/  poohba@io.com
www.io.com/~poohba  _/	   _/_/_/ _/_/_/ _/  _/ _/_/_/ _/_/\_ 	(919)506-5883

  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



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

Date: Tue, 28 Apr 1998 17:50:04 -0400
From: Brian Mathis <brianm@kodak.com>
To: Chocolate <poohba@io.com>
Subject: Re: How do I print one of each group occurance?
Message-Id: <35464F0C.A67A3C2F@kodak.com>

Chocolate wrote:
> 
> I have this flat text file that has information like this
> catagory::title::name::site
> on each line.  How do I print out the catagories without duplicating them?
[...]
> How would I get:
> Sports
> Cars
> Computers
> ?


Take each item and reduce it, by throwing it into a hash.  something
like this:

foreach $category ( @list ) {
    $temphash{$category}++;
}

print join("\n", keys(%temphash));



Brian Mathis


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

Date: Tue, 28 Apr 1998 18:35:08 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: How do I print one of each group occurance?
Message-Id: <3546599C.4ABAC959@negia.net>

Chocolate wrote:
> 
> I have this flat text file that has information like this
> catagory::title::name::site
> on each line.  How do I print out the catagories without duplicating them?

well you could use this "look-ma-no-variables" approach (it even sorts):

print map { "$_\n" } sort keys %{{ map { split '::', $_, 2 } <DATA> }};
__END__
Sports::Basketball::NBA::www.nba.com
Sports::Basketball::NCAA::www.ncaa.org
Sprots::Basketball::WNBA::www.wnba.com
Cars::Pricing::Auto Mall::www.automall.com
Cars::Shoping::Car Max::www.carmax.com
Computers::Shoping::Dell::www.dell.com
Computers::Shoping::Compaq::www.compac.com

or if you'd like a more practical approach (assuming same DATA):

while (<DATA>) {
  $cat = (split '::')[0];
  $cats{$cat} || print "$cat\n";
  $cats{$cat}++;
}

notice that the key similarity is the usage of hashes to throw out the
dupes. standard perl procedure.

cheers,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Tue, 28 Apr 1998 18:48:37 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How do I print one of each group occurance?
Message-Id: <comdog-ya02408000R2804981848370001@news.panix.com>
Keywords: from just another new york perl hacker

In article <Pine.BSI.3.96.980428095453.15004B-100000@pentagon.io.com>, Chocolate <poohba@io.com> posted:

>I have this flat text file that has information like this
>catagory::title::name::site
>on each line.  How do I print out the catagories without duplicating them?
>Example.
>Sports::Basketball::NBA::www.nba.com
>Sports::Basketball::NCAA::www.ncaa.org
>Sprots::Basketball::WNBA::www.wnba.com
>Cars::Pricing::Auto Mall::www.automall.com
>Cars::Shoping::Car Max::www.carmax.com
>Computers::Shoping::Dell::www.dell.com
>Computers::Shoping::Compaq::www.compac.com

there are all sorts of ways to do such a thing.

   foreach my $category (@categories)
      {
      print "$category\n" unless exists $already_printed{$category};
      $already_printed{$category}++;
      }

you might also check the perl FAQ for the answer to finding the 
unique elements of a list.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 28 Apr 1998 16:14:46 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: How to load the module with calculated name?
Message-Id: <6i5gs6$m8e@fohnix.metronet.com>

prikryl@dcse.fee.vutbr.cz (Petr Prikryl) writes:
) >:Please, how can I load the module when its  name was calculated (read
) >:from the input text file into a variable). The module is placed in
) >:the subdirectory which was also calculated (it is not in @INC).
) >:
) >:My solution up to now is:
) >:
) >:    require "$directory/$module.pm";
) >:    eval "$module\::function()";
) >:
) >:[...] I do "use strict" and I want to keep the strict mode.

The script:

    #!/usr/bin/perl
    use strict;

    use vars qw( $pack $module );

    $pack= "Term::ReadLine";
    ( $module= $pack . ".pm" ) =~ s#::#/#g;

    require $module;

    print $pack->new("Simple Perl calc");

Produces:

    Term::ReadLine::Stub=ARRAY(0x7cb77c)

for me with no warnings.  I think that is close to what you are
looking for.
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 28 Apr 1998 21:19:15 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: http Reg Exp
Message-Id: <6i5h4k$8t1@news.service.uci.edu>

In article <354346F0.CCC9CA0@cglis.com>,
Chris Lambrou  <perl.misc@cglis.com> wrote:

>$msg =~ s!(ftp|https?)://([^\s]+)!<a href="$1://$2">$1://$2<\/a>!gsi;
>
>90% this works. The problem is that the above will match text that
>starts with
>ftp/http/https followed by :// up to the next white space character,
>so this breaks down if the URL is followed by a non word character such
>as comma,  a ">" or something else.
>
>Any ideas how to fix it?

Here's something that I use (derived from a mail->HTML program):

    $Url    = '(?:http://|https://|ftp://|afs://|wais://|telnet://|ldap://' .
	       '|gopher://|news:|nntp:|mid:|cid:|mailto:|prospero:)';
    $UrlExp = $Url . q%[^\s\(\)\|<>"']*[^\.;,"'\|\[\]\(\)\s<>]%;

    # .....
 
    $msg =~ s@($UrlExp)@<A HREF="$1">$1</A>@gio;


Before going off reinventing the wheel, you should search around
to what has already be done.  See
<URL:http://www.oac.uci.edu/indv/ehood/mhonarc.html> for a Perl
program that can convert mail to HTML and check CPAN for all
that mail related modules.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 28 Apr 1998 09:54:42 -0500
From: Chocolate <poohba@io.com>
Subject: Is there a distance calculator scrip?
Message-Id: <Pine.BSI.3.96.980428095309.15004A-100000@pentagon.io.com>

I am trying to fond a distance calculator script.  Does anyone know of
any?  I would like to calculate the distance between one city and another
or one zip code and another.  How would I do that?

  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

			_/_/_/		     _/     _/
		       _/  _/	            _/     _/		
  Web Page Designs    _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ 
    Small Programs   _/     _/   / _/  _/ _/  _/ _/  _/ _/  _/  poohba@io.com
www.io.com/~poohba  _/	   _/_/_/ _/_/_/ _/  _/ _/_/_/ _/_/\_ 	(919)506-5883

  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



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

Date: Tue, 28 Apr 1998 17:53:13 -0500
From: "Bob Confer" <bobc@jmross.com>
Subject: Matts Script Archive-WWWBoard-FrontPage-Suddenly Not Working
Message-Id: <6i5mvc$drs$1@news1.i1.net>

I have been running the wwwboard script from Matt's Script Archive for
sometime now through my ISP on a Unix server.  I have made some basic
formatting changes to the look of it, etc. but nothing more as I do not know
a lot about CGI.  Anyway, I recently purchased FrontPage and decided to
start using it to publish my web pages.  When I contacted my ISP, they
advised me that they had to move my account to a different Unix server which
supported the FrontPage extensions, and they did.

I've since transferred all of my files to the new server and everything
appeared to be working correctly, but I was mistaken.  When you click on the
post button to make an entry, it writes it to the wwwboard.html file so that
all postings are viewable.  Each of these postings has a link to another
individual html file that the script creates to hold more details.  Well,
I've found that since my account has been moved to the new server, all of
the individual html files that are supposed to be written by the script are
not being written.  On the wwwboard.html page it lists all of the various
postings, but each of them are referencing the same html file (where before
they were automatically numbered <i.e. 1.html 2.html 3.html, etc> by the
script).

I called the ISP and they informed me the the Perl location had changed from
/usr/local/bin/perl to /usr/bin/perl.  I've changed the top line on all of
the .pl files to reflect this but it is still not working.  Does this have
something to do with FrontPage?  Or is there something that I'm overlooking?

You can view what I'm talking about by going to
www.jmross.com/wwwboard/wwwboard.html and you'll see my test postings.  If
you hold your mouse over the hyperlink area you'll see that each of the
postings are referencing the same htm file where they should have been
assigned their own during the time of posting.

Any help you can give me is GREATLY appreciated.  I've been trying to figure
this out for 2 days now and don't know where else to turn.

Bob Confer
bobc@jmross.com




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

Date: 28 Apr 1998 17:00:55 -0400
From: Roger Masse <rmasse@cnri.reston.va.us>
Subject: Newbee build question
Message-Id: <64u37dek54.fsf@nobot.CNRI.Reston.Va.US>


My system is sparc solaris 2.6, my compiler is gcc 2.8.1, the version I'm trying to build
is perl5.004_04. From the README, I've run the following commands (taking all the defaults
except compiler=gcc.  The make seems to fail to find some files...  Can anyone advise?  Thanks!

        rm -f config.sh
        sh Configure
        make

  -- stuff deleted --

make[1]: Leaving directory `/var/local/src/perl5.004_04/ext/Fcntl'

        Making IO (dynamic)
Can't locate ExtUtils/Liblist.pm in @INC (@INC contains: ../../lib /usr/local/lib/perl5/sun4-solaris/5.00404 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/sun4-solaris /usr/local/lib/perl5/site_perl .) at (eval 15) line 3.
Warning: No Makefile!
make[1]: Entering directory `/var/local/src/perl5.004_04/ext/IO'
make[1]: *** No rule to make target `config'.  Stop.

-- 

Regards,

	Roger E. Masse, Systems Engineer
	Corporation for National Research Initiatives
	1895 Preston White Drive, Suite 100
	Reston, Virginia, USA  20191
	rmasse@CNRI.Reston.VA.US 

	To find out why Python rules,
	see: <http://www.python.org/>


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

Date: Tue, 28 Apr 1998 14:15:42 -0700
From: "yary h." <fecund@fatnet.net>
Subject: Re: Not crying when dying?
Message-Id: <354646FE.7B84@fatnet.net>

eval "require '$dir/$task.pm'" or
  die "Unsuccessful require '$dir/$task.pm: $@"

should be

eval "require '$dir/$task.pm'; die \$@ if \$@";
die "Unsuccessful require '$dir/$task.pm: $@" if $@;


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

Date: Tue, 28 Apr 1998 18:08:17 -0700
From: John Sasso <sassoj@rpi.edu>
Subject: ODBC access via Perl on UNIX box
Message-Id: <35467D80.130DA052@rpi.edu>

We developed an Access database under Windows95 & NT that stores
information
on the workstations on our LAN, and we'd like to be able to make queries
of the database
as well as writes to it from a UNIX platform.  We have Perl 5.004
running under HP-UX 10.20.

I understand that there's a Win32::ODBC module, but has there been one
ported over to UNIX?
Any helpful suggestions on developing a client/server app. under UNIX to
access an Access db
on a remote Windows 95/NT machine?

-- john



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

Date: 28 Apr 1998 21:27:54 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Perl Editor??
Message-Id: <6i5hkq$95p@news.service.uci.edu>

In article <6i5e04$jtg$3@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    Ala Qumsieh <aqumsieh@matrox.com> writes:
>:Does anybody know of any good Perl editors on unix platform? 
>
>vi; specifically, nvi.

Vim is good.  It can be built to contain a Perl interface
(along with the regular support for Perl source syntax highlighting).
I have not used vim that much since I have been content with
plain 'ol vi for years.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 28 Apr 1998 17:12:09 -0400
From: Steven Tolkin <steve.tolkin@fmr.com>
To: steve.tolkin@fmr.com
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <35464629.E8A68FB@fmr.com>

Bob Jenkins has posted free code, in C,
for a hash function that does a very good job of
preventing collisions and running fast
It uses bit vector operations.
I have performed a few simple tests of this against the much simpler Perl code
(in C, with the length computation not included in the elapsed time)
and his code was sometimes faster and never more than 5% slower.

Have there been any thoughts of changing perl to use something like this?
If strings are aligned (and I suspect they are in Perl
due to the use of unions) then
he presents a similar but much faster approach that use integer hashing
for all but the last few bytes.

For all details see
http://ourworld.compuserve.com/homepages/bob_jenkins/hashtab.htm
Below are excerpts.

/*
--------------------------------------------------------------------
lookupa.c, by Bob Jenkins, December 1996.  Same as lookup2.c
You may use this code in any way you wish.  It has no warranty.
Source is http://ourworld.compuserve.com/homepages/bob_jenkins/lookupa.c
 ...
mix -- mix 3 32-bit values reversibly.
 ...
mix() takes 36 machine instructions, but only 18 cycles on a superscalar
  machine (like a Pentium or a Sparc).  No faster mixer seems to work,
  that's the result of my brute-force search.  There were about 2^^68
  hashes to choose from.  I only tested about a billion of those.
--------------------------------------------------------------------
*/
#define mix(a,b,c) \
{ \
  a -= b; a -= c; a ^= (c>>13); \
  b -= c; b -= a; b ^= (a<<8); \
  c -= a; c -= b; c ^= (b>>13); \
  a -= b; a -= c; a ^= (c>>12);  \
  b -= c; b -= a; b ^= (a<<16); \
  c -= a; c -= b; c ^= (b>>5); \
  a -= b; a -= c; a ^= (c>>3);  \
  b -= c; b -= a; b ^= (a<<10); \
  c -= a; c -= b; c ^= (b>>15); \
}

/*
--------------------------------------------------------------------
lookup() -- hash a variable-length key into a 32-bit value
  k     : the key (the unaligned variable-length array of bytes)
  len   : the length of the key, counting by bytes
  level : can be any 4-byte value
Returns a 32-bit value.  Every bit of the key affects every bit of
the return value.  Every 1-bit and 2-bit delta achieves avalanche.
About 6len+35 instructions.

The best hash table sizes are powers of 2.  There is no need to do
mod a prime (mod is sooo slow!).  If you need less than 32 bits,
use a bitmask.  For example, if you need only 10 bits, do
  h = (h & hashmask(10));
In which case, the hash table should have hashsize(10) elements.

If you are hashing n strings (ub1 **)k, do it like this:
  for (i=0, h=0; i<n; ++i) h = lookup( k[i], len[i], h);

By Bob Jenkins, 1996.  74512.261@compuserve.com.  You may use this
code any way you wish, private, educational, or commercial.

See http://ourworld.compuserve.com/homepages/bob_jenkins/evahash.htm
Use for hash table lookup, or anything where one collision in 2^32 is
acceptable.  Do NOT use for cryptographic purposes.
--------------------------------------------------------------------
*/

ub4 lookup( k, length, level)
register ub1 *k;        /* the key */
register ub4  length;   /* the length of the key */
register ub4  level;    /* the previous hash, or an arbitrary value */
{
   register ub4 a,b,c,len;

   /* Set up the internal state */
   len = length;
   a = b = 0x9e3779b9;  /* the golden ratio; an arbitrary value */
   c = level;           /* the previous hash value */

   /*---------------------------------------- handle most of the key */
   while (len >= 12)
   {
      a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24));
      b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24));
      c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24));
      mix(a,b,c);
      k += 12; len -= 12;
   }

   /*------------------------------------- handle the last 11 bytes */
   c += length;
   switch(len)              /* all the case statements fall through */
   {
   case 11: c+=((ub4)k[10]<<24);
   case 10: c+=((ub4)k[9]<<16);
   case 9 : c+=((ub4)k[8]<<8);
      /* the first byte of c is reserved for the length */
   case 8 : b+=((ub4)k[7]<<24);
   case 7 : b+=((ub4)k[6]<<16);
   case 6 : b+=((ub4)k[5]<<8);
   case 5 : b+=k[4];
   case 4 : a+=((ub4)k[3]<<24);
   case 3 : a+=((ub4)k[2]<<16);
   case 2 : a+=((ub4)k[1]<<8);
   case 1 : a+=k[0];
     /* case 0: nothing left to add */
   }
   mix(a,b,c);
   /*-------------------------------------------- report the result */
   return c;
}

/*
--------------------------------------------------------------------
mixc -- mixc 8 4-bit values as quickly and thoroughly as possible.
Repeating mix() three times achieves avalanche.
Repeating mix() four times eliminates all funnels and all
  characteristics stronger than 2^{-11}.
--------------------------------------------------------------------
*/
#define mixc(a,b,c,d,e,f,g,h) \
{ \
   a^=b<<11; d+=a; b+=c; \
   b^=c>>2;  e+=b; c+=d; \
   c^=d<<8;  f+=c; d+=e; \
   d^=e>>16; g+=d; e+=f; \
   e^=f<<10; h+=e; f+=g; \
   f^=g>>4;  a+=f; g+=h; \
   g^=h<<8;  b+=g; h+=a; \
   h^=a>>9;  c+=h; a+=b; \
}

Tom Rokicki wrote:

> If the keys of a hash are permutations of a string (or, if the length
> of the string plus the sum of the characters in the string is a
> constant across the keys of a hash) then Perl essentially uses a
> single linked list (only one bucket is filled) as the attached code
> shows; run it and watch Perl go quadratic!

> ...

--
Hopefully helpfully yours,
Steve
---
Steven Tolkin          steve.tolkin@fmr.com      617-563-0516
Fidelity Investments   82 Devonshire St. R27C    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me,
not Fidelity Investments, its subsidiaries or affiliates.




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

Date: 28 Apr 1998 21:36:46 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i5i5e$9es@news.service.uci.edu>

In article <35464629.E8A68FB@fmr.com>,
Steven Tolkin  <steve.tolkin@fmr.com> wrote:
>Bob Jenkins has posted free code, in C,
>for a hash function that does a very good job of
>preventing collisions and running fast
>It uses bit vector operations.
>I have performed a few simple tests of this against the much simpler Perl code
>(in C, with the length computation not included in the elapsed time)
>and his code was sometimes faster and never more than 5% slower.

I've utilized Bob's code a couple years back (to create a Hash class in
C++).  The only time I got collisions is when I had to mask the key
down to fit the size of the table.

I always thought Perl used a similiar (if not better) algorithm
for hashing.  If not, I also concur that the Perl developers
should take a look at it.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: 28 Apr 1998 21:56:45 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i5jat$ee2$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Rokicki
<rokicki@cello.hpl.hp.com>],
who wrote in article <6i3qq2$k58@cello.hpl.hp.com>:
> If the keys of a hash are permutations of a string (or, if the length
> of the string plus the sum of the characters in the string is a
> constant across the keys of a hash) then Perl essentially uses a
> single linked list (only one bucket is filled) as the attached code
> shows; run it and watch Perl go quadratic!

This is one of the faces of the fact that the number 33 which appears
in the hash algorithm is *the worst possible number* I know (if you
forget about 1 ;-).  Putting 37 there would make it infinitely better
for this case, for hashing integers, and probably in many other cases.

I do not have my Knuth at hand, is there *any* reason why 33 was taken?

Ilya


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2446
**************************************

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