[6583] in Perl-Users-Digest
Perl-Users Digest, Issue: 208 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 31 14:15:29 1997
Date: Mon, 31 Mar 97 11:00:40 -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 Mon, 31 Mar 1997 Volume: 8 Number: 208
Today's topics:
Closure/Package Interaction Problem? (Uwe Hollerbach)
Re: crypt <houlding@wdg.mot.com>
current directory (Dave Price)
Re: current directory (Tad McClellan)
Re: Databases - advice wanted (Jay Flaherty)
Debugger probs in 5.003_91/5.003_93 <larry@lccinc.com>
Re: Debugging an 'open' statement <rootbeer@teleport.com>
Re: File Locking (Rex Fowler)
Re: ftp.pl and Comm.pl -- help with adaptation to Solar (Matthew H. Gerlach)
Re: Functions and operators lvirden@cas.org
HELP!! "POST" not work on perl??? (MCC)
HELP: MacPERL cgi-lib-mac.pl problem (Chris Scheidel)
Re: Hlp pls : "push" errors when scripts ported to Unix (M.J.T. Guy)
how to check Backslash? <101233.3236@CompuServe.COM>
Re: How to get from one array to another <rootbeer@teleport.com>
Re: interesting text formatting problem (Paul Havemann)
Mini Search Engine <neiled@enteract.com>
nt perl and network ipc <weiner@video1.bloomberg.com>
Re: Perl Data Structures Cookbook. Wher did it go? lvirden@cas.org
perl for winNT and visual basic (John Nielsen)
Re: Perl Mail Parser Question (Luigi Mattera)
Re: POD: Style Guide or Module Template Available? lvirden@cas.org
Re: Question on Strings [HELP] (Simon Hyde (aka Jeckyll))
Re: Question on Strings [HELP] <no_nick@ix.netcom.com>
Re: running a loop foreach $ARGV? <no_nick@ix.netcom.com>
Re: skipping around in file being read... <rootbeer@teleport.com>
Sockets Problem (Malcolm Hoar)
Static compile on AIX <jason.kruse@teldta.com>
Re: term 'regular expressions' considered undesirable <vladimir@cs.ualberta.ca>
Writing a routine the works like 'open' (Bernard Cosell)
Re: Writing a routine the works like 'open' (Nathan V. Patwardhan)
XS and g++ conflicts <tk29@cornell.edu>
XSUB utility and passing arrays (Fran Rizzardi)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Mar 1997 17:43:11 GMT
From: uweh@bu.edu (Uwe Hollerbach)
Subject: Closure/Package Interaction Problem?
Message-Id: <5hot3f$3g1@news.bu.edu>
G'day, folks,
I have recently started working on a large-ish perl/tk
application, and I have encountered what seems to me to be an
inconsistency or maybe a bug in the way perl handles scoping when
closures are mixed with packages. I was making lists of objects, with
each object having a "delete yourself" button attached. I used
closures, i.e., dynamically-generated anonymous subroutines, to
properly track the "yourself" part of the "delete yourself".
Initially, this worked fine, since I had everything together in one
file. But I decided to break the program into multiple files and
packages, and a few things started to go slightly wrong. I hacked at
it a bit, and have come up with the following fairly simple test case.
There are two files here, appended below. The main one is
"testp", and the auxiliary one is "ptest.pm". When you execute testp,
it prints out the results of four tests, along with what I expected
the results to be. The problem is that the variable $tval in package
ptest is not "seen" by gen_sub_1_package, which is contrary to my
expectations. I have run this on a couple of different machines,
which are all running fairly early versions of 5.003, and it is
consistently inconsistent (so to speak). Here's the output I get.
Note that test 3 differs from the others.
main test:
expected: defined $tval in gen_sub_1_main test 1
actual: defined $tval in gen_sub_1_main test 1
expected: defined $tval in gen_sub_2_main test 2
actual: defined $tval in gen_sub_2_main test 2
package test:
expected: defined $tval in gen_sub_1_package test 3
actual: undefined $tval in gen_sub_1_package test 3
expected: defined $tval in gen_sub_2_package test 4
actual: defined $tval in gen_sub_2_package test 4
I'd be grateful if anyone could tell me: (a) it's a bug (I do
have a workaround -- it's shown but not used in gen_sub_3_package in
ptest.pm); (b) it's a bug, and it's been fixed in version <mumble>;
(c) it's correct behavior, and here's why...; or (d) something else!
Many thanks in advance! If you post to the group, I'd appreciate it if
you could send me a copy by email; I try to follow c.l.p.m., but am
not always 100% successful...
Best regards,
Uwe Hollerbach
****************cut here for testp****************************************
#!/usr/local/bin/perl -w
package main;
require 5.003;
use strict;
use ptest;
my $tval = 14.0;
sub gen_sub_1_main {
my $input = shift;
return sub {
if (defined($tval)) {
print "defined \$tval in gen_sub_1_main $input\n";
} else {
print "undefined \$tval in gen_sub_1_main $input\n";
}
}
}
sub gen_sub_2_main {
my $input = shift;
if (defined($tval)) {
print "defined \$tval in gen_sub_2_main $input\n";
} else {
print "undefined \$tval in gen_sub_2_main $input\n";
}
}
sub gen_main_main {
my $p = shift;
return gen_sub_1_main($p);
}
print "main test:\n";
print "expected:\tdefined \$tval in gen_sub_1_main test 1\n";
my $t1 = gen_main_main('test 1');
print "actual:\t\t";
&$t1;
print "expected:\tdefined \$tval in gen_sub_2_main test 2\n";
print "actual:\t\t";
&gen_sub_2_main('test 2');
print "package test:\n";
print "expected:\tdefined \$tval in gen_sub_1_package test 3\n";
my $t2 = &ptest::gen_main_package('test 3');
print "actual:\t\t";
&$t2;
print "expected:\tdefined \$tval in gen_sub_2_package test 4\n";
print "actual:\t\t";
&ptest::gen_sub_2_package('test 4');
****************cut here for ptest.pm*************************************
package ptest;
require 5.003;
use strict;
use subs qw(gen_sub_1_package gen_main_package);
my $tval = 14.0;
sub gen_sub_1_package {
my $input = shift;
return sub {
if (defined($tval)) {
print "defined \$tval in gen_sub_1_package $input\n";
} else {
print "undefined \$tval in gen_sub_1_package $input\n";
}
}
}
sub gen_sub_2_package {
my $input = shift;
if (defined($tval)) {
print "defined \$tval in gen_sub_2_package $input\n";
} else {
print "undefined \$tval in gen_sub_2_package $input\n";
}
}
sub gen_sub_3_package {
my $input = shift;
my $tv = $tval;
return sub {
if (defined($tv)) {
print "defined \$tv in gen_sub_1_package $input\n";
} else {
print "undefined \$tv in gen_sub_1_package $input\n";
}
}
}
sub gen_main_package {
my $p = shift;
return gen_sub_1_package($p);
}
1;
****************end of ptest.pm*******************************************
--
Uwe Hollerbach, Ph.D. uweh@bu.edu
Simulation of Semiconductor Device uh@alumni.caltech.edu
Manufacturing & Performance
Dept. of Manufacturing Engineering, Boston University, Boston, Mass.
------------------------------
Date: Thu, 27 Mar 1997 10:18:12 -0800
From: Julian Houlding <houlding@wdg.mot.com>
Subject: Re: crypt
Message-Id: <333AB9E4.7576@wdg.mot.com>
Geoffrey Hebert wrote:
> 1. get the encrypted password from your system (call this $syspass)
> (if you can, maybe /etc/passwd)
I have written a script which reads the encrypted password from the
/etc/passwd file, then ecrypts the users password using the crypt()
function and returns true/ false. NOW, this script is working fine when
I run it at the UNIX prompt, however, when I call the script through one
of my web pages, I get VERY different results (even though I have hard
coded the user and password into the script). I have written the
encrypted password obtained from the /etc/passwd to a file>>>this
appears as a * in the file when run through the web and appears properly
(string of several characters) when run through UNIX prompt???
Does anyone have any idea what is going on here???
Thanks!
I would appreciate an email reply.
--
Julian N. Houlding email: jhouldin@sfu.ca
Motorola Wireless Data Group houlding@mdd.comm.mot.com
Richmond, BC phone: (604) 241-6028
Canada
--
------------------------------
Date: Mon, 31 Mar 1997 15:05:43 GMT
From: dave.price@gecapital.com (Dave Price)
Subject: current directory
Message-Id: <333fd1e7.7462457@newsrv.capital.ge.com>
Is there a special variable or perl function that will return the
current directory. I know that $0 is the directory in which the
script is located, chdir() will change directorys, and mkdir() will
make a directory, but is there an equivalet to 'pwd'?
Thanks in advance for any help.
__________________________________
Dave Price
dave.price@gecapital.com
------------------------------
Date: Mon, 31 Mar 1997 10:01:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: current directory
Message-Id: <t3noh5.7md.ln@localhost>
Dave Price (dave.price@gecapital.com) wrote:
: Is there a special variable or perl function that will return the
: current directory. I know that $0 is the directory in which the
: script is located, chdir() will change directorys, and mkdir() will
: make a directory, but is there an equivalet to 'pwd'?
the Cwd.pm module should do the trick:
use Cwd; # import names from Cwd::
$here = getcwd();
: Thanks in advance for any help.
You're welcome.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 31 Mar 1997 14:12:14 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Databases - advice wanted
Message-Id: <5hognu$ipm$1@gaia.ns.utk.edu>
Simon Twigger (simont@post.its.mcw.edu) wrote:
:
: I can probably use the same approach to this new project, however, I am
: trying to find out if there is a more sensible way to do it, such as
: using more advanced database functions/modules. Can anyone give me a few
: pointers as to what I might gain from using a specific database system
: (ive been looking at the Berkeley DB) over a plain text file type of
: approach (speed, flexibility?). Also, any advice or suggestions on what
: modules (Sprite, DB_... etc. might suit my application would be most
: appreciated.
take a look at mySQL (http://www.tcx.se)
then take a look at DBI/DBD (http://www.hermetica.com/technologia/DBI)
You can also look at mSQL (www.Hughes.com.au) but I think mySQL is more
robust...Jay
--
**********************************************
Jay Flaherty fty@hickory.engr.utk.edu
------visualize whirled peas------
**********************************************
------------------------------
Date: Mon, 31 Mar 1997 13:00:54 -0500
From: Larry Prall <larry@lccinc.com>
Subject: Debugger probs in 5.003_91/5.003_93
Message-Id: <333FFBD6.3C90@lccinc.com>
When using the debugger with 5.003_91, I tried to set print actions
(e.g. '< print $_, "\n";') but found that the commands were being
printed (completely, and without interpolation), so that after each
prompt following the above command:
print $_, "\n";
would print, but that wasn't particularly helpful, since it didn't tell
me anything I didn't already know.
This morning I built 5.003_93, which includes perl5db.pl v 0.9907, and
now I can't get the debugger to work at all:
root@habu(1173)$ perl -de 2
Stack dump during die enabled outside of evals.
Can't call method "Features" without a package or object reference at
/usr/local/lib/perl5/perl5db.pl line 1525.
BEGIN failed--compilation aborted.
DB::fake::(/usr/local/lib/perl5/perl5db.pl:2017):
2017: "Debuggee terminated. Use `q' to quit and `R' to restart.";
DB<1>
I'm running Solaris 2.5.1 on a SPARC 5. Perl was built with the
SPARCworks C 3.0.1 compiler. I'm not using the ReadLine module.
Anyone else having a similar problem? Or any thoughts on why I'm having
this one?
------------------------------
Date: Mon, 31 Mar 1997 08:24:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Gaugler <keng@wco.com>
Subject: Re: Debugging an 'open' statement
Message-Id: <Pine.GSO.3.96.970331082202.27668J-100000@kelly.teleport.com>
On 30 Mar 1997, Ken Gaugler wrote:
> open (SEARCH, "$fgrep -A2 -B2 -i -n -s $query $document_root/* |");
> Is there a good way to debug this statement without altering the way the
> script functions?
For starters, try printing out that string so that you can see what you're
asking the system to do. Then, see whether you can use that command
yourself, perhaps as a certain user-id and from a particular directory.
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: 31 Mar 1997 09:53:59 -0600
From: rmfowler@raptor.mtc.ti.com (Rex Fowler)
Subject: Re: File Locking
Message-Id: <5hommn$k93@raptor.mtc.ti.com>
In article <Pine.GSO.3.96.970327191350.15008O-100000@kelly.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>On 27 Mar 1997, Rich Schramm wrote:
>
>
>> I am concerned about blocked processes attempting to write to my file
>> after I unlock it but before I close it.
>
>
>I think you might want to see the methods in Randal's fourth Web
>Techniques column, which explains all you need about how to use flock().
>
> http://www.stonehenge.com/merlyn/WebTechniques/
Been there and also examined the FAQ. Didn't quite get all I need to know.
How do I flock() a file I don't have a handle for? ie a dbm file that
wasn't explicitly open()'d.
dbmopen(%A,"/home/a/data", 0660);
# need to flock() something here..
%A{$name} = $number;
dbmclose(%A);
Do I have to open() and tie() it myself?
>
>-- Tom Phoenix http://www.teleport.com/~rootbeer/
>rootbeer@teleport.com PGP Skribu al mi per Esperanto!
>Randal Schwartz Case: http://www.lightlink.com/fors/
>
Thanks,
--
Rex Fowler http://www.mtc.ti.com/~rmfowler
(972)997-2779 mailto:rmfowler@mtc.ti.com
Alpha Pager http://www.mtc.ti.com/cgi-bin/alpha_pager.cgi
TI MSG rfow
------------------------------
Date: Mon, 31 Mar 1997 15:27:03 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: ftp.pl and Comm.pl -- help with adaptation to Solaris 2.5
Message-Id: <gerlachE7wyx3.5Mr@netcom.com>
I have not used Comm.pl under Solaris, just SunOS and SCO. However,
since the original author of Comm.pl work(s/ed) for Sun, I would
assume it does work. The library itself says it works for Solaris.
Did you try one of the examples "talking" to telnet?
Matthew
In article <333BA74B.4654@foto.infi.net> dmgf@foto.infi.net writes:
>My goal is to develop an automated ftp script for Solaris.
> I have attempted to integrate Comm.pl into ftp.pl. I did this this
>by replacing every call to chat2.pl in ftp.pl with Comm.pl. Thus far,
>however, the result does not appear to "work." I have plainly missed
>something.
> Has anyone else successfully undertaken this adaptation?
> Has anyone else used Comm.pl to write an ftp script that runs on a
>Solaris box?
> Any and all advice would be appreciated.
> Thank you.
>
>George Frink
>Fayetteville, N.C.
>
------------------------------
Date: 31 Mar 1997 17:06:33 GMT
From: lvirden@cas.org
Subject: Re: Functions and operators
Message-Id: <5hoqup$or0@srv13s4.cas.org>
According to Mark <>:
:On 30 Mar 1997 22:42:49 GMT, Hans Mulder< hansm@icgned.nl> wrote:
:
:>Randal Schwartz <merlyn@stonehenge.com> wrote:
:>
:>> >>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
:>
:>> %3 = ( fred => 5, barney => 2);
:>Is {,} a function or an operator? Or several of each?
:
:You are asking if the *comma* is an operator or a function? Now I'm
:confused...
:
:The comma is a syntactic element, the same way a paren or a dollar
:sign is syntactic in certain contexts. Comma is part of the syntax of
:a function/sub/etc
In C at least, the comma acts as an operator. I suspect that Mr. Hulder
was trying to get clarification of how Perl handles the comma outside
the syntactical use (if at all).
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 31 Mar 1997 16:57:45 GMT
From: duffy@cais.cais.com (MCC)
Subject: HELP!! "POST" not work on perl???
Message-Id: <5hoqe9$dkg@news2.cais.com>
I just changed my Web server from NCSA 1.5 to Apache 1.2b7. After I started
"httpd", I found all of my "CGI" programs with "POST" are not work any more.
On server "error_log", the following error message will come out:
fail for XXX.XXX.XXX.XXX reason: malformed header from script. Bad header =No
Can anyone tell me what is wrong on it? Thank you for help.
The O.S. is BSDI UNIX 2.1
------------------------------
Date: 31 Mar 1997 17:15:46 GMT
From: crscheid@newstand.syr.edu (Chris Scheidel)
Subject: HELP: MacPERL cgi-lib-mac.pl problem
Message-Id: <5horg2$gst@newstand.syr.edu>
I am using MacPERL version 5.1.3r2 and I have been attempting to install
the cgi-lib-mac.pl file for use creating CGI scripts. I have received the
file and put it in the "lib" directory of MacPERL successfully. I have
also tried to use the sample script "sample-macperl.acgi" with no luck.
Yes, I have opened it with MacPERL and I have saved it as a CGI script. My
problem however, is what the Webstar server returns after execution.
Error receiving results from ACGI execution. (-1700)
Has anyone else come across this problem. It may be a
configuration problem with Webstar but I doubt it since the script
"Demo.cgi" which does not use "cgi-lib-mac.pl" works quite alright. Any
help would be greatly appreciated. Thank you
Christopher Scheidel
==========================================================================
= Christopher Scheidel crscheid@syr.edu =
= Computer Consultant/Web Development =
= Syracuse University Computing and Media Services =
= http://cms.syr.edu =
==========================================================================
------------------------------
Date: 31 Mar 1997 17:30:49 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Hlp pls : "push" errors when scripts ported to Unix. (simple 2-d arrays)
Message-Id: <5hosc9$16v@lyra.csx.cam.ac.uk>
In article <859798998.26408@dejanews.com>, <sweeting@neuronet.com.my> wrote:
>I had no problems using List of lists on an NT box, but now
>porting the scripts to a Digital Unix machine, I have the following
>error :
>
>"syntax error in file - at line 14, next 2 tokens "push @allentries"
>Execution of - aborted due to compilation errors. "
Are you sure you posted _exactly_ your script? It doesn't give syntax
errors for me.
Syntax errors like that are often caused by an error on a preceding line
such as a missing semicolon.
Mike Guy
------------------------------
Date: 31 Mar 1997 15:58:21 GMT
From: Connie Mueller-Goedecke <101233.3236@CompuServe.COM>
Subject: how to check Backslash?
Message-Id: <5homut$l0p$1@mhafc.production.compuserve.com>
Hello from Hamburg!
My aim is: I have the path- and filename-information in a string
(e.g. c:\myprog\sample.txt)
Now I want to check each letter to localize the backslash that I
can cut the filename.
I have one problem with the right syntax:
Now: how do I compare with '/'?
if ($lastletter eq a) <- that's not a problem.
But: how to write: if ($lastletter eq /)?
thanks,
Connie Mueller-Goedecke
cmg@avantart.com
------------------------------
Date: Mon, 31 Mar 1997 08:33:04 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "christop@ozinter.co.jp" <christop@ozinter.co.jp>
Subject: Re: How to get from one array to another
Message-Id: <Pine.GSO.3.96.970331082738.27668K-100000@kelly.teleport.com>
On Mon, 31 Mar 1997, christop@ozinter.co.jp wrote:
> I have this:
>
> %Data = (
> group1 => ["one:1.htm","two:2.htm","three:3.htm"],
> group2 => ["ay:a.htm","bee:b.htm","cee:c.htm","dee:d.htm"]
> );
>
> and I want to get the group1 bits happily into elements of the list
> array @instruction.
Have I misunderstood you, or do you want something like this? Hope this
helps!
@instruction = @{ $Data{group1} };
-- 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: Mon, 31 Mar 1997 17:32:18 GMT
From: paul@hshuna.hsh.com (Paul Havemann)
Subject: Re: interesting text formatting problem
Message-Id: <E7x4pu.H8E@hshuna.hsh.com>
Phil Stripling (philip@remove.crl.com) wrote:
: On 26 Mar 1997, Eric Litman wrote:
:
: > I have a rather interesting text formatting problem to solve. I have an
: > application in which I need to strip HTML from a document to deliver
: > it via email as plain text. When simply removing (<.+?>), I'm left with
: > large, blank areas in the paragraphs where the HTML tags once were.
: >
: > What I'd like to do is remove the HTML codes while retaining the
: > original paragraph "shape" (i.e. formatted to 75 columns).
:
: I know it's not perl, but you could save the file through your web browser
: as text. If you don't have 75 columns after saving it, run it through
: emacs or BBEdit and wrap at 75 characters.
Or try one of the HTML to Text converters referenced at
http://www.w3.org/pub/WWW/Tools/html2things.html
=-=-=-=-=-=-=-=
Paul Havemann, VP (paul@hsh.com)
HSH Associates, Financial Publishers
The Nation's Largest Publisher of Mortgage Information
(201) 838-3330 | 1-800-UPDATES | Fax: (201) 838-8294
Mortgage Update BBS: 201-838-8636 Web Site: http://www.hsh.com/
------------------------------
Date: 31 Mar 1997 16:37:56 GMT
From: "Neil Edmondson" <neiled@enteract.com>
Subject: Mini Search Engine
Message-Id: <01bc3df2$23cf4f20$0594e5cf@nedmondson.iclretail.com>
I've searched CPAN but maybe I need new glasses. I want to implement a
mini search engine in perl that will traverse ascii text. Would like to do
some sensible validation of search terms, e.g. eliminate articles, plurals,
etc.
Can anyone point me in the right direction,
TIA, Neil
------------------------------
Date: Mon, 31 Mar 1997 13:46:36 -0500
From: Konstantin Weiner <weiner@video1.bloomberg.com>
Subject: nt perl and network ipc
Message-Id: <3340068C.167E@video1.bloomberg.com>
anybody has any luck with that?
any sample code?
any pointers are greatly apreciated!!!!
--
=========================================================
phone:(212)940-1154
mailto:kweiner@bloomberg.com
http://cs.nyu.edu/phd_students/weiner/
=========================================================
------------------------------
Date: 31 Mar 1997 17:01:55 GMT
From: lvirden@cas.org
Subject: Re: Perl Data Structures Cookbook. Wher did it go?
Message-Id: <5hoqm3$or0@srv13s4.cas.org>
According to Matthew D. Healy <Matthew.Healy@yale.edu>:
:In article <5gvabb$i9e@srv13s4.cas.org>, lvirden@cas.org wrote:
:
:> According to Tom Christiansen <tchrist@mox.perl.com>:
:> :In comp.lang.perl.misc,
:> : Jerome O'Neil <joneil@is.ssd.k12.wa.us> writes:
:> ::The requested URL /perl/nmanual/html/pod/perldsc.html was not found on
:>
:> :Try again without the 'n'.
:> : http://www.perl.com/perl/manual/html/pod/perldsc.html
:> :Although both should work.
:>
:> I still get failures regardless of the number of times that I've
:> tried this all day.
Note that this morning I tried the above URL and still get errors. HOWEVER,
it's quite an interesting error:
Writing:
GET /perl/manual/html/pod/perldsc.html HTTP/1.0
Host: www.perl.com
followed by my Accept headers followed by:
User-Agent: Lynx/2.7 libwww-FM/2.14
----------------------------------
Sending HTTP request.
HTTP: WRITE delivered OK
HTTP request sent; waiting for response.
HTTP: Trying to read 1023
HTTP: Read 256
Read 256 bytes of data.
HTTP: Rx: HTTP/1.1 302 Found
HTTP: Scanned 2 fields from line_buffer
--- Talking HTTP1.
m
Uri: ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/ftp://uiarchive.uiuc.edu/pub/la
ng/perl/CPAN/doc/manual/html/html/pod/perldsc.htm
Notice that the ftp path is provided TWICE! The ftp attempt fails of
course, because there's no ftp: directory under CPAN.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: 31 Mar 1997 09:01:29 -0500
From: jnielsen@chemistry.mps.ohio-state.edu (John Nielsen)
Subject: perl for winNT and visual basic
Message-Id: <5hog3p$cp1@chemistry.ohio-state.edu>
We are going to be doing some programming for Windows NT and having to use and
support perl on the unix side, it would be cool to use perl on the Windows
side.
How does perl compare to visual basic for windows for getting quick programming
jobs done? Also, can one setup a graphical interface w/perl as one can
do with visual basic.
What are the advantages of using perl for win32 versus visual basic/c++.
Thanks for any info . . . .
john
------------------------------
Date: 31 Mar 1997 14:42:29 GMT
From: mattera@ssga.ssb.com (Luigi Mattera)
Subject: Re: Perl Mail Parser Question
Message-Id: <5hoigl$g9t@svna0001.clipper.ssb.com>
Randal Schwartz (merlyn@stonehenge.com) wrote:
: Although it couldn't have happened here, one must use caution when
: combining ".." with other conditionals. If the first part ahead of
: the "or" here also matches one of the begin or end-points, the ".."
: never gets a chance to "look" at the line, and will miss the start or
: end point. It's much safer to swap it around:
: print if not /^From / .. /^$/ or /^Subject:/;
: (From personal experience.... ugh!)
Thanks. I realized in the middle of my coding that what I was doing
was WAYYY to complicated, and posted here to find out how. To think
of the number of crazy loops I had been trying in simulating the ".."
option. :-/
------------------------------
Date: 31 Mar 1997 17:13:02 GMT
From: lvirden@cas.org
Subject: Re: POD: Style Guide or Module Template Available?
Message-Id: <5horau$or0@srv13s4.cas.org>
According to Bill Cowan <billc@tibinc.com>:
:I have read man pages for perlpod and perlsyn regarding POD directives
:(=head1, =item, etc.). Also checked dejanews for "POD template" and
:"POD style" without luck. For a new project, I want to have standard or
:guidelines for POD embedded in the Perl program.
:
:Does anyone have any suggestions or pointers?
:What to do and not to do?
:Standard template or skeleton of doc sections?
There is the beginnings of a cookbook for module creation in the
<URL:http://www.perl.com/CPAN/modules/00modlist.long.html> document.
It includes a set of documents that one should seriously consider creating
when creating a module for general use.
But other than that, I've not seen additional info available. I suppose
one could build a template by looking at all the pod files that come
with the perl core.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: Mon, 31 Mar 1997 14:30:43 GMT
From: shyde@poboxes.com (Simon Hyde (aka Jeckyll))
Subject: Re: Question on Strings [HELP]
Message-Id: <333fc975.558323@news.doha.net>
On 31 Mar 1997 04:01:04 GMT, bretth3522@aol.com (BrettH3522) wrote:
>Is there any way to convert a string (of numbers to an integer). If not,
>is there a way to convert an integer into a string?
There aren't strings and integers in perl, simply scalars, when you
try to use a scalar with numbers in as a string...then it behaves like
a string...and when you try to use it as an number it beheves as a
number
------------------------------
Date: Mon, 31 Mar 1997 11:56:11 -0500
From: Douglas Lewis <no_nick@ix.netcom.com>
Subject: Re: Question on Strings [HELP]
Message-Id: <333FECAB.7169DC91@ix.netcom.com>
Douglas Lewis wrote:
>
> BrettH3522 wrote:
> >
> > Is there any way to convert a string (of numbers to an integer). If not,
> > is there a way to convert an integer into a string?
>
> Convert a string to an integer?
> $string = '123456';
> $number = $string + 0;
>
> Convert a number to a string? (if you must...)
> $str = sprintf("%d", $number);
To follow up to my own post.. (yikes i'm talking to myself)
About the only time I could imagine you wanted to convert
from a number to a string and need sprintf is if you wanted
the output in some special format...
i.e.
$str = sprintf("%04d", $number); # padded on the left with 0's
$str = sprintf("%X", $number); # hex version of the number..
As for the need to 'convert' a string to a number.. I don't know
why you would want to, but you can (if it makes you feel better
about your code).
dough
no_nick@ix.netcom.com
------------------------------
Date: Mon, 31 Mar 1997 11:50:20 -0500
From: Douglas Lewis <no_nick@ix.netcom.com>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: running a loop foreach $ARGV?
Message-Id: <333FEB4C.67B1219E@ix.netcom.com>
Randal Schwartz wrote:
> Douglas> or the follwing (If you are interested in what file you are working on)
>
> Douglas> my @PASSED_ARGV = @ARGV;
> Douglas> foreach $FILE (@PASSED_ARGV)
> Douglas> {
> Douglas> @ARGV = ($FILE);
> Douglas> while (<>)
> Douglas> {
> Douglas> # whatever
> Douglas> }
> Douglas> }
> Or, even simpler simpler
>
> while (<>) {
> $the_file_I_am_working_on = $ARGV;
> # whatever
> }
Unless of course you wanted to do pre/post processing for each new
file..
And no, I'm not saying that mine is the best solution .. just *a*
solution :)
dough
no_nick@ix.netcom.com
------------------------------
Date: Mon, 31 Mar 1997 08:18:59 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brett Longworth <blongwor@student.umass.edu>
Subject: Re: skipping around in file being read...
Message-Id: <Pine.GSO.3.96.970331081834.27668H-100000@kelly.teleport.com>
On Sun, 30 Mar 1997, Brett Longworth wrote:
> How does one skip forwards or backwards in the file being read?
You want seek(). 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: Mon, 31 Mar 1997 18:10:22 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Sockets Problem
Message-Id: <5houm6$esm$1@nntp1.ba.best.com>
I am using Perl 5.003 and Sockets to read a web page from an
http server. From time to time, a manual inspection of the
retrieved document shows that it is prematurely truncated
(presumably as a result of a server or network error).
How can I reliably detect this condition? I have tried:
* getsockopt() with SO_ERROR (always returns undefined).
* Using sysread() and checking for undefined (always
returns zero - EOF).
* getpeername() (always true)
Operating system is FreeBSD 2.1.5.
--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| malch@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Mon, 31 Mar 1997 10:41:00 -0600
From: jason kruse <jason.kruse@teldta.com>
Subject: Static compile on AIX
Message-Id: <333FE91C.4A6E@teldta.com>
Good day. I am attempting to link in the DBD module to create a
statically linked perl for a program which will access an oracle
database (7.2.3) and be called from within a C program. I know there is
an easier way to do this, but I want the C and perl to be separate to
allow others in my group to be able to modify the program as needed.
I created first a statically linked perl with the DBI module in the
perl_home/ext directory. This seemed to work fine. However, when I now
try to add in the DBD module I get unknown symbol errors, most of which
I have tracked down properly.
The symbols I can't access are the following:
0706-317 ERROR: Unresolved or undefined symbols detected:
Symbols in error (followed by references) are
dumped to the load map.
The -bloadmap:<filename> option will create a load map.
.__mulh
.__divus
.__quous
.__divss
.__quoss
osndfn
osntab
The program seems to load the osn* symbols in libsqlnet.a, and the rest
of them appear to come from everywhere. I was just wondering if anyone
has any idea where this is.
The makefile has the following libraries added:
-ldbm -lld -lm -lc -lbsd -lPW -locic -lora -lnlsrtl3 -lcore3 -ls
qlnet -lcv6
OS: AIX 3.2.5
PERL: 5.003
DBI: 0.77
DBD: 0.44
Any help would be great.
Jason
------------------------------
Date: 31 Mar 1997 10:59:19 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: c.c.eiftj@33.usenet.us.com
Subject: Re: term 'regular expressions' considered undesirable
Message-Id: <om3etcuemh.fsf@tees.cs.ualberta.ca>
In article <5hhc4p$sni@samba.rahul.net> c.c.eiftj@33.usenet.us.com (Rahul Dhesi) writes:
> >Now an example showing that non-greedy matching may require backtracking:
> >"abbc" =~ /a.*?b[^b]c/
> Note that "abbc" will never match /a.*?b[^b]c/.
Sorry about that. What I meant was /a.*?b[^b]*?c/ (I came up with this through
minimal modification of your original example). Now THIS requires
backtracking. The idea is that a later part of the regexp makes an early empty
match on .*? to fail.
However, I need to qualify the above statement, because it *depends on the
implementation*. I should say "needs backtracking in the most obvious
implementation". In fact, below is an implementation that doesn't require
backtracking. It illustrates the methodology of transforming a NFA to a DFA.
Start with the most obvious NFA that implements /a.*?b[^b]*?c/. It can be
generated automatically from the regexp by composing single-state FAs.
(I assume the alphabet is just a,b,c.)
input a b c
state 0 1 - - The table entries are the new states.
1 1 1,2 1 1,2 and 2,3 designate nondeterminism (either state).
2 2 - 2,3
Now we have to complete this table with the new pseudostates 1,2 and 2,3:
input a b c
state 1,2 1,2 1,2 1,2,3
2,3 2 - 2,3
1,2,3 1,2 1,2 1,2
Yet another pesudostate 1,2,3 appears, and we complete with it too.
Now start again from 0 and see which states are reachable. Some of the new
states subsume old states and thus make them useless.
input a b c
state 0 1 - -
1 1 1,2 1
1,2 1,2 1,2 1,2,3
1,2,3 1,2 1,2 1,2
The final state is 1,2,3 because it contains the original final state 3.
Or if we give some more symbolic names to our states:
input a b c
state start sawa - -
sawa sawa sawb sawa
sawb sawb sawb sawc
sawc sawb sawb sawb
Where sawc is the final success state (there's transitions going "back" from
it, but that's legit).
The important point here is that we *can't talk* about the non-greediness
condition here: none of the states corresponds precisely to the .*? part in
the original regexp, so the DFA can't report when it has matched it. Indeed,
for the string "aabc" the .*? matches "a" and ends up in the sawa state, while
for "abbc" it matches "b" in the sawb state.
In fact it's impossible to build a DFA where a specific state corresponds to
.*? Consider the regexp again: /a.*?b[^b]*?c/ matches any string containing
a,b,c (in that order), and the b in the regexp is forced to match the last b
of the string (there can be no b's after it). If the state q of a DFA would
correspond to the .*?, then a b transition from it would lead us to a state r
that would recognize the last b in the string. But the DFA can't know it has
reached the last b before it has seen all of the string. Therefore there
cannot be any transitions out of r, but there must be a c transition out of
it.
------------------------------
Date: Mon, 31 Mar 1997 16:38:52 GMT
From: bernie@rev.net (Bernard Cosell)
Subject: Writing a routine the works like 'open'
Message-Id: <333fe6a3.445925429@news.rev.net>
I confess that I find dealing with file handles a constant struggle in
Perl [probably one of the few things that I think are really a botch
in the language].... with all of the fanciness with subroutine
definition, prototypes, etc, I was wondering: it is possible to write
a routine that looks like 'open'?
For example, I need to use 'flock' regularly, and I was thinking that
it'd be real handy to be able to write a
locked_open(handle,openparams) that worked _just_ like open(...) only
it flocked the file before it returned... I realized I didn't have a
clue quite how to write such a routine... Any advice?? Thanks!!
/Bernie\
--
Bernie Cosell mailto:bernie@rev.net
Roanoke Electronic Village
------------------------------
Date: 31 Mar 1997 17:31:47 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Writing a routine the works like 'open'
Message-Id: <5hose3$d66@fridge-nf0.shore.net>
Bernard Cosell (bernie@rev.net) wrote:
: For example, I need to use 'flock' regularly, and I was thinking that
: it'd be real handy to be able to write a
: locked_open(handle,openparams) that worked _just_ like open(...) only
[snip]
If I understand you question correctly, you're looking for a function
which can create a file with zero length before flock()'ing it? If
so, you're looking for the File::Flock, and/or File::BasicFlock modules
which do what you want!
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 31 Mar 1997 13:09:01 -0500
From: Takahiko Koyama <tk29@cornell.edu>
Subject: XS and g++ conflicts
Message-Id: <333FFDA4.32603CFE@cornell.edu>
Hello,
I am making perl api and keep getting messages like.
g++ -c -I/home/koyama/project/codes/Da/src
-I/home/koyama/project/codes/Pac/src
-DHAS_BOOL -I/usr/local/include -O2 -DVERSION=\"1.0\"
-DXS_VERSION=\"1.0\"
-fpic -I/usr/lib/perl5/i386-linux/5.00395/CORE -DHAS_BOOL TMap.c
In file included from /usr/include/g++/vector.h:19,
from
/home/koyama/project/codes/Pac/src/Templates/PacVector.h:
4,
from
/home/koyama/project/codes/Pac/src/Beam/PacBunch.h:10,
from
/home/koyama/project/codes/Da/src/TMap/DaTMap.h:11,
from TMap.xs:11:
/usr/include/g++/function.h:67: `template <class T> class times'
redeclared as
different kind of symbol
/usr/include/sys/times.h:11: previous declaration of `long int
times(struct tms
*)'
make: *** [TMap.o] Error 1
Does anyone know how to get over this problem?
Thanks,
Takahiko Koyama
------------------------------
Date: 31 Mar 1997 18:19:07 GMT
From: fran@stat.Berkeley.EDU (Fran Rizzardi)
Subject: XSUB utility and passing arrays
Message-Id: <5hov6r$jso@agate.berkeley.edu>
I am trying to interface C routines to Perl, where the C routines expect to
receive pointers to arrays of doubles. I am using the XSUB utility of
Perl 5.003.
Does anyone know the best way to do this?
The only way I can figure out to pass an address to the XSUB is to make the
argument in the calling Perl program a reference to my Perl array:
&test(\@arry, $sum);
Further, so far as I can tell from looking at Perl's source code and extensive
experimentation, Perl doesn't appear to store the values of a Perl array in a
simple C array. Thus I can't simply cast a Perl array pointer as a (double *)
but have to use av_fetch() to access each specific element of the Perl array
and build a new C array, which seem clumsy.
The above works with the following simple free-standing XSUB routine:
void test(y, sum)
AV * y = (AV *)SvRV(ST(0));
double sum
CODE:
double *x;
int i;
int n = (int)av_len(y);
New(1, x, n, double);
for (i=0; i<n; i++)
x[i] = (double)SvNV(*av_fetch(y, i, 0));
sum = 0.;
for (i=0; i<n; i++)
sum += x[i];
Safefree(x);
OUTPUT:
sum
Is there something I'm missing?
- Does anyone know some other way to pass the address of a Perl array to an
XSUB routine other than using references? Pg. 95 of the Perl 5 edition of
"Programming Perl" implies this, but doesn't say so explicitly.
- Is there any way to avoid building a new C array as in the example above?
Thanks very much,
Fran Rizzardi
------------------------------
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 208
*************************************