[13815] in Perl-Users-Digest
Perl-Users Digest, Issue: 1225 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 29 21:05:49 1999
Date: Fri, 29 Oct 1999 18:05:28 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941245528-v9-i1225@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 29 Oct 1999 Volume: 9 Number: 1225
Today's topics:
Re: [offtopic] English <nobody@nowhere.net>
Re: AP module subroutines not available??? (Eric Bohlman)
Re: close() is expensive <wyzelli@yahoo.com>
Re: create hash for db index?? <shmooth@yahoo.com>
DBD::Oracle install error... <moya@dreamhouse.co.kr>
Re: decode $ENV{'HTTP_WEFERER'}? <cassell@mail.cor.epa.gov>
Re: Embedding perl <cassell@mail.cor.epa.gov>
Func works first time but not second <nobody@nowhere.net>
Re: great regex strips quotes... but... (Abigail)
Re: great regex strips quotes... but... (Abigail)
Re: How do you compare like grep does? <cassell@mail.cor.epa.gov>
How the heck does this regex match? <dgarstan@nsw.bigpond.net.au>
Re: It is always like this here? <cassell@mail.cor.epa.gov>
Re: It is always like this here? (Martien Verbruggen)
Re: It is always like this here? <wyzelli@yahoo.com>
Re: Just to get rid of dos prompt window. (Bart Lateur)
Re: mod perl anomalies <tom@tnunn.demon.co.uk>
Re: open MYFILE, ">-" doesn't work in CGI? <wyzelli@yahoo.com>
pass file handle <nobody@nowhere.com>
pass file handle <nobody@nowhere.com>
Re: pass file handle (Bill Moseley)
Re: pass file handle <lr@hpl.hp.com>
Re: Perl assoc. array file database error... help pleas <cassell@mail.cor.epa.gov>
Re: Perl assoc. array file database error... help pleas (Bill Moseley)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 30 Oct 1999 00:18:51 GMT
From: Stephen Lee <nobody@nowhere.net>
Subject: Re: [offtopic] English
Message-Id: <381A39A8.9B4D68C@nowhere.net>
Jeff Pinyan wrote:
>
> > >: > : $B%U(B hope anyone of you can answer my question,
> > >: > : and mildly ignore it's dumbness .
>
> > Sorry for being off-topic, but can you explain why you are frustrated?
> > I don't see any possessive "its" in the original quote...
>
> The contraction "it's" means "it is". The possessive "its" means
> something belonging to "it". "Please ignore its dumbness" is correct use
> of possessive its. "Please ignore; it's dumb" is correct use of the
> contraction.
I see it now. I misread "dumbness" as "dumb-ass"...
Pardon my brainfart.
Thanks
Stephen
------------------------------
Date: 30 Oct 1999 00:00:25 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: AP module subroutines not available???
Message-Id: <7vdcep$esp$1@nntp5.atl.mindspring.net>
richardstands@my-deja.com wrote:
: #!/usr/bin/perl -w
: BEGIN
: {
: unshift( @INC,"D:\\Perl\\lib" );
: }
: use CARP;
Module names are case-sensitive, and the module you want is 'Carp' not
'CARP'.
: croak( "croaking" );
: exit 1;
:
: Running this gave this:
:
: Undefined subroutine &main::croak called at test.pl line 7.
:
: Curiously, when I add CGI to it that part works:
Of course, because the CGI module really does have an all-upper-case name.
------------------------------
Date: Sat, 30 Oct 1999 09:57:13 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: close() is expensive
Message-Id: <CXqS3.11$MV2.1269@vic.nntp.telstra.net>
Peter Sakalaukus <sakalauk@ssc.usm.edu> wrote in message
news:3819FFAE.A2EECEC@ssc.usm.edu...
>
> I wrote a script to parse a data file and write out 1 record at a time
> to a temporary file. Via a system() call, another program is run with
> the temporary file as the input.
>
> By removing the close OUT; statement from my code, it ran significantly
> faster. Why is close() so costly?
>
> ...Pete
Doesn't that depend on where in the script the 'close' is?
Do you close the file after every write?
Post a segment of your code so is can be commented on.
Wyzelli
------------------------------
Date: Sat, 30 Oct 1999 01:01:27 GMT
From: Shmooth <shmooth@yahoo.com>
Subject: Re: create hash for db index??
Message-Id: <2CC88325.DCF69CAB@yahoo.com>
>
> Perhaps if you need to do something with Oracle, you would have to
> make yourself familiar with it?
>
it's called overstatement, Abiguile. Most programmers I know are familiar with
_it_...
------------------------------
Date: Sat, 30 Oct 1999 09:24:48 +0900
From: moya <moya@dreamhouse.co.kr>
Subject: DBD::Oracle install error...
Message-Id: <381A3AD0.CC5E9AE2@dreamhouse.co.kr>
MIME Çü½ÄÀÇ ¸ÖƼ-ÆÄÆ® ¸Þ½ÃÁöÀÔ´Ï´Ù.
--------------99C4C6659771E143936684A7
Content-Type: text/plain; charset=EUC-KR
Content-Transfer-Encoding: 7bit
OS HPUX 11.0
Oracle 805 64bits
perl 5.005_03 & 5.005_62
please.... ^^
--------------99C4C6659771E143936684A7
Content-Type: text/plain; charset=EUC-KR; name="perl_make"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="perl_make"
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/lib/DBD
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/DBD
mkdir ./blib/arch/auto/DBD/Oracle
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/DBD
mkdir ./blib/lib/auto/DBD/Oracle
mkdir ./blib/man1
mkdir ./blib/man3
cp Oraperl.pm ./blib/lib/Oraperl.pm
cp Oracle.pm ./blib/lib/DBD/Oracle.pm
cp perl_makefile.pl ./blib/lib/DBD/perl_makefile.pl
cp oraperl.ph ./blib/lib/oraperl.ph
/usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" < /usr/local/lib/perl5/site_pe=
rl/PA-RISC2.0/auto/DBI/Driver.xst > Oracle.xsi
/usr/bin/perl -I/usr/local/lib/perl5/PA-RISC2.0/5.00405 -I/usr/local/lib=
/perl5 /usr/local/lib/perl5/ExtUtils/xsubpp -typemap /usr/local/lib/perl=
5/ExtUtils/typemap Oracle.xs >Oracle.tc && mv Oracle.tc Oracle.c
cc -c -I/oracle/app/oracle/product/805/rdbms/demo -I/oracle/app/oracle/p=
roduct/805/rdbms/public -I/oracle/app/oracle/product/805/plsql/public -I/=
oracle/app/oracle/product/805/network/public -I/oracle/app/oracle/product=
/805/rdbms/demo -I/oracle/app/oracle/product/805/rdbms/demo -I/usr/local/=
lib/perl5/site_perl/PA-RISC2.0/auto/DBI -D_HPUX_SOURCE -Ae -O -DVERSI=
ON=3D\"1.01\" -DXS_VERSION=3D\"1.01\" +z -I/usr/local/lib/perl5/PA-RISC2=
=2E0/5.00405/CORE Oracle.c
cc -c -I/oracle/app/oracle/product/805/rdbms/demo -I/oracle/app/oracle/p=
roduct/805/rdbms/public -I/oracle/app/oracle/product/805/plsql/public -I/=
oracle/app/oracle/product/805/network/public -I/oracle/app/oracle/product=
/805/rdbms/demo -I/oracle/app/oracle/product/805/rdbms/demo -I/usr/local/=
lib/perl5/site_perl/PA-RISC2.0/auto/DBI -D_HPUX_SOURCE -Ae -O -DVERSI=
ON=3D\"1.01\" -DXS_VERSION=3D\"1.01\" +z -I/usr/local/lib/perl5/PA-RISC2=
=2E0/5.00405/CORE dbdimp.c
cc -c -I/oracle/app/oracle/product/805/rdbms/demo -I/oracle/app/oracle/p=
roduct/805/rdbms/public -I/oracle/app/oracle/product/805/plsql/public -I/=
oracle/app/oracle/product/805/network/public -I/oracle/app/oracle/product=
/805/rdbms/demo -I/oracle/app/oracle/product/805/rdbms/demo -I/usr/local/=
lib/perl5/site_perl/PA-RISC2.0/auto/DBI -D_HPUX_SOURCE -Ae -O -DVERSI=
ON=3D\"1.01\" -DXS_VERSION=3D\"1.01\" +z -I/usr/local/lib/perl5/PA-RISC2=
=2E0/5.00405/CORE oci7.c
cc -c -I/oracle/app/oracle/product/805/rdbms/demo -I/oracle/app/oracle/p=
roduct/805/rdbms/public -I/oracle/app/oracle/product/805/plsql/public -I/=
oracle/app/oracle/product/805/network/public -I/oracle/app/oracle/product=
/805/rdbms/demo -I/oracle/app/oracle/product/805/rdbms/demo -I/usr/local/=
lib/perl5/site_perl/PA-RISC2.0/auto/DBI -D_HPUX_SOURCE -Ae -O -DVERSI=
ON=3D\"1.01\" -DXS_VERSION=3D\"1.01\" +z -I/usr/local/lib/perl5/PA-RISC2=
=2E0/5.00405/CORE oci8.c
Running Mkbootstrap for DBD::Oracle ()
chmod 644 Oracle.bs
LD_RUN_PATH=3D"/oracle/app/oracle/product/805/lib:/lib" ld -o ./blib/arc=
h/auto/DBD/Oracle/Oracle.sl -b -L/usr/local/lib Oracle.o dbdimp.o oci7=
=2Eo oci8.o /oracle/app/oracle/product/805/rdbms/lib/ssdbaed.o /oracle/a=
pp/oracle/product/805/rdbms/lib/defopt.o /oracle/app/oracle/product/805/l=
ib/nautab.o /oracle/app/oracle/product/805/lib/naeet.o /oracle/app/oracle=
/product/805/lib/naect.o /oracle/app/oracle/product/805/lib/naedhs.o -l:l=
ibcl.a -L/oracle/app/oracle/product/805/lib/ -lclntsh -lnetv2 -lnttcp =
-lnetwork -lncr -lnetv2 -lnttcp -lnetwork -lclient -lvsn -lcommon -lgener=
ic -lmm -lnlsrtl3 -lcore4 -lnlsrtl3 -lcore4 -lnlsrtl3 -lnetv2 -lnttcp -ln=
etwork -lncr -lnetv2 -lnttcp -lnetwork -lclient -lvsn -lcommon -lgeneric =
-lepc -lnlsrtl3 -lcore4 -lnlsrtl3 -lcore4 -lnlsrtl3 -lclient -lvsn -lcomm=
on -lgeneric -lnlsrtl3 -lcore4 -lnlsrtl3 -lcore4 -lnlsrtl3 -lrt -lpthread=
-ldld -lm -lpthread -lpthread =
*** Error exit code 1
--------------99C4C6659771E143936684A7--
------------------------------
Date: Fri, 29 Oct 1999 15:37:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: decode $ENV{'HTTP_WEFERER'}?
Message-Id: <381A21AF.9BE1816B@mail.cor.epa.gov>
Eric The Read wrote:
>
> Vadim Kulakov <vadim@sns.ru> writes:
> > How can I decode the string (Apache/1.3.4 (Unix)):
> > HTTP_WEFERER=HYUCDDJBLVLMHAALPTCXLYRWTQTIPWIGYOKSTT
>
> Use the module HTTP::Wascawwy::Wabbits
heh-heh-heh-heh-heh-heh
David, "scwewy wabbit..."
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 29 Oct 1999 15:20:41 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Embedding perl
Message-Id: <381A1DB9.C5B0C27E@mail.cor.epa.gov>
Jeff Sack wrote:
>
> Hi, sorry if this post is a duplicate. I'm working on a project that has a
> Java GUI and perl guts on Win32. I'm (finally) able to embed perl into Java
> (via C), but when I try to use a perl module, I get an error message like
> this:
[snip of rest]
You may want to consider JPL, the Java-Perl Lingo written by
Larry Wall himself. [Or is that 'Himself'?] Try CPAN or
O'Reilly for it. It should let you integrate your front and
back ends better.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 29 Oct 1999 22:26:59 GMT
From: Stephen Lee <nobody@nowhere.net>
Subject: Func works first time but not second
Message-Id: <381A1F70.F8D8255C@nowhere.net>
In the spirit of re-inventing the wheel :) I tried to write a CGI that
extracts today's comics for me, but ran into some problems.
The subroutine get_pic works on the first call, getting the right URL, but
not the second. I think my regexes are correct because if I swap the
lines marked (1) and (2) it gets the correct link for the first call only
also.
Can anybody tell me what is wrong about my script? I tried printing $url
and $re in get_pic and they seem to have the right value.
BTW, I use UserAgent rather than a simple get because I want to embed in
the web proxy address later.
Please post replies. Any help would be appreciated.
Stephen
#!/usr/bin/perl -Tw
#=====================================================================
# forward.pl:
#=====================================================================
#=====================================================================
# Includes
#=====================================================================
use strict;
#$|++;
#use lib "/home/stephen/lib/perl5";
use LWP;
use URI::URL;
use CGI qw/:html header/;
use HTML::Entities;
#=====================================================================
# Configuration
#=====================================================================
my $DILBERT_TOP = "http://www.unitedmedia.com/comics/dilbert/";
my $DILBERT_PIC_RE = '/comics/dilbert/archive/images/dilbert\d+\.gif';
my $PEANUTS_TOP = "http://www.unitedmedia.com/comics/peanuts/";
my $PEANUTS_PIC_RE = '/comics/peanuts/archive/images/peanuts\d+\.gif';
my $browser = LWP::UserAgent->new(); # create virtual browser
$browser->agent("Mozilla/4.5 [ja] (WinNT; I)");
#=====================================================================
# Subroutines
#=====================================================================
# A TD element, centered.
sub td_center {
td({align => "center"}, @_);
}
sub get_pic {
my $url = $_[0];
my $re = $_[1];
# make a GET request on the URL via fake browser
my $page = $browser->request(HTTP::Request->new(GET => $url));
unless ($page->is_success) { # not found
die "Cannot get top page";
}
my ($pic) = $page->content =~ m!($re)!o;
$pic = url($pic, $url)->abs;
return $pic;
}
#=====================================================================
#
#=====================================================================
print header, start_html("Today's comics"), h1("Today's comics"), "\n";
my $pic;
$pic = get_pic($DILBERT_TOP, $DILBERT_PIC_RE); #(1)
print table(TR(td_center(encode_entities($pic))) . "\n",
TR(td_center(img{-src => $pic})) . "\n");
$pic = get_pic($PEANUTS_TOP, $PEANUTS_PIC_RE); #(2)
print table(TR(td_center(encode_entities($pic))) . "\n",
TR(td_center(img{-src => $pic})) . "\n");
print "\n", end_html;
------------------------------
Date: 29 Oct 1999 17:46:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: great regex strips quotes... but...
Message-Id: <slrn81k8sq.66b.abigail@alexandra.delanet.com>
Trent (trent@jps.net) wrote on MMCCL September MCMXCIII in
<URL:news:38194b6b@news1.jps.net>:
__ this code snippet works excellent on quoted csv's.
__
__
__ undef @data;
__ push(@data, defined($1) ? $1:$3)
__ while m/"([^"\\]*(\\.[^"\\]*)*)"|([^,]+)/g;
__
__
__ But, after manipulating the data, and then attempting the join,
__ $line = join (",", map { "\"$_\"" } @data);
__ the map adds more quotes than I originally had.
__
__ Is the solution obvious to anyone?
Well, yes, you quote everything, while not everything was quoted.
I don't see why that would be a problem though.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Oct 1999 17:56:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: great regex strips quotes... but...
Message-Id: <slrn81k9ff.66b.abigail@alexandra.delanet.com>
Craig Berry (cberry@cinenet.net) wrote on MMCCL September MCMXCIII in
<URL:news:s1jna0rlcsf55@corp.supernews.com>:
<> Trent (trent@jps.net) wrote:
<> : this code snippet works excellent on quoted csv's.
<> :
<> : undef @data;
<> : push(@data, defined($1) ? $1:$3)
<> : while m/"([^"\\]*(\\.[^"\\]*)*)"|([^,]+)/g;
<> :
<> : But, after manipulating the data, and then attempting the join,
<> :
<> : $line = join (",", map { "\"$_\"" } @data);
<>
<> The expression in the block might be more legibly written as
<>
<> qq("$_")
<>
<> or the like.
<>
<> : the map adds more quotes than I originally had.
<> : Is the solution obvious to anyone?
<>
<> Well, to start with, adding unneeded quotes to a CSV line should be
<> harmless. You may wish to just let it happen, since this is the simplest
<> course.
<>
<> If you decide to quote only where needed, the trick is to decide where it
<> is needed. If any expression containing a comma or double-quote needs to
<> be quoted, and that's the *only* case needing to be quoted, this will do
<> the trick:
<>
<> $line = join (",", map { /[,"]/ ? qq("$_") : $_ } @data);
I just noticed that there's a problem with all the solutions.
The extracting regex doesn't unbackwack - and the quoting function
doesn't backwack.
@data = map {s/\\(.)/$1/s; $_}
grep {defined} m/"((?:[^\\"]+|\\.)*)"|([^,]*)/gs;
And then later:
$line = map {s/(["\\])/\\$1/g; $_ = "$_" if /[,"]/; $_} @data;
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 29 Oct 1999 15:36:22 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do you compare like grep does?
Message-Id: <381A2166.5309FFF3@mail.cor.epa.gov>
Coolc wrote:
>
> Is is possible to do a grep like search in perl. I mean,
> I want to see if the value of $value is anywhere in the
> line $line. But the sytax below doesnt work.
>
> open INFILE, "$inputfile" or die "$inputfile : $!";
> while ( $line = <INFILE> ) {
> if ($value =~ /$line/ ) {
Oops. You have that part backward. The pattern to be matched
goes in the /.../ But see below.
> $line=~s/rti[0-9]/YYYYYY/g;
> print "line = $line ";
> }
> }
>
> close INFILE;
It wouldn't hurt to check the return on that close() either.
But if you want to check an exact string rather than a
regular expression, it should be faster to do this using
index() . Just test that the value you get back is > -1 .
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 28 Oct 1999 20:15:25 +1000
From: "Douglas Garstang" <dgarstan@nsw.bigpond.net.au>
Subject: How the heck does this regex match?
Message-Id: <7v97rq$gdd$1@m2.c2.telstra-mm.net.au>
#!/usr/bin/perl
$a = "[ sdt_shel ]";
$b = "dtlogin";
if ( $b =~ $a ) {
print "YES\n";
}
.... That returns true!
*is blown away*
How can this be true?
(something to do with the []'s getting in the way?)
------------------------------
Date: Fri, 29 Oct 1999 15:12:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: It is always like this here?
Message-Id: <381A1BB1.EA75308E@mail.cor.epa.gov>
Jon Shemitz wrote:
>
> Mark Bluemel wrote:
>
> > Are there techniques we could use to improve things, like frequently
> > posted pointers to FAQs etc...
[snip]
> My suspicion is that the FAQ is too big.
I would say that some days it is too small. Each year new
questions have to be added in. TomC is still doing this, even
if the Frequent-Askers have driven him nuts.
> A 90-10 rule probably applies:
> 90% of the FAQ's are only 10% of the FAQ's in the FAQ. This can make it
> hard to spot your question.
That's why indexing tools and search tools are the way to go.
But the new posters are less likely to know there *is* a FAQ,
or to be unable to adapt the answer found in the FAQ,
than to be unable to find their answer there.
> Even if I'm wrong about the 90-10, the sheer
> number of questions in each section seems to break all sorts of
> principles of effective information presentation.
90-10 is a good enough guess. But the overlap of topics
makes dividing things up difficult.
> I think it might be a good idea to break each section down into
> subsections. Each section would retain the five or so most common
> questions, and the remainder would be be parceled out into new
> subsections, none of them bigger than five or so questions.
In TomC's words, "patches are welcome".
I think that there needs to be either:
[1] more features to perldoc [TomC will clobber me for this];
[2] more keywords to search on for each question with -q ; or
[3] more perltools that come with the docs.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 29 Oct 1999 22:31:41 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: It is always like this here?
Message-Id: <slrn81k87u.j4s.mgjv@wobbie.heliotrope.home>
On 29 Oct 1999 17:50:44 GMT,
William <bivey@teamdev.com> wrote:
> Mark Bluemel <mark.bluemelNOmaSPAM@siemens.co.uk.invalid> wrote in article
> <000b8d9b.40a12527@usw-ex0101-001.remarq.com>...
> > I've been teaching myself Perl for a few weeks, with moderate success,
> > so I thought I'd join the newsgroup. After just one day, I'm more than
> > half inclined to drop out again. Large amount of traffic, huge
> > noise-to-signal ratio, cluelessness in abundance and a fair proportion
> > of abuse - these all add up to somewhere that I'm not feeling like
> > hanging round in.
> >
> > Is it always like this, or have I picked a bad time?
>
> Seems to be the worst in purely language-related newsgroups.
That would need a bit more clarification. comp.lang.c for example is a
pure language group, even purer than clp.misc, because they only talk
about standard C there. Most of the time however the responses to
offtopic posts are more friendly than here (except for one person, who I
haven't seen there for a while). Some other pure language groups are a
lot better than here as well. clp.misc is hard.
But why?
Perl has a fairly unique position in programming land because of two,
almost irreconcilable aspects: A lot of Unix hackers with a C
background, a long history on the Internet and a lot of programming
experience work with it, and in fact have created it. They also created
this group (or rather comp.lang.perl, which then got split), and were
quite happy there, talking about Perl and perl. With the emergence of
the web, and CGI, somehow Perl became the most used language to program
anything there. That isn't that surprising; One of Perl's major
strengths is its capability to manipulate text strings in all sorts of
ways with minimal coding effort.
However, every person who knew a bit of HTML suddenly decided that they
needed some dynamic capabilities, and for some odd reason many of those
people out there seem to think that Perl is the only way. Now, I
understand fully that these people are not programmers, and therefore
not necessarily understand the difference between interfaces and
languages, but that's no real excuse.
If I, as a programmer, would suddenly start telling our graphics
designers that I, too, can be one, and would they just tell me which
buttons to press, they would laugh in my face. And rightly so. If I, as
a programmer, would walk up to a MD, and would say, ok, I can be a
doctor too, just tell me how to hold a stethoscope, they would just
glare at me, I suppose.
A language like C doesn't have this problem (it has others, but that's
beside the point), because no one equates CGI with C. A language like
Java doesn't have this problem, because it didn't _really_ exist before
the Web, and shouldn't even be used for anything else.
Now, imagine having been on this newsgroup for a while, you're a highly
experienced programmer, you've been enjoying discussions with your peers
about the arcana of Perl, and how to make it better, how to do such or
so, and slowly, gradually, your pleasant discussion get drowned in
requests from people who want to know how to hold a stethoscope. It's
annoying at least, and insulting.
If there were only a few of those, we'd be fine. But it gets to the
point where this stuff drowns out anything useful, so you start telling
them off. They feel insulted, and argue. More noise. Then people start
arguing that you shouldn't tell them off. More noise. Then people defend
the telling off. More noise. Then someone suggests splitting up the
groups even further. More noise while that goes on. Then someone gets so
annoyed by the constant repetition of FAQs, and starts posting a few FAQ
answers per day.
By now, the group, unfiltered, is unreadable. New people won't easily
find older articles talking about their problem (if they bother to look
at all). The people who want to talk about Perl find it almost
impossible to find useful posts, and find themselves
- answering FAQs all the time (and you soon learn to just point to the
FAQ)
- correcting people who give wrong or incomplete answers (which is ok,
really)
- resisting the urge to add to discussions like these
- participate in discussions like these
- trying to stop threads that are totally offtopic, by pointing out that
they are, after which they cop a bundle of abuse from the people who
think HTML is appropriate here, because Perl can be used to ptrint
HTML
- and finally, if there's any time left, discussing Perl issues.
> I've found that, while the cluelessness is just as high,
> the newbie-toasting is less pronounced in newsgroups
> devoted to creating applications. Don't know why,
> just my observation.
Again, it's not that, really. It's the total clash of cultures that is
fairly unique to the perl newsgroups. Most of the oldies here were here
befire the Web was invented,or at least before it became commercially
attractive. Most of the newbies here have found Usenet through the
'Messenger' button on Netscape (or whatever the thing is called).
The people here aren't really nasty. It's just a reaction against what
they see as pollution, laziness, and rudeness. They expect newbies to
realise that they should read the Usenet introduction, and to first get
some basic understanding of programming. It's not much to ask, but it
won't happen. This discussion, and many like it, has been here. Many,
many many times. I keep promising myself that Iwon't get drawn into yet
another one, but here I am.
I find it very sad, that the only way I can feel comfortable reading
this group is with a Killfile that is so bulky that about 20% of the
articles never make my screen, and another 30% come up pre-deleted. And
I have to kill on keywords. I may be missing some interesting stuff,
because of that, but I know for a fact that I am not seeing most of the
crud. It is, however, sad.
But, to answer the post that started this thread: There is no solution.
A culture clash this large cannot be circumvented. You cannot change
human nature, and expect the people here to suddenly just accept that
people can talk about browsers, buttons, CGI, HTML and JavaScript here.
You cannot expect people to stay friendly, day in day out, for years,
mechanically having to tell these people over and over again that they
shouldn't be discussing that here, and that they should have read that
post with all the starts and capital letters in the subject that tells
them where the FAQ is.
It is just too exhausting. The volume is too high. And that makes people
cranky.
Martien
--
Martien Verbruggen |
Interactive Media Division | That's not a lie, it's a
Commercial Dynamics Pty. Ltd. | terminological inexactitude.
NSW, Australia |
------------------------------
Date: Sat, 30 Oct 1999 10:21:44 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: It is always like this here?
Message-Id: <AirS3.13$MV2.1302@vic.nntp.telstra.net>
<Largish SNIP>
> It is just too exhausting. The volume is too high. And that makes people
> cranky.
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | That's not a lie, it's a
> Commercial Dynamics Pty. Ltd. | terminological inexactitude.
> NSW, Australia |
Well put. I must confess to some guilt early as a newbie, but am enjoying
the challenge of assimilating this culture.
I also have learned to just ignore a lot of stuff without bothering to
killfile too much.
Sometimes I compose a response to a post, only to think, 'why?' and go off
and do something else.
But I do lurk a lot and skim the group, and it is amazing what gems you can
find, and how much you can learn.
Wyzelli
------------------------------
Date: Fri, 29 Oct 1999 21:39:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Just to get rid of dos prompt window.
Message-Id: <381a0fa3.1040059@news.skynet.be>
David Cassell wrote:
>> perldoc -f xxxx > textfile
>>
>> should work under MS-DOS 6.22.
>
>Nope, this doesn't work either [win95/98].
maybe if the ">" and the filename are attached.
perldoc -f xxxx >textfile
And maybe you were not really running under the DOS shell.
command /c perldoc -f xxxx >textfile
--
Bart.
------------------------------
Date: Fri, 29 Oct 1999 23:28:28 +0100
From: Thomas Nunn <tom@tnunn.demon.co.uk>
Subject: Re: mod perl anomalies
Message-Id: <f7LcHEAM+hG4Ew4Q@tnunn.demon.co.uk>
In article <MPG.1282888e78e7a224989824@nntp1.ba.best.com>, Bill Moseley
<moseley@best.com> writes
>Thomas Nunn (tom@tnunn.demon.co.uk) seems to say...
>> >> However every so often when I submit the form, the record that is added
>> >> to the file is actually a repetition of a record added a few submits
>> >> before.
>
>Have you run the server with -X?
>
Not entirely sure what that means, I'll try it as soon as I find out how
to do it.
--
Thomas Nunn
------------------------------
Date: Sat, 30 Oct 1999 10:02:35 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: open MYFILE, ">-" doesn't work in CGI?
Message-Id: <D0rS3.12$MV2.1387@vic.nntp.telstra.net>
Willem Joosten <NoSpam@JSoft.xs4all.nl> wrote in message
news:7vco62$j7i$1@news1.xs4all.nl...
> Hi,
>
> I've written some routines who output to a file if a filename is passed or
> stdout otherwise. The code looks like this:
>
> sub myroutine {
> my $filename = $_[0];
> if ($filename ne ""){ open MYFILE, $filename; } else { open MYFILE,
> ">-" }
> print MYFILE "blabla";
> close (MYFILE);
> }
>
> From the commandline this works fine but when I use the CGI packages
nothing
> is printed except for output directly to stdout (print "Blabla";).
>
> Does CGI do some trick with stdout and is there a way to make this work
> anyway?
>
>
> Regards
>
> Willem Joosten
>
You are not specifying to write to $filename.
Include the > and see what happens.
Also check the return value so you can see what errors occur.
open (MYFILE ">$filename") or die "unable to open $filename because $!\n";
You should check for errors on opening the filehandle whether it is a file,
STDOUT or a Pipe regardless, or your program won't tell why it's not
working.
Wyzelli
------------------------------
Date: Fri, 29 Oct 1999 17:06:49 -0500
From: nobody <nobody@nowhere.com>
Subject: pass file handle
Message-Id: <381A1A54.493@nowhere.com>
Hello,
I am new to Perl, but old to C. I would appreciate help with the
following problem.
I wish to open a file in one subroutine and write to it from another. I
assigned the file handle to a scalar and returned it to the calling
subroutine. It is using it as the first argument in printf, but all that
results is the the name of the original file handle gets printed.
What's wrong with this picture?
open(HFILE, "temp.txt");
$hfile = HFILE;
...
print $hfile, "hello world";
The output is: HFILEhello world
I would prefer not to use select(HFILE) but will if I must.
Thanks
------------------------------
Date: Fri, 29 Oct 1999 17:10:39 -0500
From: nobody <nobody@nowhere.com>
Subject: pass file handle
Message-Id: <381A1B5F.536F@nowhere.com>
Hello,
I am new to Perl, but old to C. I would appreciate help with the
following problem.
I wish to open a file in one routine and write to it from another.
What's wrong with this picture?
open(HFILE, "temp.txt");
$hfile = HFILE;
...
print $hfile, "hello world";
close($hfile);
The output is: HFILEhello world
I would prefer not to use select(HFILE) but will if I must.
Thanks
------------------------------
Date: Fri, 29 Oct 1999 15:58:36 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: pass file handle
Message-Id: <MPG.1283c67b73684250989827@nntp1.ba.best.com>
nobody (nobody@nowhere.com) seems to say...
> Hello,
>
> I am new to Perl, but old to C. I would appreciate help with the
> following problem.
>
> I wish to open a file in one routine and write to it from another.
> What's wrong with this picture?
>
> open(HFILE, "temp.txt");
> $hfile = HFILE;
Oh, this is in the FAQ, but I'm too lazy to look it up right now, so try
this:
$hfile = *HFILE;
> print $hfile, "hello world";
^
oops
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Fri, 29 Oct 1999 17:16:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: pass file handle
Message-Id: <MPG.1283d8af1168336798a162@nntp.hpl.hp.com>
In article <MPG.1283c67b73684250989827@nntp1.ba.best.com> on Fri, 29 Oct
1999 15:58:36 -0700, Bill Moseley <moseley@best.com> says...
> nobody (nobody@nowhere.com) seems to say...
> > I am new to Perl, but old to C. I would appreciate help with the
> > following problem.
> >
> > I wish to open a file in one routine and write to it from another.
> > What's wrong with this picture?
> >
> > open(HFILE, "temp.txt");
No test for failure of the open(), for one thing.
> > $hfile = HFILE;
>
> Oh, this is in the FAQ, but I'm too lazy to look it up right now, so try
> this:
>
> $hfile = *HFILE;
Maybe referring the FAQ would have produced a better answer, as well as
helping the newcomer learn how to solve problems independently in the
future.
perlfaq7: "How can I pass/return a {Function, FileHandle, Array, Hash,
Method, Regexp}?"
If you're passing around filehandles, you could usually just use the
bare typeglob, like *STDOUT, but typeglobs references would be better
because they'll still work properly under use strict 'refs'. For
example:
splutter(\*STDOUT);
sub splutter {
my $fh = shift;
print $fh "her um well a hmmm\n";
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 29 Oct 1999 15:27:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl assoc. array file database error... help please
Message-Id: <381A1F6C.ADF62C11@mail.cor.epa.gov>
Steve S. wrote:
>
> I'm currently creating a web based database from pages we have on our
> website... I'm using the dbmopen method and was extremely happy with my
> results from my testing up until I started testing with our actual pages
> from our site. If I try adding a string longer than about 1000 characters I
> get this message:
>
> Length of string being added = 1008
>
> sdbm store returned -1, errno 22, key "key" at addthedb.pl line 39, <STDIN>
> chunk 1.
>
> Is there any way past this limitation? or do I have to add these strings
> into a seperate txt delimited database file? Thank you all, for any help at
> all. SteveS
First: dbmopen() has largely been replaced by tie() .
Second: this is a known limitation of SDBM . It is even
discussed in the docs. If you look up SDBM in the HTML docs,
it will even refer you to the AnyDBM_File page, where a table
of dbm features points this out rather clearly. It can
be gotten around, but not easily. I would strongly advise
you to move to the DBI module and a better database. Or
at least tie() and a better database.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 29 Oct 1999 16:03:17 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Perl assoc. array file database error... help please
Message-Id: <MPG.1283c78e49d6efa6989828@nntp1.ba.best.com>
Steve S. (SteveS@HTProf.com) seems to say...
> I'm currently creating a web based database from pages we have on our
> website... I'm using the dbmopen method and was extremely happy with my
> results from my testing up until I started testing with our actual pages
> from our site. If I try adding a string longer than about 1000 characters I
> get this message:
>
> Length of string being added = 1008
use BerkeleyDB instead. Look at the table in the perldoc AnyDBM_File.
use DB_File
But consider your design. DBM files then to have their limits,
especially if you ever move your application inside the server (like
mod_perl). MySQL might be a better choice in the long run.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1225
**************************************