[9687] in Perl-Users-Digest
Perl-Users Digest, Issue: 3281 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 29 00:07:14 1998
Date: Tue, 28 Jul 98 21:00:21 -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 Jul 1998 Volume: 8 Number: 3281
Today's topics:
AI Development Project for Net <mideas@akorn.net>
Re: Anybody using perl-ldap.pm? (Peter Scott)
Can't figure out how to remove newlines <thompson@m-net.arbornet.org>
Re: CGI.pm on NT 4.0 and IIS 4.0 (Bob Trieger)
Re: CHOMP not working on some servers (Ronald J Kimball)
Re: DBM Files with Hashes of Arrays (Mike Stok)
Re: glob wrecks foreach loop! (Tad McClellan)
Re: how does bless work (Mark-Jason Dominus)
Re: Inheritance broken when objects share a file? <rra@stanford.edu>
Re: Inheritance broken when objects share a file? <rra@stanford.edu>
Re: Misleading documentation (Mark-Jason Dominus)
Re: Opendir and Write Not Working Like Planned... (Ronald J Kimball)
Re: Perl and HL-7 (Jeffrey Drumm)
Re: perl and setuid via WEB (apache) (Martien Verbruggen)
Problems building 5.005_01 on NT4, sp3 <davidc@selectst.com>
Re: Problems Running An executable from within PERL <mpersico@erols.com>
Re: Programmer's Editor <tchrist@mox.perl.com>
Re: Simplish regular expression Question (Ronald J Kimball)
Solaris 2.5.1_x86 + new perl5 + theads != posix <phil@bts.com>
This is an easy question! (Patrick Boswell)
Re: Unable to get REMOTE_HOST <tho@sn.no>
Re: Using Perl Embed in Win32 C++ (Martien Verbruggen)
Re: Using Perl Embed in Win32 C++ (Sean McAfee)
We're extending the limits of HTML Forms, JavaScript, D geneleroy@my-dejanews.com
Re: Y2K problem in PERL with localtime() (Craig Berry)
Re: Zombies from Forking are Bad, says Sun (Abigail)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Jul 1998 00:21:00 GMT
From: "Lee Markham" <mideas@akorn.net>
Subject: AI Development Project for Net
Message-Id: <MVtv1.845$h51.1326751@newsread.com>
Carrollton Georgia based small business seeks individual with PERL
programming for database connectivity to handle the querry from a new
artificial intelligence program that builds custom computer systems.
** Details: Estimated 5 - 10 hours research on POS database structure, and
4 - 8 hours programming. Purpose: Your portion of the program must be
capable of performing a search of a standard point of sale database. Ideal
candidate will be willing to perform work in exchange for equal rights to
market the software. Preferred individual will be located in an area that
will not interfere with local sales of either company. We will exchange
source code, and contracts and each have re-sale rights with no obligation
to the other company.
Completed program will be capable of generating custom system configurations
from the POS datafile already in use by the business for inventory tracking
and pricing.
Contact by email if intrested:
Lee Markham mideas@akorn.net
------------------------------
Date: 28 Jul 1998 21:22:04 GMT
From: psi@euclid.jpl.nasa.gov (Peter Scott)
Subject: Re: Anybody using perl-ldap.pm?
Message-Id: <6plfds$mjt@netline.jpl.nasa.gov>
In article <Ew38I8.By2@boss.cs.ohiou.edu>, "Dave" <hannum@oak.cat.ohiou.edu> writes:
> Hello all,
>
> I have an application to use perl-ldap. I have a directory which I have
> written using DBD::Informix and DBI for a database. However, I need to
> capture some initial info on the user from LDAP on an x.500 system as they
> log in using DCE. I capture the ID from the DCE login and need to search
> LDAP for the matching UID which is the key, then return name, degree, title,
> etc.
I use Net::LDAPapi quite well; I don't know what perl-ldap is, but here's
how to use Net::LDAPapi:
use Net::LDAPapi;
$TIMEOUT = 15; # Seconds
$DSA = "insert name of your DSA host";
$ORG = "insert root of tree you're searching";
$ld = ldap_open($DSA, LDAP_PORT);
do_error ("ld_open") unless $ld;
do_error ("ldap_simple_bind_s")
if (ldap_simple_bind_s($ld, "your username", "your password")) != LDAP_SUCCESS;
@attrs = (); # Return all Attributes
$filter = "insert some LDAP filter";
do_error ("ldap_search_s")
if ldap_search_st($ld,$ORG,LDAP_SCOPE_SUBTREE, $filter, \@attrs, 0,
$timeout, $result) != LDAP_SUCCESS;
$count = ldap_count_entries($ld,$result); # To find # of matches
do_error ("count_entry") if $count == -1;
for (my $ent = ldap_first_entry($ld,$result); $ent;
$ent = ldap_next_entry($ld,$ent)) {
do_error ("get_dn") unless my $dn = ldap_get_dn ($ld, $ent);
for (my $attr = ldap_first_attribute($ld,$ent,$ber); $attr;
$attr = ldap_next_attribute($ld,$ent,$ber)) {
@vals = ldap_get_values($ld,$ent,$attr);
# Do what you want with @vals and $dn
}
}
ldap_unbind ($ld);
sub do_error {
my $text;
unless (defined $ld) {
$text = "LDAP connection not yet made: @_";
} else {
my ($err_dn, $err_msg);
my $err = ldap_get_lderrno($ld, $err_dn, $err_msg);
my $errormsg = ldap_err2string($err);
$text = "@_: $errormsg";
$text .= ", additional information: $err_msg" if $err_msg;
ldap_unbind ($ld);
}
die "$text\n";
}
Syntax of DNs, filters, etc, is LDAP-related, not Perl-related.
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (psi@euclid.jpl.nasa.gov)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: Tue, 28 Jul 1998 23:19:38 -0400
From: "Terrence E. S. Thompson" <thompson@m-net.arbornet.org>
Subject: Can't figure out how to remove newlines
Message-Id: <35BE94CA.3621E77A@m-net.arbornet.org>
Hi, I've got a problem that is just driving me crazy. I've looked
in the manual and the faq, but I'm just not getting it. How exactly
do I remove a newline from the end of a string?
I tried this:
$string =~ s/(.+)\n$/$1/;
but it doesn't seem to work.
Sorry if this a dumb question, but I'm really stuck.
Thanks for any help!
------------------------------
Date: Wed, 29 Jul 1998 01:53:14 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: CGI.pm on NT 4.0 and IIS 4.0
Message-Id: <6plvfa$jkk$1@ligarius.ultra.net>
[ posted and mailed ]
Nicholas Konidaris <npk@bnl.gov> wrote:
-> Hello all,
->
-> I'm having a problem which I'd appreciate your help on: In IIS 4.0 on
-> Windows NT running
-> Gurusamy Sarathy's binary version of Perl, I have a problem.
->
-> I set up .pl to run perl.exe (in the properties sheet) as it should, but
-> then, when I open up a perl
-> file, it just sits there, doing nothing. Examining the current running
-> tasks, shows that perl.exe
-> has been spawned, but is taking no CPU or memory. Does anyone have any
-> experience with
-> this?
You're barking up the wrong tree. This is not a perl problem. You can find the
answer in the documentation for your server or in a newsgroup devoted to your
server, like:
news:comp.infosystems.www.servers.ms-windows
news:microsoft.public.inetserver.iis
Good luck
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Tue, 28 Jul 1998 23:36:16 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: CHOMP not working on some servers
Message-Id: <1dcw7kr.5q0xlp1rq9dw2N@bay1-205.quincy.ziplink.net>
Chris Denman <c-denman@dircon.co.uk> wrote:
> After a bit of debugging I found that chomp
> only took the last character off of the string and left some
> crap (I thought that chomp took off all of the crap off the end
> of a string?).
If you want chomp to remove crap from the end of the string, you need to
do this first:
$/ = 'crap';
Note if you have a load of crap to remove from the end of the string, as
in 'poop excrement crapcrapcrap', this method will only remove the last
bit of crap, rather than all the crap. You would need to do something
like s/(?:crap)+$// instead.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 29 Jul 1998 03:57:58 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: DBM Files with Hashes of Arrays
Message-Id: <6pm6k6$hai@news-central.tiac.net>
In article <6pld9e$td3$1@nnrp1.dejanews.com>,
<beaumack@my-dejanews.com> wrote:
>I am trying to store a hash of arrays in a DBM file, and I've been having
>some trouble. I want to store a series of values associated with keys in a
[...]
>Can I store this data in a DBM file or does anyone have a better way to store
>this information?
Have you considered using the MLDBM module which can be retrieved from the
comprehensive perl archive network (CPAN)?
The docs start out:
NAME
MLDBM - store multi-level hash structure in single level
tied hash
SYNOPSIS
use MLDBM; # this gets the default,
SDBM
#use MLDBM qw(DB_File FreezeThaw); # use FreezeThaw for
serializing
#use MLDBM qw(DB_File Storable); # use Storable for
serializing
$dbm = tie %o, 'MLDBM' [..other DBM args..] or die $!;
DESCRIPTION
This module can serve as a transparent interface to any
TIEHASH package that is required to store arbitrary perl
data, including nested references.
You can get to CPAN by visiting http://www.perl.com or by looking under
/pub/languages/perl/CPAN on ftp.funet.fi (the master site, there's a list
of mirror sites there too).
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Tue, 28 Jul 1998 22:38:38 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: glob wrecks foreach loop!
Message-Id: <uf5mp6.ili.ln@localhost>
John Adams (John.Adams@BentonvilleAR.ncr.com) wrote:
: I've tried to figure this out since last week, and I'm still stumped.
: What's happening is that the (-e glob $filename) evaluates as true for
: as many times in the foreach loop as it finds files that match the glob.
: That makes no sense to me! Is there something going on under the hood of
: glob that I don't know about or understand?
I don't know, because you haven't told us what you _expect_ that to do.
I don't think you want to be combining glob and -e that way...
What does filename contain?
A filename?
A glob pattern?
If a filename:
print "$filename exists\n" if -e $filename;
If a pattern:
@files = glob $filename;
print "$filename matched some files\n" if @files > 0;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Jul 1998 21:36:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: how does bless work
Message-Id: <6plubo$c81$1@monet.op.net>
In article <6pjt67$mqm$1@agate.berkeley.edu>,
Jimmy Zhengyu Zhang <zhengyu@lacerta.Berkeley.EDU> wrote:
> When blessed, a pointer to a thingy becomes an object.
Actually, it's the thingy that is blessed.
Look at this:
$a = $b = {};
bless $a => Snonk;
print ref $b;
(prints `Snonk')
This shows that the thing that got the blessing was not $a, but the
hash that $a referred to.
> But how does the object actually know which class it belongs to, or
> in other words, what is the magic of bless, or said yet in another way,
> how does the object store the class name information?
> My initial guess was to simply add another field into the hash.
No, that wouldn't work very well, because the programmer might have been
using `class' for something else already. Also, I'm sure you know
that regular arrays and scalars can be blessed, and this wouldn't work
for those things.
The answer is that Perl's thingies are very complicated already. For
example, the informtation that Perl records about each scalar already
includes a string value, a string length, a number value, a bunch of
information about whether the scalar is `magical' and if so how, and
so on. None of this is visible at the Perl level, but you can snoop
into it with the Devel::Peek module or by writing an xsub.
The blessing is one of these associated items.
For more details, you might want to look at the `perlguts' manual
page, or at Gisle Aas' illustrated version at
<URL:http://home.sol.no/~aas/perl/guts/>.
------------------------------
Date: 28 Jul 1998 17:32:47 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Inheritance broken when objects share a file?
Message-Id: <m3hg01qyxc.fsf@windlord.Stanford.EDU>
Karmadon <Karmadon@my-dejanews.com> writes:
> I cannot use base class methods unless each package is in a separate
> file. Am I wrong assuming it as a bug?
No, your problem is actually appears to be a simple one of sub declaration
order. Note:
> hopper% cat p2
> D->new();
> package B;
> sub alloc { bless {}, $_[0]; }
> package D;
> @ISA = qw(B);
> sub new { $_[0]->alloc(); }
> hopper% perl -w p2
> Can't locate object method "alloc" via package "D" at p2 line 8.
But if you do:
windlord:~> perl -w
package B;
sub alloc { bless {}, $_[0] }
package D;
@ISA = qw(B);
sub new { $_[0]->alloc() }
package main;
D->new ();
it runs fine. So D::new() is not seeing B::alloc() when you're calling
D::new() from before B::alloc() is declared.
I have to admit this isn't precisely the behavior I'd expect either, and
I'm not quite sure why this is happening the way it is. Maybe someone
more familiar with how sub declarations work could enlighten both of us?
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 28 Jul 1998 17:36:18 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Inheritance broken when objects share a file?
Message-Id: <m3emv5qyrh.fsf@windlord.Stanford.EDU>
Russ Allbery <rra@stanford.edu> writes:
> But if you do:
> windlord:~> perl -w
> package B;
> sub alloc { bless {}, $_[0] }
> package D;
> @ISA = qw(B);
> sub new { $_[0]->alloc() }
> package main;
> D->new ();
> it runs fine. So D::new() is not seeing B::alloc() when you're calling
> D::new() from before B::alloc() is declared.
> I have to admit this isn't precisely the behavior I'd expect either,
Oh, wait. I see what's wrong. @ISA isn't getting set until runtime, of
course, and therefore @ISA isn't set at the time of the call to D->new()
if you put that call before the assignment to @ISA.
If you put @ISA in a BEGIN { } block, things will work as you expect.
I should have seen that faster. My apologies.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 28 Jul 1998 21:50:14 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Misleading documentation
Message-Id: <6plv4m$caq$1@monet.op.net>
In article <joe.mcmahon-2807981338590001@prtims.stx.com>,
Joe McMahon <joe.mcmahon@gsfc.nasa.gov> wrote:
>Note: I am NOT asking a question, but pointing out what I feel is an
>ambiguous meaning, or perhaps an oversight, in a Perl error message.
I wish you'd post a small example that demonstrates your problem,
because I read it twice and didn't understand it, and when I read it a
third time I thought I understood it but the thing it seemed to
describe was impossible.
Did you mean to have `Package_A' and `A_Package' be different? Or did
you just get mixed up? But is is definitely true that at least one of
us is mixed up. There is something going on here, having to do with
failed inheritance, or missing `use' directives, or something, but I
cannot make out what it is.
------------------------------
Date: Tue, 28 Jul 1998 23:36:21 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Opendir and Write Not Working Like Planned...
Message-Id: <1dcw8bi.1szkufhirri9sN@bay1-205.quincy.ziplink.net>
[posted and mailed]
Vikram Pant <usenet@vikrampant.com> wrote:
> It will OPEN a directory, glob the files and write them to a HTML page,
> close the HTML, close the directory and continue until no directories
> exist.
>
> Problem is that it is not opening the directories like I want it to,
> instead it is writing to the script's base directory.
All paths are relative to the script's base directory, unless you
specify the full path or change to another directory. You didn't do
either of those, so you are opening the files in the base directory...
> I was hoping someone could point out my error. I am assuming that it is
> something basic, but for a week I have tried to understand opendir and I
> think I am doing it right.
I am afraid you misunderstand opendir(). opendir() is only used to read
the contents of a directory. It does not direct the operation of the
script to that directory in any way.
I believe what you are looking for is chdir(), for changing directories.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 29 Jul 1998 00:43:23 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Perl and HL-7
Message-Id: <35be69ef.86390891@news.mmc.org>
[posted and mailed]
On Tue, 28 Jul 1998 13:16:36 -0500, "Mark D. Crockett, MD"
<crockett@uic.edu> wrote:
>
>Anyone have any experience with using HL-7 with PERL? Please reply
>
>Mark D. Crockett, MD
>crockett@uic.edu
I've written some simple scripts to decompose HL7 messages for
validation/debugging purposes (output from an interface engine I work
with). What specifically are you looking to do? HL7 is fairly trivial to
parse with Perl . . .
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 29 Jul 1998 02:12:22 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: perl and setuid via WEB (apache)
Message-Id: <6pm0e6$d78$1@nswpull.telstra.net>
In article <35BC76E1.1252D58F@ping-net.de>,
Bernd Zimmermann <berni@ping-net.de> writes:
> Hi !
>
> I have perl 5.004_04, Apache 1_3_0 and want to execute a script
> with suid root..
>
> Problem : chown root and chmod u+s did not work, because the
> script is called via the apache and still have the uid from the apache.
So? That's what suid does. It changed the uid.
Explaining how to set up setuid scripts is not our job. Refer to your
documentation, or ask on a unix group. You might want to read the
perlsec man page which tells you a few things about it, and about some
caveats.
# perldoc perlsec
# perldoc perlfaq8
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Wed, 29 Jul 1998 12:48:45 +1000
From: David Coldrick <davidc@selectst.com>
Subject: Problems building 5.005_01 on NT4, sp3
Message-Id: <35BE8D8D.C03EF75D@selectst.com>
Can't get to first base here. This is the first time I've tried to build
Perl. VC++ 5.0 is installed on my system (not that I use it much), I've
edited Makefile so that the \include, \lib section reads like:
CCHOME = C:\Program Files\DevStudio\VC
CCINCDIR = $(CCHOME)\include
CCLIBDIR = $(CCHOME)\lib
and I've checked that stdio.h is indeed in C:\Program
Files\DevStudio\VC\include, but
when I run nmake, I get:
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
D:\Perl stuff\perl5.005_01\win32>nmake
Microsoft (R) Program Maintenance Utility Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
cl.exe -c -I. -nologo -Gf -W3 -I..\lib\CORE -I.\include -I. -I..
-DWIN32 -D_CONSOLE -DNO_STRICT -DPERLDLL -DPERL_CORE -Od -MD
-DNDEBUG -Foperlglob.obj perlglob.c
perlglob.c
perlglob.c(6) : fatal error C1083: Cannot open include file: 'stdio.h':
No such file or directory
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
Any ideas?
Regards,
David
------------------------------
Date: Tue, 28 Jul 1998 22:21:50 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: alan_k'necht@canadalife.com
Subject: Re: Problems Running An executable from within PERL
Message-Id: <35BE873E.5A0A6E6B@erols.com>
The return value from system is not necessarily the return value from
"test.exe". You first need to see if the return value from system
indicates a signal'ed die or a coredump. If none of those things
happened, then you can try to extract the return value for text.exe
itself.
The camel book has a decent example under the entry for he system
command, Chap. 5, I think. If you don't have it, buy it. You need to
read and re-read a hundred times, letting various bits and pieces sink
in over time.
If you reply to me by email, I will send you what I use to avoid having
to recode the test every time I call system.
alan_k'necht@canadalife.com wrote:
>
> Hi, I'm trying to run an executable from within PERL. The program
> simply creates a file and writes the date to that file. The executable
> runs fine if I run the script from the command prompt. However, when I
> run the script from within a browser, it seems that the executable
> does not run. I am doing the following:
>
> $return_value = system("test.exe");
>
> When run from the command prompt, the return value is 0.
> When run from within a browser, the return value is 256.
> I know that the script is running on a NTsystem and I believe the web
> server is WebSite.
>
> Any ideas?
------------------------------
Date: 29 Jul 1998 00:53:10 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Programmer's Editor
Message-Id: <6plrpm$m6j$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, xidicone@iname.com writes:
:The latest version of the Zeus programmers text editor is now available:
Several questions unrelated to your product's alleged technical wizardry:
Is this free?
Is source available?
Does it run on Unix?
If the answers to these are no, why are you advertising here? :-(
--tom
--
Randal said it would be tough to do in sed. He didn't say he didn't
understand sed. Randal understands sed quite well. Which is why he
uses Perl. :-) -- Larry Wall in <7874@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Tue, 28 Jul 1998 23:36:26 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Simplish regular expression Question
Message-Id: <1dcw8y7.1ucokwh12js77uN@bay1-205.quincy.ziplink.net>
Craig Berry <cberry@cinenet.net> wrote:
> $str =~ s!^/?(.*?)(?:\.c)?$!$1!;
Not sure that's the best approach. Non-greedy matching within capturing
parens is somewhat inefficient.
Here is a simpler and more straightforward approach.
$str =~ s,^/,,;
$str =~ s/\.c$//;
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 28 Jul 1998 20:47:38 -0400
From: Phil Eschallier <phil@bts.com>
Subject: Solaris 2.5.1_x86 + new perl5 + theads != posix
Message-Id: <x6lnpd8out.fsf@bts.com>
Folks;
Help.
I've downloaded the new perl 5 (5.005_01) ... and installed it under
several UNIX variants, with no issues. However, under Solaris
2.5.1_x86, any use of the threaded perl5 hangs on the posix tests
(i.e.; make test).
Testing on its own hangs on "Ok 8" (posix.t).
truss output from the failed / hanged test lands in "lwp_sema_p
sleeping".
I tried to study the situation using "truss perl lib/posix.t" but such
a test is not valid is it runs to completion.
I'm running Solaris 2.5.1 x86 + the latest recommended patches + the
7/22 fifofs thread patch (failed without this patch too).
perl5 is compiled with gcc 2.8.1.
Thoughts please?
I will gladly offer shell accounts to perl developers to diagnose this
problem ... just let me know.
--
Phil Eschallier | Bux Technical Services | Systems, software, security
inet phil@bts.com | 131 Wells Road | and Inter-networking for
tel 215 348 9721 | Doylestown, PA 18901 | your business!
fax 215 348 2567 | http://www.bts.com |
------------------------------
Date: Wed, 29 Jul 1998 03:14:43 GMT
From: patb@ufl.edu (Patrick Boswell)
Subject: This is an easy question!
Message-Id: <35be938c.2743019@news.gnt.net>
I am working with CGI and perl, and I am currently trying to hack up some of Selena Sol's code. I'm trying to split
this Shopping Cart as listed below on the | symbol, where upon each field I will perform some calculations. However,
when I try to split this file, I am able to do this, but it only splits up until the first line. It's like after it's
done splitting or finds the first reference, it stops. Any help?
Thanks,
Patrick Boswell
patb@ufl.edu
#! /usr/bin/perl
open(CART,"/home/p/patrickb/pattest.com_html/User_carts/4966912.8222.cart");
while (<CART>) {
@cart_lines = split (/\d\d\r\d\d/);
close(CART);
#@cart_fields = split (/\|/, @cart_lines);
#notice how the above will not work because at the end of the lines there is no |
while ($i <= 20) {
#$toreturn = $cart_fields[$i];
$toreturn = $cart_lines[$i];
print " $toreturn \n";
$i++;
}
}
Data File:
10|0013|Consonants|18.98|The letter S|<CENTER><FONT SIZE ="+4">S</FONT></CENTER>||18.98|60
10|0011|Vowels|12.98|The letter E|<IMG SRC = "Html/Images/e.jpg" ALIGN ="left">|Arial 1.50, Red 0.00|14.48|61
10|0012|Vowels|18.98|The letter I|<CENTER><FONT SIZE ="+4">I</FONT></CENTER>||18.98|62
10|0000|Numbers|10.98|The number 0|Click <A HREF ="Html/Images/zero.gif">here</A> <BR>for<BR> image||10.98|63
14|0004|Numbers|10.98|The number 4|Click <A HREF ="Html/Images/four.gif">here</A> <BR>for<BR> image||10.98|64
------------------------------
Date: Wed, 29 Jul 1998 02:37:40 +0200
From: "Thomas =?iso-8859-1?Q?=D8derud?=" <tho@sn.no>
Subject: Re: Unable to get REMOTE_HOST
Message-Id: <35BE6ED3.908214F@sn.no>
>
>
>
>
> >My ISP is running an Apache Server.
> >
> >In one of my script I retrive the REMOTE_HOST Environment Variable with
> >the
> >output being the ip adress. Does anybody know how to fix this..??
> >
>
> They are either running a newer version of Apache (1.3bxx or 1.3.0) or
> have intentionally disabled hostname lookups.
>
> hostname lookups is an unnecessary waste of time, especially when the
> server is just going to send a .html file.
>
> Rather than ask the ISP to enable hostname lookups, just add this to
> your perl scripts to get the host names:
>
> use Socket;
>
> $hostname = gethostbyaddr(inet_aton($ENV{REMOTE_ADDR}),AF_INET);
>
> $hostname *should* now hold the host name, if DNS resolution
> succeeded. If not, it'll just have the IP address - but that's what
> you'd get with hostname lookups anyway.
>
Thank you, this worked fine. This is the first time I ever tried to post a
message to a news group but it will not be the last. Thanks for all help..
Thomas Xderud
------------------------------
Date: 29 Jul 1998 00:05:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Using Perl Embed in Win32 C++
Message-Id: <6plove$8l4$2@nswpull.telstra.net>
In article <35BE5F93.67CFA6F2@pdh.com>,
Ed <ed@pdh.com> writes:
> To start out with, I am not a perl programmer and don't really know a
> whole lot about perl, but was given the task to call a perl program from
>
> within my C++ code. I have looked at the perl embed for win32 stuff but
You should have asked this question on comp.lang.c++. You're asking
how to call a program from within c++. That it's a perl program is
irrelevant.
> still don't have a good idea of how to do this. Most of the programs
> want to take the command line arguments which I do not want to use (from
> void main(argc, argv)). I will know the argument (single argument) and
> the perl program name. I have not seen any really good examples of how
> to do this. Does anyone have any ideas?
In c you'd use the system(3S) function. It's part of the standard c
library (stdlib). I suspect that c++ can use that as well, or has an
equivalent. Check the documentation. Ask on a c++ group.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Wed, 29 Jul 1998 03:24:45 GMT
From: mcafee@battlezone.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Using Perl Embed in Win32 C++
Message-Id: <1Cwv1.5604$24.33064377@news.itd.umich.edu>
In article <35BE5F93.67CFA6F2@pdh.com>, Ed <ed@pdh.com> wrote:
>To start out with, I am not a perl programmer and don't really know a
>whole lot about perl, but was given the task to call a perl program from
>within my C++ code. I have looked at the perl embed for win32 stuff but
>still don't have a good idea of how to do this. Most of the programs
>want to take the command line arguments which I do not want to use (from
>void main(argc, argv)). I will know the argument (single argument) and
>the perl program name. I have not seen any really good examples of how
>to do this. Does anyone have any ideas?
Just feed Perl your own arguments, like so:
char *perl_argv[] = { "", "my_script_name", "my_arg" };
// or, possibly:
// char *perl_argv[3] = { "", "my_script_name" };
// perl_argv[2] = get_my_arg();
PerlInterpreter *perl = perl_alloc();
perl_construct(perl);
perl_parse(perl, xs_init, 3, perl_argv, 0);
// and so on...
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Wed, 29 Jul 1998 00:21:01 GMT
From: geneleroy@my-dejanews.com
Subject: We're extending the limits of HTML Forms, JavaScript, Dynamic HTML,
Message-Id: <6plpte$h15$1@nnrp1.dejanews.com>
We're extending the limits of HTML Forms, JavaScript, Dynamic HTML,
catalogs and Java with Natural Language Processing (NLP). We're building
a smart edit field that understands English questions.
If you're spending too much time, money or adding too many GUI controls
in an attempt to direct people to relevant information, then we may be
able to help.
Our tool kit converts existing information so questions can be asked of
a web page or site. If you're interested in seeing what NLP can do,
please email a list of web pages that contain:
1) the input web page (usually a form) and
2) the output web page (usually contains a table listing search
results).
Especially helpful are web pages with information organized in a
hierarchical fashion.
We'll post the converted results on our server. We're testing our
conversion tool kit.
Thanks,
Mike LeRoy
mike@browsefast.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 29 Jul 1998 00:18:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Y2K problem in PERL with localtime()
Message-Id: <6plpno$kne$1@marina.cinenet.net>
John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:
: >+ Are you sure it's not the year 100? Are you also sure that "1900" is not
: >+ the year 3800?
:
: >Yes. By *definition*. As per 'perldoc -f localtime':
:
: I see nothing related to perl in the string 02-29-100.
Your whole argument rests on an (intentional?) confusion between the data
and the presentation of that data, or the 'model' and the 'view' to steal
terms from one of my favorite design philosophies. The model needs to be
unambiguously specified; in this case, that specification is provided by
the definition of localtime(). If you store dates internally to a
database, you can store them in any way that unambiguously specifies
years; a two-digit representation can be used *if* all code using the db
knows about and properly uses the conventions of the representation.
>From this underlying model, different views can be obtained. A classic
example that has come up frequently on this thread is the Unix 'date'
command, which can present either 2- or 4-digit year values, despite the
fact that it draws on localtime()'s year-1900 model which is neither,
which in turn draws on time()'s seconds-since-1/1/1970 model, which
doesn't 'know' anything about years at all.
: If I am your pointy haired boss and you hand me a report with that date
: in it, I have no way of knowing that you programmed in perl.
Nobody is proposing that you use the raw localtime year value in
human-viewable output; the fact that some misguided people did so is one
of the core causes of the whole y2k problem.
: "Dates will be the output of the 'localtime' perl funtion" is not how
: any company I know of standardizes its dates. "Dates will be expressed
: as the last two digits of the year" is.
Which, as you point out, requires special knowledge to resolve
ambiguities, as does any date representation -- even a 4-digit year 1998
could really be A.D. 3898 expressed using localtime's conventions.
: If you believe that your private knowledge of how the number on the
: sheet of paper was produced, then I would claim that there is no y2k
: problem at all.
The problem is that many people wrote code that didn't consider how the
model they were using, or thought they were using, would work in 2000 and
beyond. That's why you see "19%y" formats and the like. Without having
even thought about the problem, it's unlikely their code will fare well.
Any sort of 'private knowledge' covering the 2000+ period will suffice to
prevent y2k havoc, provided it's applied consistently and universally.
: For every two digit year printed on any sheet of paper,
: or contained in any database, there is someone who has private knowledge
: as to how that number was produced. There can be no ambiguity.
Yes there can, if others use that database/paper without the same
knowledge. localtime() provides an unambiguous year value which can
'become' ambiguous if used without proper understanding, for example.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 29 Jul 1998 01:41:36 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Zombies from Forking are Bad, says Sun
Message-Id: <6plukg$ora$1@client3.news.psi.net>
Steve Livingston (slivings@digitalriver.com) wrote on MDCCXCII September
MCMXCIII in <URL: news:35BE445D.5002A7E9@digitalriver.com>:
++ I've got a perl daemon that runs continuously, forking children that do
++ stuf and then exit (simplified code below).
++
++ Sun kernel engineers tell me having this many zombies is bad, and may be
++ causing a unix/memory-being-stepped-on problem I'm having.
++
++ They said that this many zombied/defunct is very unusual and
++ zombied/defunct processes behave strangely.
They are of course entirely right.
See the manual on what to do.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3281
**************************************