[8565] in Perl-Users-Digest
Perl-Users Digest, Issue: 2181 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 25 18:07:36 1998
Date: Wed, 25 Mar 98 15:00:35 -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, 25 Mar 1998 Volume: 8 Number: 2181
Today's topics:
"end times" - a perl poem (Sharon Hopkins)
Re: "Newbie" Crib Notes <Russell_Schulz@locutus.ofB.ORG>
??? How do you set an environment variable ??? <rickryan@mindspring.com>
Re: ??? How do you set an environment variable ??? (Neil Briscoe)
Bizzare DB_File/Storable problem (maybe locking too) chris+usenet@netmonger.net
Re: File Missing <steve@prilnari.com>
Re: File Missing (Stuart McDow)
Re: Going Rates for PERL Programming??? (Jim Michael)
Re: hard reference, variable names ? <prl2@lehigh.edu>
help with Hardware ethernet addresses please ( Mark Kucera)
How do I check "errorlevel" in a perl script <cbender@creo.com>
How do I compile to use files > 2GB on AIX4.2x (Christopher Pallone)
Re: Interpolating into a variable? How to? <keithmur@mindspring.com>
Re: Is there a "Newsgroup" for Newbies to Perl? lvirden@cas.org
MS Explorer shows extra chars from CGI program (Webmaster Jim)
need regexp help (benjamin j snyder)
Re: need regexp help (A. Deckers)
Re: need regexp help (Joel Coltoff)
Re: need regexp help <birgitt@order.booktraders.com>
Re: need regexp help <cmargoli@world.northgrum.com>
Re: NT <jjones@pmri.com>
Re: Object destruction order non-deterministic? (Jason Gloudon)
Perl and ASP Response object under IIS <Mark_Stamps@scee.sony.co.uk>
Re: Perl to read spreadsheet files <Russell_Schulz@locutus.ofB.ORG>
Perl5 on Irix (David Andre)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Mar 1998 19:06:11 GMT
From: sharon@kithrup.com (Sharon Hopkins)
Subject: "end times" - a perl poem
Message-Id: <EqE2EB.CH1@kithrup.com>
#!/usr/bin/perl
unpack crates, boxes;
package food;
package weapons;
setpriority (guns, ammo, bandages) if $wise;
count, each blessing;
use English; use strict logic;
tell friends, foes, others;
convert: each seeker;
accept everyone, everywhere;
bind each follower, die "together" if sin revealed;
getpeername now, link hands, arms;
sleep until time;
while (time == right) {
formline singlefile;
steady, steady, everyone.
don't fight or kill;
wait,
chomp $slowly;
}
remember:
__END__ is near.
# "end times", a perl poem
# Sharon Hopkins
# 03/16/98
------------------------------
Date: Wed, 25 Mar 1998 17:27:42 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: "Newbie" Crib Notes
Message-Id: <19980325.172742.3Y3.rnr.w164w@locutus.ofB.ORG>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
>> I've got a binder full of her posts.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Which is exactly what Mark was trying to do.
only if Abigail posts a bunch of wrong answers to things in the FAQs.
that's a big percentage of what Mark was posting.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Wed, 25 Mar 1998 14:32:24 -0600
From: "rickryan@ Mindspring" <rickryan@mindspring.com>
Subject: ??? How do you set an environment variable ???
Message-Id: <6fbp6n$i5l$1@camel18.mindspring.com>
I'd like to set a couple of environment variables from with a Perl script
(under NT); REMOTE_USER and REMOTE_IDENT. I'd like to be able then use the
env values later in the same perl script (for creating a user login).
How do I do this? Is there a better way to create a user login procedure?
------------------------------
Date: 25 Mar 1998 22:33:38 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: ??? How do you set an environment variable ???
Message-Id: <memo.19980325223335.34659A@skep.compulink.co.uk.cix.co.uk>
In article <6fbp6n$i5l$1@camel18.mindspring.com>, rickryan@mindspring.com
() wrote:
> I'd like to set a couple of environment variables from with a Perl
> script
> (under NT); REMOTE_USER and REMOTE_IDENT. I'd like to be able then use
> the
> env values later in the same perl script (for creating a user login).
>
> How do I do this? Is there a better way to create a user login
> procedure?
The Perlish way of dealing with the environment is through %ENV.
So, to read a value - you do something like :-
print "$ENV{'REMOTE_USER'}\n";
And to set a value - you do something like :-
$ENV{'REMOTE_USER'} = 'Neil';
This much will work in NT. Hopefully, you'll be able to achieve your aims
- I don't know enough about how NT works to advise further.
Regards
Neil
------------------------------
Date: 25 Mar 1998 20:27:46 GMT
From: chris+usenet@netmonger.net
Subject: Bizzare DB_File/Storable problem (maybe locking too)
Message-Id: <6fbpc2$q92$1@schenectady.netmonger.net>
I've been chasing this for two days, and I finally have enough
debugging output to at least describe the problem. I'm beginning to
suspect DB_File, or at least the TIEHASH interface to it.. I may try
using the put and get methods instead. But I'm getting ahead of
myself. (Believe me, this gets interesting)
I have a fairly simple program that takes a list of IP addresses on
the commandline, pings them all, and stores the results in a db file.
Several copies of this program are run simultaneously in order to
speed up the process. There is of course locking involved, and I'm
about as sure as I can be that the locking is working correctly.
My operating system (FreeBSD) allows files to be opened with O_EXLOCK,
and I'm passing that to tie to be sure that the file is locked from
the moment it's opened until it's untied. I really don't believe that
locking is the issue here.
The data looks like this:
%sitedat is a hash tied to sitedat.db. Its keys are IP addresses.
Its values are frozen (courtesy Storable) hashes.
%sitedat =
("127.0.0.1" => freeze({
<time> =>
{ sent => 10, rcvd => 5, loss => 50, min => 20, avg => 5, max => 30 },
<time> =>
{ sent => 10, rcvd => 5, loss => 50, min => 20, avg => 5, max => 30 }
}),
("127.0.0.2" => freeze( ... ))
);
Where <time> is the Unix time at which the measurement was stored.
Of course, this is generated dynamically, but it's pretty
straightforward. The update_db subroutine is passed a hashref
with all the data that has been collected:
$sites = { "127.0.0.1" => { sent => 10, rcvd => 5, ... },
"127.0.0.2" => ... }
Its job is to update sitedat.db, and it's very simple. Here's the code:
sub update_db {
my $sites = shift;
my $dbh = tie my(%sitedat), "DB_File", "sitedat.db", O_CREAT | O_RDWR | O_EXLOCK
or die "Couldn't open sitedat.db: $!";
foreach my $s (keys %$sites) {
print "* $s: Starting update\n";
my $dat = do {
if (exists $sitedat{$s}) {
thaw($sitedat{$s});
}
else {
print "Adding $s to database.\n";
{ };
}
};
print "* $s: Start size of sitedat: ", length($sitedat{$s}), "\n";
print "* $s: Start keys in sitedat: ", scalar(keys %sitedat), "\n";
print "* $s: Before: keys in \$dat = ", scalar(keys %$dat), "\n";
@{$dat->{time()}}{qw/sent rcvd loss min avg max/} =
@{$sites->{$s}}{qw/sent rcvd loss min avg max/};
print "* $s: After: keys in \$dat = ", scalar(keys %$dat), "\n";
print "* $s: After: size of sitedat: ", length($sitedat{$s}), "\n";
$sitedat{$s} = freeze($dat);
print "* $s: End size of sitedat: ", length($sitedat{$s}), "\n";
print "* $s: End keys in sitedat: ", scalar(keys %sitedat), "\n";
foreach (keys %sitedat) {
print "-> $s: $_ - ", length($sitedat{$_}), "\n";
}
}
# Sync and unlock database
$dbh->sync;
undef $dbh; untie %sitedat;
}
It couldn't be much simpler, and at this point there's practically
more debugging than real code. So here's the interesting part:
Elements randomly disappear from sitedat.db. It will run many times
without a problem.. a successful update looking something like:
* 205.137.48.5: Starting update
* 205.137.48.5: Start size of sitedat: 4005
* 205.137.48.5: Start keys in sitedat: 88
* 205.137.48.5: Before: keys in $dat = 26
* 205.137.48.5: After: keys in $dat = 27
* 205.137.48.5: After: size of sitedat: 4005
* 205.137.48.5: End size of sitedat: 4158
* 205.137.48.5: End keys in sitedat: 88
(followed by a listing of all 88 keys (IP addresses))
$sitedat{$s} starts out containing a 4005-character string, which is
thawed to produce a hash of 26 elements, which has one new sample
added to it, and is then frozen (to become 4158 characters long).
There are 88 sites at the beginning and 88 at the end. There should
always be 88.
Here's how things go wrong:
* 206.124.64.253: Starting update
* 206.124.64.253: Start size of sitedat: 3909
* 206.124.64.253: Start keys in sitedat: 88
* 206.124.64.253: Before: keys in $dat = 26
* 206.124.64.253: After: keys in $dat = 27
* 206.124.64.253: After: size of sitedat: 3909
* 206.124.64.253: End size of sitedat: 4065
* 206.124.64.253: End keys in sitedat: 87
Notice that we end up with only 87 sites in %sitedat. On the next
run, it can't find 206.124.64.253 and creates it anew.
I am baffled by this. The data is not corrupted.. it's just gone.
None of the other elements in %sitedat are damaged. It's as if I had
done a delete($sitedat{"206.124.64.253"}) .. but my program never
deletes anything. I have run out of places to look. It took 87 runs
to get this problem to demonstrate itself; I can now change something
and wait another day to see if it happens again. Does anyone have any
idea what's going on here? Or what I can do to debug this better?
I've got a 25MB logfile in which this only happened _once_. I can't
seem to reproduce the problem with a simpler program - if there IS a
bug in DB_File, it certainly isn't easy to trigger.
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=freebsd, osvers=2.2.5-stable, archname=i386-freebsd
uname='freebsd cheddar.netmonger.net 2.2.5-stable freebsd 2.2.5-stable #0: mon nov 3 11:24:53 est 1997 chris@cheddar.netmonger.net:usrsrcsyscompilecheddar i386 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=n useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O2', gccversion=2.7.2.1
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='char', d_stdstdio=undef, usevfork=true
voidflags=15, castflags=0, d_casti32=undef, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-lgdbm -lm -lc -lcrypt
libc=/usr/lib/libc.so.3.0, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fpic', lddlflags='-Bshareable -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under freebsd
Compiled at Nov 6 1997 15:48:29
@INC:
/usr/local/lib/perl5/i386-freebsd/5.00404
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/i386-freebsd
/usr/local/lib/perl5/site_perl
.
--
Christopher Masto <chris+usenet@netmonger.net>
Director of Operations, NetMonger Communications, Inc.
"Behold the Power of Cheese"
------------------------------
Date: Wed, 25 Mar 1998 20:01:46 GMT
From: Steve Wells <steve@prilnari.com>
To: "Keith L. Miller" <miller@bigsky.net>
Subject: Re: File Missing
Message-Id: <35196420.C9C6935C@prilnari.com>
Keith L. Miller wrote:
> I can't seem to figure out how to set a variable (say $missing) to a
> value of 1 if a file is not found with an OPEN statement or a 0 if it
> is found. Can anyone help please?
$var = 0;
open (F, "file") || $var = 1;
STEVE
------------------------------
Date: 25 Mar 1998 21:24:15 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: File Missing
Message-Id: <6fbslv$h5s$1@ns1.arlut.utexas.edu>
miller@bigsky.net (Keith L. Miller) writes:
> I can't seem to figure out how to set a variable (say $missing) to a
> value of 1 if a file is not found with an OPEN statement or a 0 if it
> is found. Can anyone help please?
You should probably check to see if the file exists before you try to
open it.
To do exactly what you want,
$missing = ( not -e "file" ) || 0;
Although it would be better to use -r or -R (or -w or -W) instead.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: Wed, 25 Mar 1998 22:49:22 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Going Rates for PERL Programming???
Message-Id: <genepoolEqECqA.9F8@netcom.com>
Brian Mathis (brianm@kodak.com) wrote:
: This is a multi-part message in MIME format.
Kill the MIMES.
: I don't think so. The example you gave is an example of simple
: configuration. "Tweaking" would be exemplified by, say, adding a feild
: to an existing program, or optimizing the code for a slightly different
: application than it was originally meant.
Trivial examples aside (mine was the most trivial I could think of), I was
addressing the point of poorly {written | documented | etc.} code and the
work required to fix it. Simple configuration, customization, etc.
certainly fall into the tweaking category.
Now, per your example, it is not uncommon for a client to be clueless as
to the technologies implemented in an application, and to have no idea of
the complexity of the task they are hiring for. So the simple addition of
a field to an existing program may end up requiring not just the addition
of a field in the application, but the addition of a field in a database
table, change of the database schema and referential ingegrity rules,
creation of a lookup table, the modification of a stored procedure on the
database server, etc. What analyst is going to change her hourly rate
based on the possibly dubious notions of the client?
Cheers,
Jim
------------------------------
Date: Wed, 25 Mar 1998 16:30:19 -0500
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: hard reference, variable names ?
Message-Id: <6fbt1c$2408@fidoii.cc.Lehigh.EDU>
>Why don't you use a "two-dimensional" hash? Declare %offers instead of
>%M and %F. Then:
Thanks. I declared $O and said:
$O{$sex}{$offer} = $sth->fetchrow_array;
BTW, the statement handle I am fetching from selects a count; guaranteed
scalar return.
>You have done well, glasshoppa.
Thank you, blind master.
Phil
------------------------------
Date: Thu, 26 Mar 1998 10:30:31 GMT
From: kucera@mindsrping.com ( Mark Kucera)
Subject: help with Hardware ethernet addresses please
Message-Id: <351a2e02.566224@news.mindspring.com>
is there a perl utility or function that can retrieve a remote
ethernet address accros a network/ the internet??
thanks for your help
mark kucera
kucera@mindspring.com
------------------------------
Date: Wed, 25 Mar 1998 14:24:26 -0800
From: Chris Bender <cbender@creo.com>
Subject: How do I check "errorlevel" in a perl script
Message-Id: <3519841A.2FE7CBC8@creo.com>
I want to check the errorlevel of an NT batch file from within a perl
script.
Currently, I am doing:
$status = system("my_batch_file.bat");
die if ( $status );
This is a problem, because in order for $status to be non-zero, I have
to put an "exit 1" command in my batch file. I don't want to have exit
commands in my batch file, because when I run it from the command line,
it will exit from the active shell.
Is there any way of checking the "errorlevel" variabl;e from within
perl? $! doesn't work with NT.
Thanks,
Chris.
------------------------------
Date: 25 Mar 1998 22:55:42 GMT
From: cpallone@metronet.com (Christopher Pallone)
Subject: How do I compile to use files > 2GB on AIX4.2x
Message-Id: <6fc21e$is5$1@newnews.metronet.com>
I have tried the "-D_LARGE_FILES" AIX C compiler option and manually
changed the int, long, and short sizes in the config.sh file. I need
to manipulate a text file ~ 6 GB in size. Without the
"-D_LARGE_FILES" option set I receive an 'EOVERFLOW' when I try to
stat a file > 2GB. With the option enabled, I receive negative
numbers when I stat a file over 2GB. The system is running AIX 4.21.
Any Ideas??
--
.---------------------------------------------------------------.
| Christopher S. Pallone | cpallone@compusa.com |
| CompUSA - Corporate Headquarters | Tel: (972)982-4110 |
| UNIX Systems Administrator | Fax: (972)982-4322 |
`---------------------------------------------------------------'
------------------------------
Date: Wed, 25 Mar 1998 17:39:24 -0600
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Interpolating into a variable? How to?
Message-Id: <351995AC.48448CF7@mindspring.com>
Anirvan Chatterjee wrote:
>
> Keith G. Murphy <keithmur@mindspring.com> wrote:
> > I've seen a solution involving sprintf, which seems to work fine. Is
> > there a simpler or more recommended way? Haven't seen it in the docs.
>
> Why not? There's a perfectly good explanation in the Perl FAQ. Take a
> look at
>
> http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_can_I_expand_variables_in_te
>
> Read the FAQ next time.
>
Sorry, looked through the reference materials, but not the FAQ. Anyway,
your answer works great, as does Jason Gloudon's. (I had actually tried
eval, but not properly!)
Thanks, much. (BTW, Dave Barnett's answer is fine, except that I wanted
$planet to be interpolated within $greeting itself ($greeting *contains*
$planet), not tacked onto the end. My example was not at all clear, I
regret to say).
------------------------------
Date: 25 Mar 1998 20:39:08 GMT
From: lvirden@cas.org
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6fbq1c$h8b$1@srv38s4u.cas.org>
:In article <6f98tj$s4r$1@client2.news.psi.net>,
:Abigail <abigail@fnx.com> wrote:
:
:>Very much true. However, this groups is about electro-magnetism and
:>the pysics of how the VCR and tape interact - it's not about the
:>buttons on the VCR.
Yep - and that's why if you notice the name of this thread is:
Is there a newsgroup for newbies to perl?
That is to say - this newsgroup is apparently NOT the place for someone
who is trying to learn to use applications which happen to be written
in perl. It's apparently for folk who need/want/must write/modify/document
code. That's a _good_ thing.
Apparently though there is no place now, nor any place in the foreseeable
future, for folk to ask questions about the use of programs which
happen to be written in perl.
--
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Wed, 25 Mar 1998 15:33:32 -0500
From: "Jim Spath (Webmaster Jim)" <jspath@mail.bcpl.lib.md.us>
Subject: MS Explorer shows extra chars from CGI program
Message-Id: <Pine.SOL.3.96.980325152335.21103A-100000@mail.bcpl.lib.md.us>
I'm getting extra characters at the beginning and ending of html pages
generated by CGI scripts. I see them in MS Explorer 4.0, but not with
Netscape 4.04 or Lynx 2.8, or in file dumps. The web server is "wn", on
Digital UNIX 4.0. The CGI code is very simple:
#!/usr/local/bin/perl
use CGI;
$query = new CGI;
print $query->header;
print $query->start_html;
print $query->start_form;
print $query->popup_menu('menu_name',
['eenie','meenie','minie'],
'meenie');
print $query->end_form;
print $query->end_html;
Dump output looks like this:
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD><BODY><FORM METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
<SELECT NAME="menu_name">
<OPTION VALUE="eenie">eenie
<OPTION SELECTED VALUE="meenie">meenie
<OPTION VALUE="minie">minie
</SELECT>
</FORM></BODY></HTML>
MSIE shows thisis the source received:
0145
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD><BODY><FORM METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
<SELECT NAME="menu_name">
<OPTION VALUE="eenie">eenie
<OPTION SELECTED VALUE="meenie">meenie
<OPTION VALUE="minie">minie
</SELECT>
</FORM></BODY></HTML>
0
It displays the "0145" and "0" on screen. Other scripts generate
different 4 digit starting numbers.
Anyone else seen this?
Perl is: 5.004_57
CGI is: 2.36
------
<http://www.cs.indiana.edu/picons/db/users/us/md/lib/bcpl/jspath/face.xbm>
Marvin the Paranoid Android says:
I'm not getting you down am I?
------------------------------
Date: 25 Mar 1998 16:18:49 -0500
From: bens@chippewa.cis.ohio-state.edu (benjamin j snyder)
Subject: need regexp help
Message-Id: <6fbsbpINN7au@chippewa.cis.ohio-state.edu>
I am having trouble with a few things, mainly regexps.
I have the following line:
@id_info = split (/./,$value);
I *KNOW* $value has something in it, but @id_info has *NOTHING*. Shouldn't
@id_info[0] have *SOMETHING*, even if there were no '.' in the string? I have
tried using '.' instead of /./ in the split statement too...no change. lease
help.
Now for the regexp. The value of $value *SHOULD* be of the format aaa.nnnn I
need to make sure there is only one '.' and 4 n's (number of a's doesn't
matter). I thought about using the size of @id_info to determine if the number
of '.'s is more than 1, but since I can't seem to get any value for @id_info
that got sh*t-canned right away. I also need to make sure that all of the
characters (other than the one allowable '.') are alphanumeric.
I am a fledgling with regexps, and REALLY want to learn them, but can't seem to
pick it up out of a book (I have Learning PERL and Programming PERL by
O'Reilly). Could someone please let me know of a regexp I could use to do
this? Also, how about a WWW page that explains regexps fairly well? Either
post or mail (prefer mail, but post is fine too) please.
Thanks in advance for any help.
--
Ben Snyder
Student Programmer
Ohio Supercomputer Center
------------------------------
Date: 25 Mar 1998 21:41:25 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: need regexp help
Message-Id: <slrn6hiug5.3pr.Alain.Deckers@bashful.rediris.es>
In <6fbsbpINN7au@chippewa.cis.ohio-state.edu>,
benjamin j snyder <bens@chippewa.cis.ohio-state.edu> wrote:
>
>I am having trouble with a few things, mainly regexps.
>
>I have the following line:
>@id_info = split (/./,$value);
>
>I *KNOW* $value has something in it, but @id_info has *NOTHING*. Shouldn't
>@id_info[0] have *SOMETHING*, even if there were no '.' in the string? I have
>tried using '.' instead of /./ in the split statement too...no change. lease
>help.
Compare the output of the following two lines:
perl -e 'print map "$_\n", (split /./, q|abc.defg|)'
perl -e 'print map "$_\n", (split /\./, q|abc.defg|)'
There's one character in the second one that's not included in the first.
Alain
--
Perl reference: <URL:http://reference.perl.com/>
Perl language: <URL:http://language.perl.com/>
Perl archive: <URL:http://www.perl.com/CPAN/>
Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
------------------------------
Date: Wed, 25 Mar 1998 21:50:11 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: need regexp help
Message-Id: <6fbu5o$cj1@netaxs.com>
In article <6fbsbpINN7au@chippewa.cis.ohio-state.edu>,
benjamin j snyder <bens@chippewa.cis.ohio-state.edu> wrote:
>
>I am having trouble with a few things, mainly regexps.
>
>I have the following line:
>@id_info = split (/./,$value);
>
>I *KNOW* $value has something in it, but @id_info has *NOTHING*. Shouldn't
>@id_info[0] have *SOMETHING*, even if there were no '.' in the string?
Yes. But you aren't asking for what you think you're asking for.
Your saying split on any char and give me the stuff that is between
them. There isn't much between two adjacent chars. Try this instead.
@id_info = split (/\./,$value);
^
^
^
>>I have tried using '.' instead of /./ in the split statement too
WRONG, split wants a regex, not a string. There are some special cases
but '.' isn't one of them.
>Now for the regexp. The value of $value *SHOULD* be of the format aaa.nnnn
>I >need to make sure there is only one '.' and 4 n's
Something like this should do what you need. Note the '$' anchoring
the regex to the end of the pattern.
if ( /\w+\.\w{4}$/ )
{
}
--
Joel Coltoff
I'd explain it, but there's a lot of math. -- Calvin
------------------------------
Date: Wed, 25 Mar 1998 18:11:45 -0500
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: need regexp help
Message-Id: <35198F31.E2A6E11@order.booktraders.com>
benjamin j snyder wrote:
>
> I am having trouble with a few things, mainly regexps.
>
> I have the following line:
> @id_info = split (/./,$value);
>
> I *KNOW* $value has something in it, but @id_info has *NOTHING*. Shouldn't
> @id_info[0] have *SOMETHING*, even if there were no '.' in the string? I have
> tried using '.' instead of /./ in the split statement too...no change. lease
> help.
>
> Now for the regexp. The value of $value *SHOULD* be of the format aaa.nnnn I
> need to make sure there is only one '.' and 4 n's (number of a's doesn't
> matter). I thought about using the size of @id_info to determine if the number
> of '.'s is more than 1, but since I can't seem to get any value for @id_info
> that got sh*t-canned right away. I also need to make sure that all of the
> characters (other than the one allowable '.') are alphanumeric.
>
> I am a fledgling with regexps, and REALLY want to learn them, but can't seem to
> pick it up out of a book (I have Learning PERL and Programming PERL by
> O'Reilly). Could someone please let me know of a regexp I could use to do
> this? Also, how about a WWW page that explains regexps fairly well? Either
> post or mail (prefer mail, but post is fine too) please.
Get "Mastering Regular Expressions" (O'Reilly) as well.
>
> Thanks in advance for any help.
> --
> Ben Snyder
> Student Programmer
> Ohio Supercomputer Center
--
Birgitt Funk
------------------------------
Date: Wed, 25 Mar 1998 22:28:50 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
To: benjamin j snyder <bens@chippewa.cis.ohio-state.edu>
Subject: Re: need regexp help
Message-Id: <35198522.6008@world.northgrum.com>
{posted and mailed]
benjamin j snyder wrote:
>
> I am having trouble with a few things, mainly regexps.
>
> I have the following line:
> @id_info = split (/./,$value);
>
> I *KNOW* $value has something in it, but @id_info has *NOTHING*.
The Camel book *does* explain this pretty thoroughly. See also the
'perlre' man page that came with your copy of perl.
The thing you need to know here is that a period is one of the
special characters inside an RE. It represents ANY character except
a newline. So if you want to match an actual period in the data,
you have to "escape" it with a backslash:
@id_info = split (/\./,$value);
Otherwise that dot will absorb every character in the input
when you do a split.
--
Charles G. Margolin DSSD Internal Information Services
cmargoli@world.northgrum.com Northrop Grumman Corp. 0624/23
margolin@acm.org Hawthorne, California 90250-3277
------------------------------
Date: Wed, 25 Mar 1998 16:03:43 -0600
From: "Jeffrey T. Jones" <jjones@pmri.com>
Subject: Re: NT
Message-Id: <6fbv00$ce1$1@excalibur.flash.net>
You might also try Perl32 from activestate (http://www.activestate.com).
They a version that runs on WinNT, Win95. It also has PerlScript for ASP
and IIS.
Patrick <666@eudoramail.com> wrote in message <6faqr7$5du$1@news.NL.net>...
>Vinnie <browns1@borg.com> wrote:
>
>>We are running NT4.0 server on our machine. Where can I get a verision
>>of Pearl.exe that will run on my machine?
>
>NT users should use Diamond 3.2
>
>
------------------------------
Date: Wed, 25 Mar 1998 22:51:47 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Object destruction order non-deterministic?
Message-Id: <slrn6hj2hg.lob.jgloudon@manitoba.bbn.com>
Peter Scott <psf@euclid.jpl.nasa.gov> wrote:
>I was recently suprised by the order in which the DESTROY methods of
>two objects were called. The code was essentially:
>
> { my $a = new A; foo(); }
There shouldn't be a surprise. man perlref perlsub.
Your lexical $a is out of scope - so no references to the object you created
exists when the block is exited.
If you don't want it to be destroyed before the script exits, remove the { }.
Object "destruction" is deterministic no more references - no more object.
Though the references may be hard to spot.
> sub foo { my $b = new B; do_stuff; }
>yet A::DESTROY was called before B::DESTROY. I had (obviously
>incorrectly) assumed that the chain of events would be: $b goes out of
>scope when exiting sub foo, calls B::DESTROY; $a goes out of scope
>when exiting block in main program, calls A::DESTROY.
--
Jason Gloudon
------------------------------
Date: Wed, 25 Mar 1998 21:27:05 -0000
From: "Mark Stamps" <Mark_Stamps@scee.sony.co.uk>
Subject: Perl and ASP Response object under IIS
Message-Id: <890861301.11263.0.nnrp-06.c2d91211@news.demon.co.uk>
Hi,
I'm using Perl on an ASP on IIS and for reasons best known to me, I'm
getting the unparsed version of the data sent from a form. This all seems to
go okay until I start to manipulate it... The code snippets aren't the real
thing, it's just what I've reduced it to for working on this problem :(
If I do
<SNIP>
$RequestValues=$Request->Form;
# Sanity check to check what's being worked on
$Response->Write($RequestValues);
$Response->Write("<br>");
@RequestList=split /&/,$RequestValues;
$Response->Write("@RequestList");
<SNIP>
I get
StatusID=1&StatusID=2&B1=Submit
OLE=HASH(0x2950674)
Where as, if I actually specify the parameters that I know are being passed,
i.e.
$RequestValues="StatusID=1&StatusID=2&B1=Submit";
I get
StatusID=1&StatusID=2&B1=Submit
StatusID=1 StatusID=2 B1=Submit
Which is what I would expect...
Okay, so the question is, how do I convert the OLE thing into a real string
that Perl can handle so that the rest of my code can do it's job????
Please help, I'm going up the wall with this one :(
M
--
Mark Stamps
Producer
Sony Computer Entertainment Europe
------------------------------
Date: Wed, 25 Mar 1998 17:31:08 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Perl to read spreadsheet files
Message-Id: <19980325.173108.2z9.rnr.w164w@locutus.ofB.ORG>
Kevin Luff <kluff@enterprise.net> writes:
> I need to write some scripts to get info from lotus spreadsheet
> files onto a website. Is there any way of reading the files
> directly ?
see the comp.apps.spreadsheets FAQ for information on the Lotus
file formats. as far as I know, there are no perl modules to
read Lotus files directly (if there are, mail a URL for them
to the FAQ maintainer).
(and yes, I see the OLE module, but that seems particular to
Microsoft Excel files, and I haven't tried it.)
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 25 Mar 98 21:59:55 GMT
From: andre@argo.hks.com (David Andre)
Subject: Perl5 on Irix
Message-Id: <35197e5b.0@argo.hks.com>
I've tried looking at FAQ's and through the www.perl.com
pages but I've found nothing referencing this. I'm trying to
build a 64bit version of perl on an SGI machine running Irix
6.4. There is no irix_6_4.sh file in the hints directory. I
was wondering if anyone had any luck building this.
It fails with this error:
`sh cflags libperl.a pp.o` pp.c
CCCMD = cc -mips4 -64 -DPERL_CORE -c -DDEBUGGING
-DLANGUAGE_C -D_POSIX_SOURCE -O3 -g
"pp.c", line 1536: error(1070): incomplete type is not allowed
struct timeval when;
^
1 error detected in the compilation of "pp.c".
*** Error code 2 (bu21)
#
If anyone could help, I would really appreciate it. Or better yet,
if anyone has a hints file that I can use for an Irix 6.4 64 bit
IP27 processor, that would be even better. Am I asking the correct
people?? Also, if you need more information, like my config.sh file,
let me know and I'll send it to you.
If you have any advice, please email me: andre@hks.com
Thanks for any help you might provide.
-David
--
David Andre
<andre@hks.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 2181
**************************************