[6521] in Perl-Users-Digest
Perl-Users Digest, Issue: 146 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 19 19:11:06 1997
Date: Wed, 19 Mar 97 16:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 19 Mar 1997 Volume: 8 Number: 146
Today's topics:
Re: Am I on the console? (John Horne)
Re: Can't open file <pagib@aur.alcatel.com>
Comparing elements of two complex data structures <gtk@walsh2.med.harvard.edu>
HELP!! (Manik Ahuja)
Re: HELP!! (Tim Gim Yee)
Need as MUCH assistance as possible. <shauns@corel.com>
Re: Need to extract the text from Microsoft Word 6 file <rootbeer@teleport.com>
Non-Blocking sockets w/o SIG's ?? (Steve Hindle)
Re: overloading operators? (Jim Showalter)
Parser with state support??? <keesh@cs.cmu.edu>
Re: Parsing html tag attributes & values in Perl (Dan Sumption)
Re: Parsing html tag attributes & values in Perl (Dan Sumption)
Re: Parsing html tag attributes & values in Perl (Dan Sumption)
Re: Perl Compiler <pagib@aur.alcatel.com>
perlcall: Segmentation error on PUSHMARK(sp) (Kofi D Fynn)
Re: Problems with flock() <rootbeer@teleport.com>
Re: Reporting Win32 Perl Bugs (Scott Phelps)
Re: Repost: Cookie question (Don't Spam, it's Wrong!)
Shadowing modules (Mark J Hewitt)
Re: SORTING ... one more Q <merlyn@stonehenge.com>
Stock Ticker w/intraday graphs <kf@lanminds.com>
Suidperl! <vapi@student.dei.uc.pt>
Re: text to HTML (Leslie Mikesell)
Re: Wanted: name parser (Tad McClellan)
win95 perl 5 (paul Spitalny)
Re: win95 perl 5 (Simon Hyde)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Mar 1997 15:35:09 GMT
From: J.Horne@plymouth.ac.uk (John Horne)
Subject: Re: Am I on the console?
Message-Id: <5gp13d$c5@palantir.pbs.plym.ac.uk>
In article <5goked$fv@palantir.pbs.plym.ac.uk>, J.Horne@plymouth.ac.uk (John Horne) says:
>
>I am trying to write a Perl program to be used on our Sun systems from
>the workstation console and remote PC's running X-window (don't ask
>why!). However I need to know if the program is initiated from the
>console or not. So the problem is is there an easy way of determining
>if I am at the console? I'm not sure if this is more of a Sun or Unix
>question, but I can't seem to figure it out and I would have thought
>it was easy enough :-) I'm using solaris 2.5.1 and Perl 5.003.
>
Okay forget about the above! Due to a severe lack of grip on reality I
forgot (!) that I could just as easily check on the DISPLAY variable for
X-window, and use the 'tty' command if the user is not using the X-window
system. Apologies for the nonsense :-)
John.
------------------------------
Date: Wed, 19 Mar 1997 14:01:06 -0500
From: Bruno Pagis <pagib@aur.alcatel.com>
Subject: Re: Can't open file
Message-Id: <333037F2.2BEB@aur.alcatel.com>
> open (FILE, $database_location) || print "can't open sodding file";
$database_location is not defined ! Shouldn't it be $database_filename ?
--
-----------------------------------------------------------
Bruno Pagis, ALCATEL Network Systems
__ 2912 Wake Forest road RALEIGH, NC 27609
ALC\/TEL Phone: (919) 850-5174 Fax : (919) 850-6670
Email: bruno_pagis@aur.alcatel.com
http://aurwww.aur.alcatel.com/~pagib
-----------------------------------------------------------
------------------------------
Date: 19 Mar 1997 15:16:44 -0500
From: Gregory Tucker-Kellogg <gtk@walsh2.med.harvard.edu>
Subject: Comparing elements of two complex data structures
Message-Id: <w2bu8fwsb7.fsf@walsh2.med.harvard.edu>
Keywords: map, reference,
I have two hashes that I want to compare by an internal comparison of
their elements. Each is a hash of "Peaks", where the Peak constructor
looks like this:
sub new {
my $class = shift;
my $self = {
POS => [],
ATOM => [],
};
return bless $self,$class;
}
Here is a comparison I wrote of two hashes of Peaks, one of
two-dimensional peaks (%spec2d), one of three-dimensional peaks
(spec3d). I've tried to include just, but all of, the code necessary
to make it clear what I am doing. The dimensionality is reflected in
the lengths of the arrays referenced by POS and ATOM above. The
corresponding dimensions of different spectra are identified by the
DimNames function, which returns a list of dimesnion names.
The comparison is quite slow, and I'd like to speed it up.
@nam2d = $spec2d->DimNames(); # The names of both dimensions
@dim2d = $spec2d->DimNums(@nam2d); # (0,1)
@dim3d = $spec3d->DimNums(@nam2d); # ID the two dimensions of the
# 3D spectrum that correspond
# to the 2D spectrum
foreach $num (sort {$a <=> $b } keys %spec2d) {
$peak2d = $spec2d{$num};
print "--------------------------------------------------------------\n";
printf ("%-15s Peak %-4d %8s = %8.2f %8s = %8.2f\n\n",
"2D Spec",$num,$nam2d[0],$peak2d->{POS}[0],
$nam2d[1],$peak2d->{POS}[1])
my @pos = ();
my @diff = ();
foreach $peak3d (values %spec3d) {
for $i (0,1) {
if ($peak3d{ATOM}[$dim3d[$i]] == $peak2d{ATOM}[$dim2d[$i]]) {
push ( @{ $pos[$i] } ,$peak3d{POS}[$dim3d[$i]]);
push ( @{ $diff[$i] } ,$peak3d{POS}[$dim3d[$i]]
-$peak2d{POS}[$dim2d[$i]]);
}
}
}
for $i (0,1) {
my ($mean,$dev) = StdDev(@{$pos[$i]});
printf ("%-10s % 6d %6.2f % 5.2f %5.3f\n",
$nam2d[$i],scalar @{$pos[$i]},$mean,Mean(@{$diff[$i]}),$dev);
}
}
Is there some aspect of my data structure usage that is making this
comparison slow? I can speed it up 2-3x by using a temporary hash of
the relevant dimensions of the 3D structure, like:
while (($num,$peak) = each %spec3d) {
$Peak3D{$num}{$peak{ATOM}[$dim3d[0]]} = $peak{POS}[$dim3d[0]];
$Peak3D{$num}{$peak{ATOM}[$dim3d[1]]} = $peak{POS}[$dim3d[1]];
}
and then changing the inner foreach loop above to:
while (($key,$peak)= each %Peak3D) {
for $i (0,1) {
if ($peak->{$peak2d{ATOM}[$i]}) {
push ( @{ $pos[$i] } ,$peak->{$peak2d{ATOM}[$i]});
push ( @{ $diff[$i] } ,$peak->{$peak2d{ATOM}[$i]}-$peak2d{POS}[$i]);
}
}
}
Is there another way to speed this up?
TIA,
Greg
--
Gregory Tucker-Kellogg
Department of Biological Chemistry and Molecular Pharmacology
Harvard Medical School, Boston MA 02115
"Mojo Dobro" Finger for PGP info
------------------------------
Date: 19 Mar 97 19:50:19 GMT
From: ahuja@wilde.oit.umass.edu (Manik Ahuja)
Subject: HELP!!
Message-Id: <3330437b.0@news.oit.umass.edu>
My server does not allow me to run CGI, but I would like to test my
guestbook.pl file to see if it does work. Is there anyway I can run a perl
script (guestbook) just to see if it works? because when it is up and
running
properly it will be permitted to run on the system, but in the meantime i
need
to test it out before i can show the sys admin.
1) Can I test this without having an active CGI server?
2) If not is there a server I can possibly get an account on (through
telnet not dialup) in which i can have CGI-bin running?>
Thanks
------------------------------
Date: Wed, 19 Mar 1997 14:19:35 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: HELP!!
Message-Id: <332ff33d.14661602@news.oz.net>
On 19 Mar 97 19:50:19 GMT, ahuja@wilde.oit.umass.edu (Manik Ahuja)
wrote:
What? Are you on fire?? Your subject line is misleading.
>My server does not allow me to run CGI, but I would like to test my
>guestbook.pl file to see if it does work.
[snip]
>1) Can I test this without having an active CGI server?
Yes. You can debug your script using CGI.pm, available at
http://perl.com/perl/wwwman/CGI/CGI.html
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: Wed, 19 Mar 1997 18:22:15 -0500
From: "Shaun St. Louis" <shauns@corel.com>
Subject: Need as MUCH assistance as possible.
Message-Id: <33307527.21E@corel.com>
I've just begun the trek into Perl land and I'm using an NT Server and
Win95 Server. I have downloaded the Perl Interpreter (I found in
another message in this forum) and ran the Install.bat file. It
produced a PERL5 directory under my Website directory and also made a
\PERL5\BIN directory with an EXE and few more too.
How would I now execute these or any other Perl scripts?
Is this done from a command line (DOS Prompt?)? How? Where do you go
to execute the script? Can it also be done through my Netscape browser
once the Website server is launched? How.
I'm sure this has been answered, reanswered etc... but it's my first
time in this forum and I haven't been able to find any other answers.
Since I work at Corel Corp. you can either send me email via my work
account or home account
shauns@sympatico.ca
shauns@corel.com
I've tried to find this info on the net and haven't been successful...I
need steps (exact steps) not pages and pages of stuff with no specifics.
Anybody who can help is a saint.
------------------------------
Date: Wed, 19 Mar 1997 15:18:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Clutterbuck <John.Clutterbuck@sbs.siemens.co.uk>
Subject: Re: Need to extract the text from Microsoft Word 6 files
Message-Id: <Pine.GSO.3.95q.970319151732.17596C-100000@kelly.teleport.com>
On Wed, 19 Mar 1997, John Clutterbuck wrote:
> Subject: Need to extract the text from Microsoft Word 6 files
If somebody has a module which does this in Perl, it should be on CPAN. If
it's not, you're welcome to make and submit one. Thanks!
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 19 Mar 1997 23:27:42 GMT
From: shindle@mail.goodnet.com (Steve Hindle)
Subject: Non-Blocking sockets w/o SIG's ??
Message-Id: <5gpspe$1o64$1@news.goodnet.com>
Keywords: Perl sockets signals
Hi all,
I am having a problem with non-blocking sockets. The process accepts a
number of connections and I would like to be able to use them without
having to SELECT etc. So far the code reads and writes data fine, but it
doesnt notice dis-connects ?? READ never seems to report the socket is
no longer connected ?? I then tried using getsockopt SO_ERROR before the
read, but that doesnt do it either and causes a wierd run-time error. I
have tried the following code but I get a very unexpected error from perl
at run-time:
if ( defined( $socket[$i]) ){
$fd = $socket[$i];
$buffer = getsockopt( $fd, SOL_SOCKET, SO_ERROR);
if (!defined($buffer)) {
print "getsockopt:$!\n";
}
if ($buffer eq "") { $buffer = 0; }
=> # Next line gives: Argument "" isn't numeric in ne at Reader.pm line 102
=> if ($buffer != 0 ) {
print "Buffer:$buffer\n";
}
if ( read( $fd, $buffer, 999) ) {
if ($!) { print "hmm..error:$!\n"; }
else {
&process_data($i,$buffer,$now);
#Do timeout processing for the port..
# &timeout...
}
}
else {
my $k = 0;
$k = $! + 0;
print "Read returned( $k): $!\n" unless ($k == 0);
}
}
------------------------------
Date: Wed, 19 Mar 1997 17:02:09 -0500 (EST)
From: gamma@iern.disa.mil (Jim Showalter)
Subject: Re: overloading operators?
Message-Id: <Pine.GSO.3.95.970319165112.24809A-100000@mintaka.iern.disa.mil>
On Wed, 19 Mar 1997, Phil Sallee wrote:
> Does anyone know of a way to overload operators in Perl? Other
> object oriented languages such as C++ or Ada allow you to do this,
> but I haven't found a way to do this in Perl yet. How do you allow
> objects to be manipulated using standard operators?
>
> Is this a feature that might be added in a future release of
> Perl maybe??
>
>
> Phil Sallee
> phil@irvine.com
>
>
> ------------------------------
>
Perl offers that capability now. It is documentated in the
Camel Book 2nd Edition, Programming Perl. Pages 463-469.
Jim
------------------------------
Date: Wed, 19 Mar 1997 16:15:24 -0500
From: Eric Kischell <keesh@cs.cmu.edu>
Subject: Parser with state support???
Message-Id: <3330576C.63DE@cs.cmu.edu>
Hello,
I am currently learning Perl and Java to augment my Web skills.
A project at work requires simple parsing abilities from a messy "log
file" to generate a clean report file. A "tagged" log file line may
have related items on following lines without a tag.
On the PERL FAQ String::MatchMany and
Text:: ::Parser seemed close to want I need.
I am a Perl NEWBIE and have about 2 weeks of a JAVA course.
Does anyone have recs for simple code "modules" that would
only require slight modifications to perform the above.
e.-
p.s.: Perl was recommended and Java seemed like it has some basic
support for String parsing via StringTokenizer.
ex. file in)
Configuration: Optotrak configuration filename:
/jjj/mrrob/ios_project/data/config/file.cfg @Fri Dec 13 11:59:04 1996
...
Junk: this is junk
Morejunk: more junk
...
Configuration:
Number of probes= 6
@Fri Dec 13 11:59:04 1996
Configuration:
Probe name number strobe num max distance calib method calib for valid
for wand valid for calib calib order.
super_x rb#1 1 0.600 0 2 1 1 1
world rb#2 2 0.600 0 0 0 0 0
hip rb#3 3 0.600 0 0 0 0 0
tool_top rb#4 4 1.000 0 2 0 1 2
tool_bot rb#5 4 1.000 0 2 0 1 3
rb-06056 rb#6 5 0.600 0 2 1 1 4
@Fri Dec 13 11:59:04 1996
Data Acquisition Sphere: Pt #1 out of 1 collect f/ Sphere Centroid.
Pt x = 417.908905 y = -343.905121 z = 200.959473 collect by Ball
Probe. @Fri Dec 13 12:01:58 1996
ex. file out)
This is a nice report
---------------------
Number of probes= 6 at Fri Dec 13 11:59:04 1996
Optotrak configuration filename:
/IUS/mrcas2/ios_project/data/config/opto.cfg
Probe name number strobe num max distance calib method calib for valid
for wand valid for calib calib order.
super_x rb#1 1 0.600 0 2 1 1 1
Pt x = 417.908905 y = -343.905121 z = 200.959473 collect by Ball
Probe at Fri Dec 13 12:01:58 1996
----------------------
thx in adv
e.-
------------------------------
Date: Wed, 19 Mar 1997 22:51:55 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Re: Parsing html tag attributes & values in Perl
Message-Id: <33326d7d.27130361@news.demon.co.uk>
Oops, just forgot to say that as well as returning all the tag attributes in the associative array, the
program also returns 2 extra values - everything before the tag, which is indexed by _before, and everything
after the tag, indexed by _after.
If this doesn't make sense, it refers to my other message which I posted about 30 seconds ago, so it may not
have appeared in your list yet - have patience!
-------------------------------------------------------------------
Dan Sumption : dan@gulch.demon.co.uk
Hard Media, London SE1 dan@hardnet.co.uk
http://www.hardnet.co.uk/dan/
------------------------------
Date: Wed, 19 Mar 1997 22:47:30 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Re: Parsing html tag attributes & values in Perl
Message-Id: <33316953.26064608@news.demon.co.uk>
Thanks to everyone on the Web Programming mailing list and
comp.lang.perl.misc newsgroup for the various suggestions on how to
do this, and in particular to Rodos who wrote what was almost the
right program (only problem was, once I received his solution I had
already thought out another way to do it).
Below, I present my final (for now) version. I added a couple of
configuration variables, so you can either use it the obvious way or
the way I wanted it originally. Due to the haphazard way in which I
learned perl, the code is probably fairly sloppy - if anyone spots any
obvious flaws in the way I'm doing things, please please let me know
(I intend running this on a site where it may be used a lot
concurrently, and I'd like to keep processing requirements down).
Obviously, I'd also like to hear of any useful additions people can
make.
Finally, a question - is there any kind of equivalent of chop which
returns the _first_ character of a string - you may notice the rather
sloppy way in which I had to resort to using substr's (I could also
have used a regexp like $tempchar = s/^.//, but I imagine this would
have been equally demanding).
OK, so here, for anyone interested, is the code to return an
associative array of attributes and their values, given an html tag:
sub parseTag {
use Strict;
# Call using &parseTag(tag)
local ($line) = shift;
my ($attribute, $value, $separator, $tempchar, $hasvalue, $tag, $count, %pairs) = '';
local ($includequotes, $inside, $order);
# Configuration variables
$includequotes = 0; # Set to 1 if you want to retain quotes around
# values (e.g. if you want to put them back in
# to some html, and ensure that they don't clash
# with embedded quotes).
$inside = 0; # Set to 1 if the initial < has already been
# stripped from the tag
$order = 0; # Set to 1 to add a 2 digit number before each
# attribute so that they can be re-arranged in
# their original order by sorting the keys of
# the array (again this may beuseful if you are
# outputting the results as html).
unless ($inside) {
# Remove upto (not including) the < and store it in the pairs array,
# referenced by _before
$line =~ s/^([^<]*?)<//;
$pairs{'_before'} = $1;
}
# Take the first word, its the tag
$line =~ s/^\s*((\w|-)+)\s*//;
$tag = $1;
# Whilst we still have attribute pairs read them
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
while ($line) {
# Get the next character and skip if it's whitespace
if ($tempchar =~ /\s/) {
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
next;
}
# End the loop if we reach the closing >, storing the remainder
# in the array, referenced by _after
if ($tempchar eq '>') {
$pairs{'_after'} = $line;
$line = '';
last;
}
# Loop for getting next attribute name
while ($tempchar !~ /\s|=/) {
$attribute .= $tempchar;
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
# Warn if the attribute name contains anything other than a-z, 0-9 or -
if ($attribute =~ /([^\w|-])/) {
warn "Unexpected character: $1 appears in attribute: $attribute, remainder of line: $line\n";
}
# Skip whitespace between attribute and value/next attribute, and
# look out for = sign, which shows that there's a value to follow.
while ($tempchar =~ /\s|=/) {
$hasvalue = 1 if $tempchar eq '=';
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
# If this attribute has a value, then get it.
# Set $separator to characters which indicate we've reached the
# end of the value (ie. a quote which matches the one we begin
# with, or a space or > if there's no quotes).
if ($hasvalue) {
if ($tempchar =~ /("|')/) {
$separator = $1;
$value .= $tempchar if $includequotes;
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
else {
$separator = '\s|>';
}
while ($tempchar !~ /$separator/) {
$value .= $tempchar;
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
$value .= $tempchar if ($includequotes && ($tempchar =~ /'|"/));
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
# Store the current attribute and its value in the array, before
# resetting all temp values to null and going round again...
if ($order) {
substr($attribute,0,0) = sprintf "%2.2d", $count;
$count++;
}
$pairs{$attribute} = $value;
$attribute = $value = $separator = $hasvalue = '';
}
return ($tag, %pairs);
}
-------------------------------------------------------------------
Dan Sumption : dan@gulch.demon.co.uk
Hard Media, London SE1 dan@hardnet.co.uk
http://www.hardnet.co.uk/dan/
------------------------------
Date: Wed, 19 Mar 1997 23:49:33 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Re: Parsing html tag attributes & values in Perl
Message-Id: <33347a7e.30459798@news.demon.co.uk>
OK, one more slight correction -
The script I wrote will not find the closing > if the last character
in the tag is not a closing quote or a space (oops) - to fix this,
after the line:
$value .= $tempchar if ($includequotes && ($tempchar =~ /'|"/));
you should modify the next two lines to read:
unless ($tempchar eq '>') {
$tempchar = substr($line,0,1);
substr($line,0,1) = '';
}
Hope that sorts it (coz I'm off to bed!)
-------------------------------------------------------------------
Dan Sumption : dan@gulch.demon.co.uk
Hard Media, London SE1 dan@hardnet.co.uk
http://www.hardnet.co.uk/dan/
------------------------------
Date: Wed, 19 Mar 1997 13:46:02 -0500
From: Bruno Pagis <pagib@aur.alcatel.com>
To: Steven Sajous <steve@golf.com>
Subject: Re: Perl Compiler
Message-Id: <3330346A.654F@aur.alcatel.com>
Steven Sajous wrote:
>
> Does anyone know where I can find a Perl compiler, and have any
> instr5uctions on how to use one?
see http://www.perl.com/perl/info/software.html
BRUNO.
-----------------------------------------------------------
Bruno Pagis, ALCATEL Network Systems
__ 2912 Wake Forest road RALEIGH, NC 27609
ALC\/TEL Phone: (919) 850-5174 Fax : (919) 850-6670
Email: bruno_pagis@aur.alcatel.com
-----------------------------------------------------------
------------------------------
Date: 19 Mar 1997 14:19:19 -0500
From: ofious@mit.edu (Kofi D Fynn)
Subject: perlcall: Segmentation error on PUSHMARK(sp)
Message-Id: <w4yk9n3ofk8.fsf@gaston.mit.edu>
Hello,
I am trying to call some perl subroutines from C and tried my
hands on some of the example programs in the perlcall manpage. I run
into a couple of problems.
First, where does the c program expect to find the perl
subroutine? I could not fing that info in the documentation.
Secondly, the c program was giving me a segmentation error on
the call to PUSHMARK(sp). The error message from the debugger was.
signal SEGV (segmentation violation) in main at line 32 in file "datexform1.c"
32 PUSHMARK(sp) ;
I hope someone can help me.
Thanks
Kofi
------------------------------
Date: Wed, 19 Mar 1997 15:27:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jim Rudolf <rudolf@metadesign.de>
Subject: Re: Problems with flock()
Message-Id: <Pine.GSO.3.95q.970319152019.17596D-100000@kelly.teleport.com>
On Wed, 19 Mar 1997, Jim Rudolf wrote:
> This attempt to open for reading and lock shared dies on the flock():
>
> open(FILE, "<$fn") or die "cannot read $fn\n";
> flock(FILE, $lock_shared) or die "cannot share $fn\n";
Many (most?) vendors' implementations of flock make the assumption that
there's no need to lock the file if you're not going to be changing it. If
you want to flock, you should open with write access.
Also, unless you know what you're doing, don't use shared locks. Use
exclusive locks, something like this.
open FILE "+< $fn" or die "Cannot open '$fn' for update: $!";
flock(FILE, $lock_exclusive) or die "Can't flock: $!";
...do some stuff, and quickly, since another process
may be waiting for us to finish...
close FILE; # which flushes and releases the lock
If you need the file again later, repeat as needed. Since the file may
have changed while it was closed, be sure to read it again, rather than
relying upon anything from before. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Wed, 19 Mar 1997 18:54:46 GMT
From: scoph@bga.com (Scott Phelps)
Subject: Re: Reporting Win32 Perl Bugs
Message-Id: <3330364e.22891595@news3.bga.com>
On Wed, 19 Mar 1997 18:31:37 GMT, scoph@bga.com (Scott Phelps) wrote:
>The specific bug I wish to report is that when I use an array in a
>scalar context, I seem to be getting undef, instead of the length of
>the array.
Nevermind about that supposed bug! Just a loose nut here.
------------------------------
Date: Wed, 19 Mar 1997 19:50:46 GMT
From: do@not.spam (Don't Spam, it's Wrong!)
Subject: Re: Repost: Cookie question
Message-Id: <333040e8.20775854@news.digex.net>
On 4 Mar 1997 21:40:22 GMT, admin@vci.net (Administration) wrote:
> I know how to do cookies easily from a perl script or C program but I
>haven't been able to send a cookie when another document is being loaded.
>I've been trying to call a perl script or C program from a server side
>include. The SSI runs the CGI but instead of doing a traditional cookie the
>whole "Set-cookie: expires=...path=..." header gets put into the document
>as regular text.
> I'm sure there's a way something like this can be done. It seems that the
>LinkExchange does something like this with those banners you see
>everywhere.
> Can anyone help?
> I'd appreciate an email. Thanks.
>
> Bill Dunn
The cookie has to be in the header, before the "Content..." line.
Generally, I have the page generated by a cgi script that sends the
cookie before the contents of the page. I use this extensively.
I think there also may be a way using SSIs if you put the cookie in a
tag like:
<META HTTP-EQUIV="Set-Cookie" CONTENT="frog=little_green_thng">
Actually, I just tested this and it did work, with the Apache server
at least. Remeber the META tags go between the <head> and </head>
tags.
Bob Stewart
------------------------------
Date: Wed, 19 Mar 1997 20:31:34 GMT
From: mjh@elsabio.demon.co.uk (Mark J Hewitt)
Subject: Shadowing modules
Message-Id: <333148ba.849509@news.demon.co.uk>
Something that has always bothered me about perl is keeping the average
site's module collection consistent and up to date. The typical picture is
highlighted now that the _93 test release is available.
In more detail, my concern is that version X of perl is installed, and over
time, more and more of CPAN's modules are plundered and installed into that
perl's module library. Subsequently, perl X+<some modest delta> comes
along, and is installed on top - presumably with its own lib tree, with a
suitably matching version number. So which version of, say, IO::Socket, do
I get now? Is the version in the perl release better, compatible or even
functionally the same as that previously installed from CPAN?
This is even more compounded if different versions (and different
platforms) of perl share a pool of modules.
So just to see what would happen after I installed 5.003_93 on my own
workstation, I wrote this little script, and I enclose a few highlights
from the results. How to keep all this in tune - that's why I gave up
playing the lute in the first place. Ho hum!
#!/usr/local/bin/perl -w
#
###########################################################################
# perl_shadow.pl
#
# Find perl modules (.pm) files that might have shadows from multiple
# installations of Perl, modules from CPAN, etc.
#
# Mark J Hewitt. March 1997.
#
#
###########################################################################
#
require 5.003;
use strict;
use lib;
use File::Find qw(find);
my %index = ();
local $::mlen = 0;
local $::root;
print "Perl modules on \@INC path...\n";
for $::root (@INC)
{
print "\t$::root\n";
find(\&process_entry, $::root);
}
for my $module (sort keys %index)
{
my %seen;
my @dirlist = grep(!$seen{$_}++, @{$index{$module}});
printf "%s%-" . $::mlen . "s %s\n",
scalar @dirlist > 1 ? "!" : " ",
$module, join(" ", @dirlist);
}
sub process_entry
{
return unless m/\.pm$/;
my $path = "$File::Find::name";
my $match = '^' . $main::root . '/';
# print "EXAMINING $path\n";
$path =~ s/$match//;
$path =~ s/\//::/g;
$path =~ s/\.pm$//;
push @{$index{$path}}, $File::Find::dir;
$::mlen = length $path if length $path > $::mlen;
}
Perl modules on @INC path...
/home/mjh/perl
/usr/local/lib/site-perl
/usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
/usr/local/lib/perl5
/usr/local/share/perl/i86pc-solaris
/usr/local/share/perl
.
AddINC /usr/local/lib/perl5
Alias /usr/local/share/perl
AnyDBM_File /usr/local/lib/perl5
!CPAN /usr/local/lib/perl5
/usr/local/share/perl
DirHandle /usr/local/lib/perl5
!DynaLoader /usr/local/lib/perl5
!Fcntl /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!FileHandle /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!FindBin /usr/local/lib/perl5
/usr/local/share/perl
!GDBM_File /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!Getopt::Long
/usr/local/lib/perl5/Getopt /usr/local/share/perl/Getopt
Getopt::Std
/usr/local/lib/perl5/Getopt
Ghostview /usr/local/lib/perl5
!IO /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!IO::File /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!IO::Handle /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!IO::Pipe /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!IO::Seekable /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!IO::Select /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!IO::Socket /usr/local/lib/perl5/IO
/usr/local/lib/perl5/i86pc-solaris/5.004/IO
!NDBM_File /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!Net::Ping /usr/local/lib/perl5/Net
/usr/local/share/perl/Net
!ODBM_File /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!POSIX /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
!Safe /usr/local/lib/perl5
!SelfLoader /usr/local/lib/perl5
/usr/local/share/perl
!Socket /usr/local/lib/perl5
/usr/local/lib/perl5/i86pc-solaris/5.004
Socket::Socket
/usr/local/share/perl/Socket
Socket::blib::Socket
/usr/local/share/perl/Socket/blib
--
Mark J. Hewitt at home mjh@elsabio.demon.co.uk
------------------------------
Date: 19 Mar 1997 14:23:42 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: SORTING ... one more Q
Message-Id: <8cwwr3shi9.fsf@gadget.cscaper.com>
>>>>> "Eric" == Eric D Friedman <friedman@medusa.acs.uci.edu> writes:
Eric> [posted, mailed]
Eric> In article <knlmg5.uc2.ln@localhost>, Tad McClellan <tadmc@flash.net> wrote:
Eric> [a helpful example showing how to write custom sort routines]
>> This is _very_ inefficient. If your lists are large, you would want
>> to use a different method (such as the Schwartzian Transform).
Eric> Is the Schwartzian Transform documented in some obvious place that
Eric> I've over looked? I've seen a number of allusions to it in recent
Eric> days, but have yet to catch a glimpse of the thing itself.
Eric> Suggestions for locating it (and any associated gloss) would be
Eric> much appreciated.
It's referenced in perldsc(1), in perlfaq4, just released, and
described in some detail in
http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html. I've also done a
few columns for Unix Review that use it, although I never had the
nerve to call it the Schwartzian Transform there. Those are at
http://www.stonehenge.com/merlyn/UnixReview/.
Tom Christiansen coined the term. I just thought it was a neat
combination of some stuff. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 530 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 19 Mar 1997 13:34:40 -0800
From: =KF= Kasian Franks <kf@lanminds.com>
Subject: Stock Ticker w/intraday graphs
Message-Id: <Pine.SOL.3.91.970319132946.9172A-100000@lana>
Hi all,
http://www.galaxydrive.com has a stock ticker with
intraday graphs and such, written in tcl and tk.
Has anyone written such a thing in perl or perltk?
thanks,
kf@lanminds.com
------------------------------
Date: Wed, 19 Mar 1997 20:22:13 +0000
From: Pedro Vapi <vapi@student.dei.uc.pt>
Subject: Suidperl!
Message-Id: <Pine.OSF.3.95.970319201431.29144A-100000@student.dei.uc.pt>
Hi... i do need help on setuid perl!
I am trying to implement a suid perl script on a system. It does allow
suid scripts (i made a bourne shell suid and guid, and it worked). It does
have the suidperl wich is a link to sperl.5003 program (with permitions
4711).
I have made a small program that just have the following lines:
#!/usr/bin/perl
$ENV{'PATH'}="/usr/bin:/bin:/sbin:/usr/sbin";
$<=$>;
print "$< $>\n";
I have made this program chown root:bin at a Linux system.
Changed its permissions to 6755.
And the answer of this script is always
515 515
and $> should be 0, not 515!!!!
Can anyone help me????? PLEAZ!!!!!!!!
If possible email also to me (vapi@student.dei.uc.pt)
()'s
Pedro Vapi
---------
vapi@student.dei.uc.pt
PGP @ finger
------------------------------
Date: 19 Mar 1997 16:45:22 -0600
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: text to HTML
Message-Id: <5gpqa2$2fv$1@Venus.mcs.net>
In article <Pine.GSO.3.96.970319073258.24834I-100000@kelly.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>On Tue, 18 Mar 1997, Lewis Taylor wrote:
>
>> I am currently writing a primative text to HTML routine.
>
>Is there any reason you can't use code from CPAN? Hope this helps!
>
> http://www.perl.org/CPAN/
> http://www.perl.com/CPAN/
I don't think the best ones are there, but they can be found by
searching for web resources elsewhere. Is anyone running
apache with mod_perl? Would it be practical to store many documents
as plain text and embed a text->html converter script in the
server?
Les Mikesell
les@mcs.com
------------------------------
Date: Wed, 19 Mar 1997 15:23:39 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Wanted: name parser
Message-Id: <rglpg5.nj.ln@localhost>
Jon Barry (barry@mayo.edu) wrote:
: Can someone give me a reference to a name parser? I'm looking for a
: function that will split up a name given in one string into its component
: parts such as lastname, firstname, title(s), surname(s)...etc. This should
: work for names that might come from all over the world. I don't want to
^^^^^^^^^^^^^^^^^^
So then the names could be written in their native language (using
Unicode, maybe?)?
: re-invent something I'm sure has been done before.
^^^^^^^^^^^^^^^^^^^^^^^^^
I don't think so. I don't think it can be done, in the general case.
You would need to pile on a bunch of restrictions on the form of
names to have a prayer of a chance...
This is a job for real (not artificial) intelligence ;-)
Hire a temp to break them up correctly...
If you search on dejanews in the comp.lang.perl.misc group for
'recognize names', you would have found 12 hits. The one with
Subject: Anyone write a name splitter ?
seems germane.
healy@seviche.med.yale.edu (Matthew D. Healy) wrote:
------------------------------
Unless your names are already pre-parsed, or in some very rigidly-
defined format, no automated parser is likely to work. Take a close
look at the junk mail you get for the next few weeks, and you'll
begin to understand why! Consider the following hypothetical
but not unrealistic customer list:
Professor Doctor Helmut Von Scmeckenbuerg
Saint John's Church
The Very Reverend William M. Anderson
Steven G. Smith, MD
Robert M. Jones, DDS
Harry A. Johnson, MD, PHD
Robert A. Baker, III, MD
Dr William K. Howard
William K. Howard, Jr. MD
Jose Martin y Canseco
Lord Peter Wimsey
Patrick M. O'Doyle, SJ
Revd Steven I. Kelley
Msgr Albert Kinney
Reverend Mother Susan O'Neill
Sister Mary Holy Water
Mr and Mrs John Anderson
Tom Anderson and Jane Smith-Anderson
Tom Anderson and Jane Smith
Dr and Mrs Mike Smith
Dr and Mr Susan Smith
Senior Engineer II
------------------------------
To which I might add:
Betty Jo Smith (nee Farquar)
Muhamed El Fahid (given: Muhamed surname: El Fahid)
Pak Son Lee (given: Son Lee surname: Pak)
William (Bill) Tell
Let us know when you have it written ;-)
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 19 Mar 1997 11:49:05 GMT
From: pauls@seanet.com (paul Spitalny)
Subject: win95 perl 5
Message-Id: <pauls.2.0114C1A9@seanet.com>
Keywords: win95 perl
Hello out there,
I am currently running perl 5.? from a "dos prompt." I used to do this alot in
windows 3.1 but now I have moved on to Win95 and find that anything that runs
in a dos prompt runs VERY slowly compared to before. So, I think I want to get
the WIN95 version of PERL. What I would like to know from you is the actual
mechanics of running a perl program in win95. Do I have to use the "RUN"
utility or does perl 5 for windows 95 have an interface that accepts commands.
i.e., something like a x-window or DOS where commands can be typed in and
acted upon. For example: I might have a perl script called Fred that accepts
two arguments. So, I would like to be able to type:
fred arg1 arg2
and have the script run. Is this how Perl is used in the windows environment
or do i have to use "run" which I really hate.
????
Anyone out there want to enlighten me.
Also - how do the versions of perl that come with the big manuals in some
bookstores stack up. Any reason why I might want to obtain perl for win95 that
way???
Thanks you
Paul
------------------------------
Date: Wed, 19 Mar 1997 21:18:19 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: win95 perl 5
Message-Id: <33375818.4042343@news.brad.ac.uk>
On Wed, 19 Mar 1997 11:49:05 GMT, pauls@seanet.com (paul Spitalny)
wrote:
>Hello out there,
>I am currently running perl 5.? from a "dos prompt." I used to do this alot in
>windows 3.1 but now I have moved on to Win95 and find that anything that runs
>in a dos prompt runs VERY slowly compared to before. So, I think I want to get
>the WIN95 version of PERL. What I would like to know from you is the actual
>mechanics of running a perl program in win95. Do I have to use the "RUN"
>utility or does perl 5 for windows 95 have an interface that accepts commands.
>i.e., something like a x-window or DOS where commands can be typed in and
>acted upon. For example: I might have a perl script called Fred that accepts
>two arguments. So, I would like to be able to type:
>
> fred arg1 arg2
>
>and have the script run. Is this how Perl is used in the windows environment
>or do i have to use "run" which I really hate.
>
>
>????
>
>Anyone out there want to enlighten me.
Perl for Win32 (available from www.activeware.com), although it is a
windows 95 aplication is a "console application" this means it takes
it's input and output in a DOS box, just like a normal DOS program,
even though it is actually a windows program. You will therefore find
little difference between this and the DOS version you were using
(except that this version is likely to be more up to date and better
supported).
>Also - how do the versions of perl that come with the big manuals in some
>bookstores stack up. Any reason why I might want to obtain perl for win95 that
>way???
hrm...welll..i haven't seen these...but I don't see any reason at all
since perl is free there should be no reason to do this. The windows
95 vertsion mentioned above even comes with a HTML version of the perl
manpages
---
Yours Sincerely,
,
() o /| | |
/\ _ _ _ __ _ _ |___| __| _
/ \| / |/ |/ | / \_/ |/ | | |\| | / | |/
/(__/|_/ | | |_/\__/ | |_/ | |/ \_/|/\_/|_/|__/
/|
\|
(Simon Hyde)
/****************How To Contact Me******************\
| Tel: +44(0)1924 492137 |
| Internet Email: shyde@POBoxes.com |
\***************************************************/
------------------------------
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 146
*************************************