[12424] in Perl-Users-Digest
Perl-Users Digest, Issue: 6024 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 16 19:17:23 1999
Date: Wed, 16 Jun 99 16: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 Wed, 16 Jun 1999 Volume: 8 Number: 6024
Today's topics:
Bit Twiddling Troubles <whm10@amdahl.com>
Re: concatenate lines in a group of files (Greg Bacon)
connect() and firewall <lazar@micro.ti.com>
Re: connect() and firewall <rootbeer@redcat.com>
Re: cookies (Lee)
Re: How can I 'edit' a datafile? (Tad McClellan)
how to connect to an Oracle database via a cgi script w <todd.s.moore@boeing.com>
Re: how to connect to an Oracle database via a cgi scri <rootbeer@redcat.com>
Re: How to extract emails from Outlock Express <cassell@mail.cor.epa.gov>
Re: informix www dbi problem <gellyfish@gellyfish.com>
Re: Is it better perl than awk ? <jdporter@min.net>
Re: Is it better perl than awk ? (Kenny McCormack)
Re: memory question <rootbeer@redcat.com>
Re: MIcrosofts Attack on Perl <steve.horne1@bridge.bst.bls.com>
Re: Multidimensional Associative (hash) array <gellyfish@gellyfish.com>
Re: my and interpolation? <gellyfish@gellyfish.com>
Re: my and interpolation? <cassell@mail.cor.epa.gov>
Re: newbie learning "my" declarations <rootbeer@redcat.com>
Re: newbie learning "my" declarations (Mark-Jason Dominus)
Re: pattern matching question <cassell@mail.cor.epa.gov>
Re: Perl says "too many errors" but doesn't give me any <myparu@usa.net>
Probably simple, but pulling hair out <l463520@lmtas.lmco.com>
Regex Help Needed (John Frank)
Re: Regex Help Needed (Greg Bacon)
Re: sending to html page... <cassell@mail.cor.epa.gov>
Re: Socket Woes <gellyfish@gellyfish.com>
Re: SQL statement in Perl <gellyfish@gellyfish.com>
Re: What is functional difference between .pm and .pl? <gellyfish@gellyfish.com>
Re: writing results <gellyfish@gellyfish.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Jun 1999 15:41:06 -0700
From: Hal Mounce <whm10@amdahl.com>
Subject: Bit Twiddling Troubles
Message-Id: <37682802.926CE230@amdahl.com>
I'm having trouble turning on a couple of bits in a word.
Here's the code:
#!/opt/perl5/bin/perl
#
# each word has the following format:
# Byte 0 11.. .... flags 00 - plan to write to this block
# 01 - I/O to this block is complete
# 10 - good compare on this block
# 11 - special value in <2:31>
# Byte 0 ..11 1111 source block address <2:7>
# Byte 1 1111 1111 source block address <8:15>
# Byte 2 1111 1111 source block address <16:23>
# Byte 3 1111 1111 source block address <24:31>
sub build_logfile {
my ($num_blocks) = @_;
open(LOGFILE, "> /tmp/log") or die "$0: Can't open /tmp/log $!\n";
for ($i = 0; $i < $num_blocks; $i++) {
# cram our index into a 4 byte word
$bin = pack L, $i;
# turn on <0:1>
# $bin = $bin | 0xC0000000;
print LOGFILE $bin;
}
close LOGFILE;
return 0;
}
# lets try a 64k file
$target_blocks = 64;
build_logfile($target_blocks);
__END__
So, if I run with the $bin = $bin | 0xC0000000; line commented out, I
get a file of length 256, which looks like so:
+0 00000000 00000001 00000002 00000003
+10 00000004 00000005 00000006 00000007
...
+F0 0000003C 0000003D 0000003E 0000003F
Adding $bin = $bin | 0xC0000000; I expected a file of length 256 looking
like this:
+0 C0000000 C0000001 C0000002 C0000003
+10 C0000004 C0000005 C0000006 C0000003
...
+F0 C000003C C000003D C000003E C000003F
Instead, I get a file of length 640 with stuff like this:
+0 33323231 32323534 37323332 32313232
+10 35343732 33323231 32323534 37323332
....
+270 32323534 37323332 32313232 35343732
The data translate into ASCII characters, all numbers from 1 to 7
excluding 6. I'm sure this is trying to tell me something, but as my
native tongue is EBCDIC, it isn't registering. I'm running this under
HP-UX on a big endian, 64/32 bit machine (V2200).
Any clues are appreciated.
Regards,
Hal
------------------------------
Date: 16 Jun 1999 22:19:30 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: concatenate lines in a group of files
Message-Id: <7k97ti$olg$2@info2.uah.edu>
In article <7k92kb$vi0$1@nnrp1.deja.com>,
Maury <mej014@my-deja.com> writes:
: I wrote a script which takes a group of text files as input and
: concatenates lines in each file if the first character in the line is a
: '+', then writes the altered files back out. In other words, the file:
:
: Now is the time
: + for all good men
: + to come to
: + the aid of their country.
: Four score
: + and seven years ago.
: asdfsadf
: dfksfdkjfdsa
:
: becomes:
:
: Now is the time for all good men to come to the aid of their country.
: Four score and seven years ago.
: asdfsadf
: dfksfdkjfdsa
#! /usr/bin/perl -w
use strict;
$/ = "";
while (<>) {
s/\s*\n\+\s*/ /g;
print;
}
Enjoy,
Greg
--
The depths of idiocy are as yet unplumbed.
-- Larry Wall in <199612181938.LAA10214@wall.org>
------------------------------
Date: Wed, 16 Jun 1999 12:02:00 -0500
From: Marco Lazar <lazar@micro.ti.com>
Subject: connect() and firewall
Message-Id: <3767D887.1427175@micro.ti.com>
Hi,
I want to check some stocks on the web without using netscape. Therefore
I grabbed the following script from my perl book to get the contents of
an
html file. The problem is that we have a firewall here and as soon as
the
connect() functions is invoked it dies with "connection refused".
So how do I get through the firewall ?
#! /usr/local/bin/perl
use Socket;
$url = "http://finance.yahoo.com/q?s=TXN+CPQ&d=v1";
if ($url !~ m!http://(.+?)/(.*)!) {
die "not valid URL\n";
}
$hostname = $1;
$path = $2;
# we ignore the "host:port" notation,
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or die
"socket(): $!\n";
$paddr = sockaddr_in(80, inet_aton($hostname));
connect(SOCK, $paddr) or die "connect(): $!\n";
select (SOCK); $| = 1; #unbuffer i/o
#send the HTTP-Request
print SOCK "GET $path HTTP/1.0\n\n";
# now read the entire response:
$buf = $totbuf = "";
while (read(SOCK, $buf, 1)) {
$totbuf .= $buf;
}
# $totbuf must be stripped off the HTTP-Header
$posentity = index($totbuf, "\r\n\r\n") + 4;
$totbuf = substr($totbuf, $posentity, length($totbuf)-$posentity);
# print $totbuf to STDOUT
syswrite (STDOUT, $totbuf, length($totbuf));
close (SOCK);
------------------------------
Date: Wed, 16 Jun 1999 15:46:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: connect() and firewall
Message-Id: <Pine.GSO.4.02A.9906161545410.26850-100000@user1.teleport.com>
On Wed, 16 Jun 1999, Marco Lazar wrote:
> I grabbed the following script from my perl book to get the contents
> of an html file.
> use Socket;
>
> $url = "http://finance.yahoo.com/q?s=TXN+CPQ&d=v1";
> if ($url !~ m!http://(.+?)/(.*)!) {
Use LWP instead. You'll find it on CPAN. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jun 1999 17:44:53 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: cookies
Message-Id: <B38D931596686F3FA@0.0.0.0>
In article <7k92tq$16t$1@autumn.news.rcn.net>,
"Leonid Goltser" <leonid76@erols.com> wrote:
>Where can I find some kind of tutoring to make cookies with perl?
http://home.netscape.com/newsref/std/cookie_spec.html
will tell you about cookies.
http://www.perl.com
will tell you about Perl.
Put them together, and you've got cookies in Perl.
Or, you could run down to http://www.amazon.com and get The Perl Cookbook
(recipe 19.10), and you'll need Learning Perl, too, if you're a perl
newbie, and the CGI.pm book, if you're going to be doing a lot of CGI work.
Then, if your Perl code gives errors you can't fix, you ask here (after
checking FAQs, docs and www.deja.com). If the Perl code compiles, runs and
produces what you think it should but the cookies don't work or the server
complains to your browser, go to:
comp.infosystems.www.authoring.cgi
or
comp.infosystems.www.servers.*
Lee
------------------------------
Date: Wed, 16 Jun 1999 13:00:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How can I 'edit' a datafile?
Message-Id: <18l8k7.8bh.ln@magna.metronet.com>
AJ (jhawk39@idt.net) wrote:
: I want the script to take data
: from the form (using those 3 elements)...find the line in the datafile
: and replace it with the new information.
: I simply cannot figure out a way to do this.
Hmmm...
: Any general suggestions on ways to go about this?
Perl FAQ, part 5:
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
: Thanks for any help,
Uh huh.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 16 Jun 1999 21:36:34 GMT
From: Todd Moore <todd.s.moore@boeing.com>
Subject: how to connect to an Oracle database via a cgi script written in Perl
Message-Id: <376818E2.2E4C2A4A@boeing.com>
Does anyone know how to connect to an Oracle database via a cgi script
written in Perl without using DBD:Oracle or Oraperl?
Can it be done using SQL*Plus?
I have perl, sql*plus and oracle on a server. I can't install
DBD:Oracle or Oraperl or any module...because I'm not the server
administrator. They're not very cooperative.
Can it be done?
Thanks...
Todd
------------------------------
Date: Wed, 16 Jun 1999 15:53:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to connect to an Oracle database via a cgi script written in Perl
Message-Id: <Pine.GSO.4.02A.9906161547580.26850-100000@user1.teleport.com>
On Wed, 16 Jun 1999, Todd Moore wrote:
> Does anyone know how to connect to an Oracle database via a cgi script
> written in Perl
The same way you do so from a non-cgi script.
> without using DBD:Oracle or Oraperl?
This is like asking how to get from Hawaii to Kansas without using an
airplane. You _can_ do without, but you probably shouldn't try.
> Can it be done using SQL*Plus?
Maybe you should check with the docs, FAQs, and newsgroups about SQL*Plus.
> I can't install DBD:Oracle or Oraperl or any module...because I'm not
> the server administrator.
You don't have to be the system administrator to install modules, but it
helps. (If you can't install the module, how could you install code which
does what the module does?)
> They're not very cooperative.
Who, the system administrators? If your sysadmin can't or won't install
software, upgrade. But maybe you're not applying the proper amount of
pizza and beer. Admins respond well to such things.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jun 1999 15:04:43 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Mosl Roland <founder@pege.org>
Subject: Re: How to extract emails from Outlock Express
Message-Id: <37681F7B.71600544@mail.cor.epa.gov>
[courtesy cc sent to poster]
Mosl Roland wrote:
>
> I would like to extract all emails from
> Outlock Express 5 and store the
> messages in an own database system.
Isn't that 'Outlook' Express? Although I usually
call it Lookout! Express or Outlook Distress. :-)
> First step: how to extract from the
> Outlock Express files?
I think that you'll want to look in the ActivePerl FAQ at
the section entitled "Using OLE with Perl". There's
even a specific example on working with OE.
Then you can get more help from the Perl-Win32-users
listserv, to which you can subscribe at
http://www.activestate.com/support/mailing_lists.htm .
The folks there have a lot of experience in Perl and
OLE. In fact, the author of Win32::OLE is a regular
reader of the list.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 16 Jun 1999 22:42:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: informix www dbi problem
Message-Id: <7k999d$5b8$1@gellyfish.btinternet.com>
On Wed, 16 Jun 1999 20:36:31 GMT todd_downing@my-deja.com wrote:
> accessing informix on redhat 5.2 from perl dbi using the
> command line works fine. however, when calling from html
> page, i get the following log message:
>
> install_driver(Informix) failed: Can't load
> '/usr/lib/perl5/site_perl/i386-linux
> /auto/DBD/Informix/Informix.so' for module DBD::Informix: libifsql.so:
> cannot op
> en shared object file: No such file or directory at
> /usr/lib/perl5/i386-linux/5.
> 00404/DynaLoader.pm line 168.
>
> this happens at the $dbh = DBI-connect('DBI:Informix:dbname'); line in
> my script.
>
Well ... I've got DBD::Informix installed here and I dont have that file
on my system at all - you might want to do a find to see if the file
is present *anywhere*. I also have
$INFORMIXDIR/lib
and
$INFORMIXDIR/lib/esql
in my ld.so.conf.
Other than that you may well have to reinstall the module I'm afraid.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 16 Jun 1999 21:20:19 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Is it better perl than awk ?
Message-Id: <7k94e7$d0$1@nnrp1.deja.com>
In article <376705c1@cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> churchyh@ccwf.cc.utexas.edu (Henry Churchyard) writes:
> :--%!PS
> :10 10 scale/M{rmoveto}def/R{rlineto}def 12 45 moveto 0 5 R 4 -1 M 5.5
0 R
> :currentpoint 3 sub 3 90 0 arcn 0 -6 R 7.54 10.28 M 2.7067 -9.28 R
-5.6333
> :2 setlinewidth 0 R 9.8867 8 M 7 0 R 0 -9 R -6 4 M 0 -4 R stroke
showpage
>
> I don't believe I've seen a signature this interesting in a while.
> Although the "stroke showpage" caused me to slightly fear a
pornattack,
> I looked anyway, and can't quite make out what the glyphs are
producing.
It's "Henry", written in highly stylized Hebrew characters.
[Sorry about the linewrapping. $#!&&y Dejanews...]
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 16 Jun 1999 17:42:47 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: Is it better perl than awk ?
Message-Id: <7k9997$dke$1@yin.interaccess.com>
In article <x7emjcdko5.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
....
>i don't want this to become a flame war like we have seen with perl
>vs. (python, lisp, c++, your favorite langauge).
So then, why are we?
>perl and awk/sed don't
>even occupy the same problem space so comparing them is moot.
Oh, please, do say more. Actually, I do kinda know what you mean -
which is that perl has evolved, both in terms of its applications and
its image, from its roots as a "bigger, better, AWK" to being a general
purpose programming language (essentially, a "smaller, leaner, [*] C")
But don't forget what PERL, the acronym, stands for.
I'd be just as happy if Perl were never discussed in the AWK newsgroup,
but the fact of the matter is that it is frequently used to solve the
same sorts of problems as is AWK, so the comparisons are inevitable.
[*] Read, "slightly less cryptic"
------------------------------
Date: Wed, 16 Jun 1999 15:17:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: memory question
Message-Id: <Pine.GSO.4.02A.9906161509020.26850-100000@user1.teleport.com>
On Wed, 16 Jun 1999, Ala Qumsieh wrote:
> Note that undef()ing a scalar
[snip]
> actually undefines the scalar, so any access to it will result in a
> warning.
Not really _any_ access. Just use of the undefined value in ways that
aren't reasonable. (Of course, that's "reasonable" as it seemed at the
time to the person who coded that warning into Perl. It's just a touch
subjective. :-)
undef($fred); # $fred is now undefined
$barney = $fred; # no warning. $barney is undefined
$barney++; # no warning. $barney is 1
print "okay\n" unless $fred; # no warning. prints.
print $fred; # warning, since $fred was undefined
$wilma = $barney + $fred; # same warning, reason
But this doesn't really have to do with variables so much as with values.
sub gives_undef {
return undef; # could be simpler...
}
$wilma = gives_undef; # no warning
$wilma = $barney + gives_undef; # warns
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jun 1999 17:24:49 -0500
From: Steve Horne <steve.horne1@bridge.bst.bls.com>
Subject: Re: MIcrosofts Attack on Perl
Message-Id: <37682431.451CB2A8@bridge.bst.bls.com>
"Paul M. Parks" wrote:
>
> There are those of us who, when developing an application with Visual C++,
> prefer to drop the "Visual" altogether and use the language as it was
> intended. Don't count me out.
Oh no, I tried to be careful to say that VC++ experience doesn't count
against you. Usually, a few technical questions during an interview
will separate the wheat from the chaff. I mean, as much as I _hate_
Microsoft, I have used VC++ and it's a neat tool.
I just don't want people to forget their penmanship now that they have
Word. And that's the difference between C++ and VC++ to me...
-Steve
------------------------------
Date: 16 Jun 1999 22:04:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Multidimensional Associative (hash) array
Message-Id: <7k971e$54l$1@gellyfish.btinternet.com>
On Wed, 16 Jun 1999 17:49:21 GMT jtubaugh@cftnet.com wrote:
>Does anybody know of a way to store a hash array within another hash
> array?
>
> What I want to do is define a hash array like this:
>
> %ARRAY1 = ("key1","value1", "key2","value2");
>
> Then store it in a second array:
>
> %ARRAY2 = ("key1", %ARRAY1);
>
%ARRAY2 = ('key1', \%ARRAY1);
You need to store a *reference* to the original hash as the value.
You could define this whole thing like:
%hash = (
'key1' => {
'key1' => 'value1',
'key2' => 'value2'
},
'key2' => {
'key1' => 'value1',
'key2' => 'value2'
}
);
Check out the perldsc, perlref manpages for more on this .
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Jun 1999 21:57:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: my and interpolation?
Message-Id: <7k96kg$538$1@gellyfish.btinternet.com>
On 16 Jun 1999 12:39:37 -0600 Eric The Read wrote:
> Nenad Vidovic <nenad@halcyon.ca> writes:
>> However this does not:
>>
>> $compression = "gz";
>> my $file_size_gz = "3";
>> $file_size = ${"file_size_$compression"}
>> print "$file_size\n";
>>
>> Anybody have any ideas why this doesn't work. Thanks for helping out?
>
> Because you're trying to do symbolic references, which are Very Very
> Bad(tm). One of their major failings is that they only work on package
> variables, so variables declared with "my", which are lexical, can't be
> referred to in this manner.
>
Is it my imagination or has there been a plague of Symbolic References
recently ? If so what has given rise to it just now - perhaps we should
be asking people what made them think they wanted to do that.
Another example of 'Viral Cargo Code' perhaps ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 16 Jun 1999 15:40:44 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: my and interpolation?
Message-Id: <376827EC.D3DBF3B8@mail.cor.epa.gov>
[courtesy cc sent to poster]
Jonathan Stowe wrote:
> [snip]
>
> Is it my imagination or has there been a plague of Symbolic References
> recently ? If so what has given rise to it just now - perhaps we should
> be asking people what made them think they wanted to do that.
Maybe it's another sign of the Apocalypse. It will be followed
by the plague of Irrelevant Web Questions if I recall my Old
Testament correctly.
> Another example of 'Viral Cargo Code' perhaps ?
Probably. It turns out that the bad CGI-script date code we've
all been bashing as non-Y2K-compliant is circulating amongst
web coders in a popular get_date function.
Who knew? :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 16 Jun 1999 15:03:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: newbie learning "my" declarations
Message-Id: <Pine.GSO.4.02A.9906161459500.26850-100000@user1.teleport.com>
On Wed, 16 Jun 1999, Lee wrote:
> In article <Pine.GSO.4.02A.9906161332510.26850-100000@user1.teleport.com>,
> Tom Phoenix <rootbeer@redcat.com> wrote:
>
> >> With -w, my $total; $total = $total + 1; gives a warning.
> >
> >At least, it gives a warning unless it gives the wrong answer. (That is,
> >unless the answer it happens to give happens to be the answer you happen
> >to want. :-)
Ack! I misread the line. I meant to say that
my $total = $total + 1;
is evilly confusing, as it tries to access two variables with the same
name on the same line of code.
> my $total; $total = $total + 1;
>
> and
>
> my $total; $total++;
> I don't understand why the latter is not a warnable offence.
I'm not sure why you think it should be. Incrementing from undef to one is
a legitimate operation in the world of Perl. Having said that, though,
I'll say that _every_ warning is a matter of opinion. Some opinions are
just more right than others, that's all.
Thanks for keeping me honest!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 16 Jun 1999 22:24:33 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: newbie learning "my" declarations
Message-Id: <7k9860$bb8$1@monet.op.net>
In article <FDFr7y.3JL@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <7k8o7n$8sj$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>> my $total = $total + 1;
>
>or, even: my $total += 1;
Yeah, but someone should point out that that's not at all the same as
what I said.
------------------------------
Date: Wed, 16 Jun 1999 15:26:05 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: pattern matching question
Message-Id: <3768247D.C9E9E7A9@mail.cor.epa.gov>
Greg Bacon wrote:
>
> In article <xkfemjblvx0.fsf@valdemar.col.hp.com>,
> Eric The Read <emschwar@rmi.net> writes:
> : gbacon@itsc.uah.edu (Greg Bacon) writes:
> : > If you're determined to use a regular expression
> : >
> : > ($path = $url) =~ s,^.*?//.*?/,,;
> :
> : It's entirely possible that those are the ugliest delimiters I've ever
> : seen for s///.
>
> No one ever accused Perl of being a beauty pageant. :-)
Now I'm hurt. I was told *my* delimiters were the worst ever
a few weeks ago, when I used s### in a similar problem.
Oh well, these kids today, with their commas and newfangled
inventions and such...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 16 Jun 1999 18:01:10 -0400
From: murali <myparu@usa.net>
Subject: Re: Perl says "too many errors" but doesn't give me any
Message-Id: <37681EA6.B5760FBA@usa.net>
I got the same error when I 'require'd sybperl.pl in my script ( I am not
sure if this is a standard distribution file or something written by one
of our guys. ), and the libraries reqd were not in the $LD_LIBRARY_PATH,
so sybperl.pl couldnt locate them.
murali
Ken Causey wrote:
> I'm using Perl 5.004_04 for i386-linux.
>
> I'm building a moderately large program (~5000 lines) and have split
> it up into multiple .pl files which are included in the main .cgi
> file using "require" (it's a CGI script of course). Everything was
> going pretty well but debugging was getting more and more difficult
> as the program got larger, so I thought it was time to start using
> packages and "use strict". I had to do quite a bit of retrofitting to
> get everything to have package identifiers and so on. I've
> finished the bulk of this and now am just going through and fixing the
> handful of lines I missed. For some reason however, I'm getting a
> strange error situation where perl bombs with "contents.pl has
> too many errors." but I get absolutely no error messages.
> "contents.pl" is one of the "require"d files by the way. I've tried
> the -w switch which reports a bunch of "only used once...might
> be a typo"s and a few complaints about missing quotes on words
> being deprecated, but absolutely nothing about contents.pl. I'm
> new to the debugger but can't find anything there which gives
> me any more information.
>
> Any help is greatly appreciated.
------------------------------
Date: Wed, 16 Jun 1999 17:37:42 -0500
From: Michael Hill <l463520@lmtas.lmco.com>
Subject: Probably simple, but pulling hair out
Message-Id: <37682736.285DFBC2@lmtas.lmco.com>
In my perl script I am trying to pass the value that is being stored to
my variable.
$myvalue="fresh";
print '<input type=hidden name="myfield" value=$myvalue>';
Of course what I get is $myvalue and not fresh.
Thanks, Mike
------------------------------
Date: Wed, 16 Jun 1999 22:08:38 GMT
From: jwfrank@toad.net (John Frank)
Subject: Regex Help Needed
Message-Id: <GfV93.321$Ty4.912@newsfeed.slurp.net>
I have 2 types of files in a long html page. They are
quite similar. One is s_a***.html and the other is a***.html.
I want to change the names of the a***.html files but not the
s_a*** files. If I use s/a*\.html/a*\.xyz/g; it changes
both files. I tried using s/\Wa*\.hmtl/a*\.html/g; but that
won't work. Any help here is appreciated. I'm still feeling
my way in Perl.
Jack
------------------------------
Date: 16 Jun 1999 22:21:15 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Regex Help Needed
Message-Id: <7k980r$olg$3@info2.uah.edu>
In article <GfV93.321$Ty4.912@newsfeed.slurp.net>,
jwfrank@toad.net (John Frank) writes:
: I have 2 types of files in a long html page. They are
: quite similar. One is s_a***.html and the other is a***.html.
: I want to change the names of the a***.html files but not the
: s_a*** files.
my @files_to_change = grep { ! /s_a...\.html$/ } <*a???.html>;
Greg
--
Two most common elements in the universe: Hydrogen & Stupidity.
------------------------------
Date: Wed, 16 Jun 1999 15:34:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Jeff Bowers <jbowers@bsat.com>
Subject: Re: sending to html page...
Message-Id: <37682659.D4019C3B@mail.cor.epa.gov>
[courtesy cc sent to poster]
Jeff Bowers wrote:
>
> Actually... I just want a .pl script in cgi-bin to "send" a web page back to
> the users browser on a Proper exit. I did find something in the Perl pages,
> buts it's a bit obscure about a CPAN CGI.pm module. I'm trying that
> route at this time. That instruction was at ...
> > ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/doc/manual/html/pod/perlfaq9.html#How_do_I_redirect_to_another_pag
>
> but I must not have the appropriate module pre-compiled as the sample syntax
> don't woik.
Jeff, you really ought to have a local copy of Perl to play with.
It will make life a lot easier. In particular, you should always
prefer testing CGI scripts at the command line to messing with
server logs _a_posteriori_ .
And if you do have a local copy, you have all the docs already
installed (unless some sysadmin did A Bad Thing). If you have
ActiveState Perl, you have all the docs in an HTML tree with a
shortcut on your Start Menu. If you don't have all the docs,
go to CPAN and grab a copy of the docs in whichever format you
prefer (including HTML). Or install ActiveState Perl and get
them for free.
CGI.pm is a really handy module for doing CGI scripts (of course).
Grab it and read its docs. While some experts feel it could be
smaller for their personal purposes, you'll probably find that
its wealth of functions makes it very valuable. It will let
you do your CGI script testing at the command line too, which
can save you a lot of wear and tear on your cerebrum.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 16 Jun 1999 20:26:12 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Socket Woes
Message-Id: <7k9194$4pq$1@gellyfish.btinternet.com>
On Mon, 14 Jun 1999 11:14:59 -0400 Morgan Whaley wrote:
> I am writing a server pgm & need to determine the absence vs. presence of a
> client connection to a server socket.
>
> This loop will occur after the server socket has been established & an
> accept has been received.
>
> I've tried
>
> while (<CLIENT>){
> ....
> }
>
If your socket is opened correctly and unless you either check for
some condition in your loop or the other end is closed then potentially
this will never terminate.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Jun 1999 21:03:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: SQL statement in Perl
Message-Id: <7k93fi$4q0$1@gellyfish.btinternet.com>
On Wed, 16 Jun 1999 13:22:53 -0400 Craig Ciquera wrote:
> paulm@dirigo.com wrote:
>
>> Does this require the DBI.pm file?
>>
>
> Yes and the DBD Oracle driver.
>
Which, with a recent Activestate Perl can be installed like :
ppm install DBD-Oracle
If you have problem with PPM then you should consult the documentation
that is installed as HTML under the "Active Perl" shortcut in your start
menu.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Jun 1999 22:23:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: What is functional difference between .pm and .pl?
Message-Id: <7k985t$55q$1@gellyfish.btinternet.com>
On Wed, 16 Jun 1999 11:56:26 GMT Bart Lateur wrote:
> Neil wrote:
>
>> I understand that
>>foo.pm is a "perl module" but what distinguishes this from
>>a "perl script"?
>
> It's "required" before the rest of the script is run, and
>
> It MAY contain a sub import(), which is run too, just after the file is
> required.
>
> What I don't understand, is why "import" is in lower case. Probably old
> age, but as far I I understand, any user code that is automatically
> invoked by perl should be all uppercase. That's the convention, anyway.
>
But import() is in the perlfunc manpage and all those upper case ones
arent - of course that isnt the reason but implies a different status
for the function ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Jun 1999 23:16:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: writing results
Message-Id: <7k9b8n$5bv$1@gellyfish.btinternet.com>
On 16 Jun 1999 19:41:00 GMT Twarren10 wrote:
> Again, I am actually quite new to this (as you no doubt can tell) so you lost
> me a bit. I am writing results to an html display file. Do I have to change to
> another output? I'm getting the same screen write delay using
> select((select(OUTPUT_HANDLE), $| = 1)[0]);
>
Ah that ole 'traditional idiom' ;-} - In a program where you are only
writing to STDOUT (as you might with the CGI) it generally will suffice
to do :
$| = 1;
Perl will do its part of the deal but if you are still getting a delay
then its probably something outside of Perls control (such a server program)
that is causing that delay - if that is the case you will probably want
to ask in a group such as comp.infosystems.www.authoring.cgi or look in
the CGI FAQ - <http://www.webthing.com/tutorials/cgifaq.html>.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6024
**************************************