[13858] in Perl-Users-Digest
Perl-Users Digest, Issue: 1268 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 3 15:10:36 1999
Date: Wed, 3 Nov 1999 12:10:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941659825-v9-i1268@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 3 Nov 1999 Volume: 9 Number: 1268
Today's topics:
Re: mirror command <rootbeer@redcat.com>
Re: mirror command (Kragen Sitaker)
Re: New Modules: Conversion of C-structs to Perl (Ilya Zakharevich)
Re: Perl and AIX v4.3.2 (Mitchell Morris)
Re: Perl and AIX v4.3.2 <shon@mad.scientist.com>
Re: perl and commonsense (Kragen Sitaker)
Re: perl and commonsense (brian d foy)
Re: perl and commonsense <jeffp@crusoe.net>
Re: perl and commonsense (Alan Curry)
Re: Perl and Excel Charting <jtolley@bellatlantic.net>
Re: Perl and Excel Charting (Kragen Sitaker)
Re: perl lang parser (Salem Lee Ganzhorn)
Re: Perl Unicode Support (Kragen Sitaker)
perldoc and the string "PI::" <macintsh@cs.bu.edu>
Re: perldoc and the string "PI::" (Alan Curry)
Re: shared memory and semaphores (Kragen Sitaker)
Simple translation, doesnt work!!! bababozorg@aol.com
Re: Simple translation, doesnt work!!! (brian d foy)
Re: speeding up split() (Ilya Zakharevich)
THANK YOU! <reembar@hotmail.com>
Re: to Alan Flavell (Tad McClellan)
Re: What does HAND mean? (Kragen Sitaker)
Re: What does HAND mean? <msalter@bestweb.net>
Re: What does HAND mean? (Bill Moseley)
Re: What does HAND mean? <scottlm@visi.com>
Re: What does HAND mean? (Abigail)
Re: Why am I getting an undefined subroutine error? <lsilver@information-concepts.com>
Re: Why not DB_File? <rootbeer@redcat.com>
Re: Why not DB_File? (Kragen Sitaker)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 3 Nov 1999 09:02:13 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: mirror command
Message-Id: <Pine.GSO.4.10.9911030900260.29670-100000@user2.teleport.com>
On Wed, 3 Nov 1999, bruce wrote:
> When I load the code up to the server and run it, I get the massage
Relaxing, isn't it? :-)
> that it can't find LWP/simple.pm,
Have you seen what perldiag has to say about the "massage" that you're
getting?
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 03 Nov 1999 18:11:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: mirror command
Message-Id: <wV_T3.25180$23.1295819@typ11.nn.bcandid.com>
In article <s20mgi3j24228@corp.supernews.com>,
bruce <bedesign@webspan.net> wrote:
>When I load the code up to the server and run it, I get the massage that it
>can't find LWP/simple.pm, I've load the simple.pm file to the cgi directory;
>what do I need to do to call this module from my directory(is this
>possible). (Sorry I'm a newbie, is this where I would use the Autoloader?)
>This is a 'pay' server and they don't want me rebuilding their libraries
>which is the only way I've seen documented on how to install modules.
perldoc -q module
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 3 Nov 1999 19:27:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: New Modules: Conversion of C-structs to Perl
Message-Id: <7vq2as$ob$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Alex Rhomberg
<rhomberg@ife.ee.ethz.ch>],
who wrote in article <38201D80.6CDF1BBD@ife.ee.ethz.ch>:
> > >I did not find any documented method to convert a C/C++ struct to Perl.
> > >I therefore wrote something of my own.
> >
> > Awesomely cool. Have you looked at swig? I think it does something a
> > bit like this too.
>
> Didn't know about swig before. Seems to do something similar, only much
> much more and more complex. I'd need probably more time to read the doc
> than it took to write the functions.
You may also want to look at Xsubpp-2.0000-alpha (sp?) (of 4-5 years
ago). I do not know why it did not leave teh alpha state.
Ilya
------------------------------
Date: 3 Nov 1999 17:50:50 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Re: Perl and AIX v4.3.2
Message-Id: <slrn820tfq.n7i.mgm@unpkhswm04.bscc.bls.com>
In article <7vpk9f$vki$1@nnrp1.deja.com>, mgrabens@popd.isinet.com wrote:
> We have tried building Perl versions 5.004_04 and 5.005_03 on AIX 4.3.
>The builds all look successful and many perl scripts run, but some
>don't. The symptoms I am running into are:
>1) Perl core dumps on compile only
>2) Different shell environments cause Perl to dump core
>3) Running the program with she-bang to perl binary dumps core, but
>running same binary on command line program runs fine (ie. "perl myprog"
>works)
>4) Compile only will core dump, but running it is fine.
[snip]
That's odd ... we're all full up with Perl here, and it all runs super
smoothly. Plus which I've never seen a Perl core dump that I didn't cause
directly myself.
[cut and pasted with lines wrapped by me so our news server won't bitch]
[mgm@unpkhswm04] perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=aix, osvers=4.3.0.0, archname=aix
uname='aix unpkhswm04 3 4 000148764600 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 \
-I/usr/local/include'
ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 \
-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lbsd -lPW
libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-bE:perl.exp'
cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp \
-bE:$(BASEEXT).exp -b noentry -lc -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under aix
Compiled at Dec 17 1998 15:27:06
@INC:
/usr/local/lib/perl5/5.00502/aix
/usr/local/lib/perl5/5.00502
/usr/local/lib/perl5/site_perl/5.005/aix
/usr/local/lib/perl5/site_perl/5.005
.
[mgm@unpkhswm04] rsh anpkhsw1 perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=aix, osvers=4.1.4.0, archname=aix-thread
uname='aix anpkhsw1 1 4 00500352c400 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=define useperlio=undef d_sfio=undef
Compiler:
cc='cc_r', optimize='-O', gccversion=
cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 \
-DNEED_PTHREAD_INIT -I/usr/local/include'
ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=8192 \
-DNEED_PTHREAD_INIT -I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-ldbm -lld -lm -lc_r -lc -lbsd -lPW
libc=, so=a, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-bE:perl.exp'
cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp \
-bE:$(BASEEXT).exp -b noentry -lpthreads -lc_r -lc -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under aix
Compiled at Apr 15 1999 18:37:37
@INC:
/usr/local/lib/perl5/5.00503/aix-thread
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/aix-thread
/usr/local/lib/perl5/site_perl/5.005
.
I could do the same on about fifty other hosts, but you'd get the same
results (more or less). These were built with "Configure -des" and "make"
so there isn't any magic in the build process.
--
Mitchell Morris
See, when the GOVERNMENT spends money, it creates jobs; whereas when the money
is left in the hands of TAXPAYERS, God only knows what they do with it. Bake
it into pies, probably. Anything to avoid creating jobs.
-- Dave Barry
------------------------------
Date: Wed, 03 Nov 1999 19:37:18 GMT
From: Shon Stephens <shon@mad.scientist.com>
Subject: Re: Perl and AIX v4.3.2
Message-Id: <7vq2te$ab5$1@nnrp1.deja.com>
> In article <7vpk9f$vki$1@nnrp1.deja.com>, mgrabens@popd.isinet.com
wrote:
> We have tried building Perl versions 5.004_04 and 5.005_03 on AIX
4.3.
>The builds all look successful and many perl scripts run, but some
>don't. The symptoms I am running into are:
>1) Perl core dumps on compile only
>2) Different shell environments cause Perl to dump core
>3) Running the program with she-bang to perl binary dumps core, but
>running same binary on command line program runs fine (ie. "perl
myprog"
>works)
>4) Compile only will core dump, but running it is fine.
Have you always been running AIX v4.3.2? Have you run same level of Perl
on earlier revs of AIX? If so give IBM a call. They are commited to
making sure that anything that ran on v4.2x, v4.3.1 will run on v4.3.2.
Also try posting to an AIX group? (I don't know the name of one off
hand)
Also, if the programs are dumping core, is there anything that can be
analyzed? If there is anything in the errpt that reports on the dump,
see find out what the sysdumpdev is and package up the dump and send to
IBM.
--
Shon Stephens
UNIX Systems Administrator
shon@mad.scientist.com
"You want a piece of me?"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 03 Nov 1999 18:00:37 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: perl and commonsense
Message-Id: <9L_T3.24851$23.1294575@typ11.nn.bcandid.com>
In article <7vpg8n$s8g$1@nnrp1.deja.com>, <ajmayo@my-deja.com> wrote:
>I am slowly making the transition from perl newbie to novice guru. In
>doing so, I've found some issues that I don't have good answers to.
Good. Your experience with Perl will help you design a better
successor when you finally do achieve guruhood.
>I work in a whole bunch of languages, including C, Javascript and
>Visual Basic. None are perfect. But perl seems to get me scratching my
>head most often - and my colleagues, too, find it tough going.
Perl is a large language -- perhaps larger than any other programming
language in current use, even including COBOL and Common Lisp. C and
JavaScript are small languages. I don't know about VB.
There are advantages to both large and small languages. One of the
advantages of small languages is that they are easy to learn. But
large languages are often easier to use once you have learned them.
You should read Guy L. Steele's paper on the topic, called "Growing a
Language". It's at
http://www.sunlabs.com/research/java-topics/pubs/98-oopsla-growing.ps.
(It's probably even more compelling as a performance than as a paper;
see http://www.uvc.com/videos/oo98Steele.video.html for a video.)
>What I find with perl is that extrapolation from common sense seldom
>works.
It used to work better, when Perl was a smaller language. It works
more often for me with Perl than with other languages. (However, since
I don't fully understand the semantics of Perl, extrapolation from the
rules of the language works less often for me in Perl than in C.
Extrapolation from the rules of the language always works for me in C.)
Many things in Perl are designed to be convenient or work as expected,
rather than to be consistent.
>Take the following example. I want to create a reference to an array
>slice. Common-sense extrapolation would indicate that if
>
>$c=\@a;
>
>creates a reference to the array @a and places it in the scalar $c,
>and if
>
>@d=@a[0..2]; copies the array slice $a[0] through $a[2] to array @d,
>then clearly,
>
>$c=\@a[0..2];
>
>will create a reference to the array slice. Except it doesn't work.
Well, you can only create references to lvalues, and array slices
aren't lvalues.
perl -Mstrict -e 'my @a = qw(aa bb cc dd); my $c = \@a[0..2]; print $$c, "\n"'
This outputs 'cc'. Jeff Pinyan has explained why in another post.
The reason why you don't have this problem in JavaScript is that
JavaScript doesn't have array slices. This is because JavaScript
inherits its relatively poor[0] set of expressed values from C.
>Now, I have searched the online perl documentation and I can't clarify
>whether this should work, or not. The problem seems to be that perl is
>just too subtle and clever, and the documentation presupposes that you
>will be just as subtle and clever. This may be why it is organised in
>the peculiar way that it is, compared to most programming language
>documentation, which tends to be task-oriented. I mean, it makes
>perfect sense to look in "perl syntax" to see how a for loop is
>constructed, from the language developers point of view, but maybe not
>from the point of view of someone learning the language. I know
>what 'syntax' is but my colleague, looking for 'loop control' was
>surprised when I told him where to look.
Writing good documentation is really hard, perhaps as hard as writing
good code. Much of the Perl reference documentation is simply a
collection of descriptions of individual functions, without a larger
structure, and there is no real index. (Good indexing is hard, too,
and it's even less fun than writing documentation.)
Part of the problem is, as you surmise, that it is hard for an expert
to look at Perl with novice mind.
Task-oriented documentation is also not good documentation, at least by
itself. It's even harder to find complete documentation of how a
particular aspect of the program works in task-oriented documentation
than in documentation arranged as documentation of a set of independent
features.
My paradigmatic example of good reference documentation is the Elisp
reference manual. I wish I had good task-oriented documentation for
elisp too, though.
>Compared with the clean elegance of Javascript, perl suffers very badly
>from metacharacter madness. The result is that perl programming is not
>a part-time pursuit, but more a life calling. This may explain the zeal
>with which its experts pursue the most obscure and cunning perl
>epigrams.
I agree with you. The other consequence of the situation you describe
is that Perl is much, much more powerful than the other languages you
mention.
>My life isn't helped by perl's infuriating error reporting, which
>assumes that printing the line number is sufficient.
I have found Perl's error messages to be far superior to those emitted
from any other programming language system I have used, because they
often include a correct guess as to what the problem is. With 'use
diagnostics', they even include a paragraph-length explanation of the
problem. They could certainly be improved, though.
> This is not the
>case!. If the code is running inside of Apache (mod_perl) the line
>number is meaningless. I want to see the error reported in context e.g
>
>$foo=$bar+$glarch;
> ^undefined variable $bar
That would be nice. I don't understand why the line number is
meaningless; perhaps that could be considered a bug in mod_perl?
perl -Mdiagnostics -Mstrict -we 'my $glarch; my $foo=$bar+$glarch;'
says:
Global symbol "$bar" requires explicit package name at -e line 1 (#1)
(F) You've said "use strict vars", which indicates that all variables
must either be lexically scoped (using "my"), or explicitly qualified to
say which package the global variable is in (using "::").
Execution of -e aborted due to compilation errors (#2)
(F) The final summary message when a Perl compilation fails.
Uncaught exception from user code:
Execution of -e aborted due to compilation errors.
Without diagnostics, it says:
Global symbol "$bar" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
Well, at least it mentions that it's $bar that's undefined. It would
indeed be nice if it printed the line of source.
>like I would in most development environments. Not to mention
>
>$foo=($bar+($glarch+3/$foo);
> ^Expected ')'
perl -e '$foo=($bar+($glarch+3/$foo);'
syntax error at -e line 1, near ");"
Execution of -e aborted due to compilation errors.
Hmm, yes, some indication of what was expected would help. But there
are a variety of things that could occur instead of the semicolon and
which would be valid, such as '+' and ','.
>Now you might quite reasonably ask why I would persevere with perl if
>it doesn't make my life easier. The thing is, right now, its the only
>server-side language with infrastructure (e.g DBI for database access)
>that I can use with both Microsoft IIS and Apache. Server-side
>javascript is emerging but the infrastructure, like database access,
>isn't really there yet.
That's rather disgusting -- javascript was *invented* for server-side
programming. In nineteen bloody ninety five, if I remember right.
I hope Perl continues to make your life easier as it does mine.
>This being the case, I would love to know what others think. Apart from
>the full-time perl gurus, who will probably sneer at my ignorance, what
>do you part-time perl programmers think?.
I'm a part-time perl programmer; I agree with some of your points, and
disagree with others. You might think I'm a guru, though; if so, feel
free to disregard my post. :)
>Once you start using the more
>advanced language features, are you having trouble getting predictable
>results?.
Only until I understand the language features. This usually takes some
experimentation and reading of docs.
>Does common-sense extrapolation work for you?
Yes, most of the time.
>Has your code turned out to be maintainable?.
Most of it hasn't lived long enough for me to find out. I don't have
any trouble reading code I wrote a couple of years ago and
understanding what it does and why, but that's only part of
maintainability.
> And does the limited error message
>reporting cause you a problem,especially with server-side perl code?.
No; it's much better than my C compiler's error message reporting. But
I haven't written mod_perl code (and I test my CGI scripts at the
command prompt before trying to run them over the web, and even over
the web I don't have much difficulty with CGI scripts) so I'm not
running into the same problems you are.
[0] 'poor' here means 'not rich', not 'low-quality'. Perhaps I should
say 'impoverished', but I don't think that sounds any less derogatory.
I don't mean to derogate JavaScript.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 03 Nov 1999 13:40:49 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: perl and commonsense
Message-Id: <brian-0311991340490001@183.new-york-58-59rs.ny.dial-access.att.net>
In article <9L_T3.24851$23.1294575@typ11.nn.bcandid.com>, kragen@dnaco.net (Kragen Sitaker) wrote:
>In article <7vpg8n$s8g$1@nnrp1.deja.com>, <ajmayo@my-deja.com> wrote:
>> And does the limited error message
>>reporting cause you a problem,especially with server-side perl code?.
>
>No; it's much better than my C compiler's error message reporting. But
>I haven't written mod_perl code (and I test my CGI scripts at the
>command prompt before trying to run them over the web, and even over
>the web I don't have much difficulty with CGI scripts) so I'm not
>running into the same problems you are.
the errors from mod_perl are the same that you get from Perl, with
very few, esoteric exceptions. there's even Apache::FakeRequest to
help in debugging. i think most of the problems reported in this
thread are due to a lack of experience than a failure of the
language. if you want to program something like mod_perl, then
it's reasonable to expect you to know the server API and IO model.
Perl may be for accidental programmers, but it's also a power tool
(or a dessert topping as dha would say). you can do simple things
in Perl without knowing the advanced stuff, which makes Perl popular
for the neophyte, but if you want to do advanced stuff, you need
to know more and spend more time learning it, which isn't any
different than anything else in life. you can't drive a tractor
trailer with the same license you have to drive a car.
programmers just learning mod_perl now have it easy - there is an
excellent book by Lincoln and Doug. try learning it *without* the
documentation that is now available and perhaps there will be a
modicum of empathy.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 3 Nov 1999 13:59:06 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: perl and commonsense
Message-Id: <Pine.GSO.4.10.9911031347130.12955-100000@crusoe.crusoe.net>
On Nov 3, Kragen Sitaker blah blah blah:
> Well, you can only create references to lvalues, and array slices
> aren't lvalues.
Array slices aren't lvalues?
@a[0..2] = qw( john jacob jingleheimerschmidt );
($a[0], $a[1], $a[2]) = qw( same name here );
It think the more pressing problem is you can only create references to
specified data structures. Lists are not data structures, they are just
lists. A scalar is a certain type of data structure. An array is a
certain type of data structure, a named sequence of data structures. A
hash is an unordered pairing of data structures. A list is an unnamed
sequence of data structures that are not related to each other in any way
shape or form except for the fact they happen to be within parentheses,
with commas between them. (This is probably a super shitty way of putting
it, but I'm sure there's a hint of logic here.)
If a function returns ($a,$b,$c), that is a list of values that are in
some order, but are not related to each other. If it returns @a, that is
an array whose elements are related in that each element belongs to a
bigger object, the array. A list is just a grouping. Therefore,
operations on an array affect THE array, which in turn affects the
elements. Operations on a list directly affect the structures in the
list, and the list remains there, letting you know that the structures are
still in this grouping.
Before I further mess with anyone's mind, I'll let a real knowledgeable
person berate and correct me. :)
> perl -Mstrict -e 'my @a = qw(aa bb cc dd); my $c = \@a[0..2]; print $$c, "\n"'
> This outputs 'cc'. Jeff Pinyan has explained why in another post.
Yup.
> 6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
> <URL:http://www.pobox.com/~kragen/bubble.html>
Kragen.... this URL... it baffles me. :)
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Wed, 03 Nov 1999 19:04:16 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: perl and commonsense
Message-Id: <QG%T3.25245$23.1301844@typ11.nn.bcandid.com>
In article <7vpg8n$s8g$1@nnrp1.deja.com>, <ajmayo@my-deja.com> wrote:
>What I find with perl is that extrapolation from common sense seldom
>works.
Perl is completely intuitive to anyone with Larry Wall's brain.
>Take the following example. I want to create a reference to an array
>slice. Common-sense extrapolation would indicate that if
The problem here is that an array slice is an operation that yields a list,
and there's no such thing as a reference to a list. You're not the first
person to be surprised by that. perlref:
Note that taking a reference to an enumerated list is
not the same as using square brackets--instead it's
the same as creating a list of references!
When you see an exclamation point in the docs, pay attention!
>$c=\@a[0..2];
>
>will create a reference to the array slice. Except it doesn't work. It
>seems to evaluate the slice in scalar context, returning 3 in this case.
It creates an list of 3 references, then evaluates that list in scalar
context, which results in the last element of the list being returnd. $c
should be a reference to a scalar, not the number "3"...
>Now, I have searched the online perl documentation and I can't clarify
>whether this should work, or not.
It shouldn't. You can't have list refs.
> The problem seems to be that perl is
>just too subtle and clever,
So subtle the very point you are having trouble with is emphasized as a
potentially surprising rule, with examples, in perlref.
> I know
>what 'syntax' is
Should we applaud?
>My life isn't helped by perl's infuriating error reporting, which
>assumes that printing the line number is sufficient. This is not the
>case!
Well here's one thing you got right. "Use of uninitialized value at (eval 8)
line 20" is totally useless.
>number is meaningless. I want to see the error reported in context e.g
>
>$foo=$bar+$glarch;
> ^undefined variable $bar
This would be a very good thing.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Wed, 03 Nov 1999 18:06:52 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: Re: Perl and Excel Charting
Message-Id: <38207945.A6C12195@bellatlantic.net>
Kragen Sitaker wrote:
> >Hope this helps, and thanks for any help anyone might have on this
> >SaveAs("filename:=whatever.xls")?!? issue,
>
> 'filename' => 'whatever.xls', perhaps?
Thanks, but it doesn't seem to work.
James
------------------------------
Date: Wed, 03 Nov 1999 18:50:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl and Excel Charting
Message-Id: <hu%T3.25229$23.1300289@typ11.nn.bcandid.com>
In article <38207945.A6C12195@bellatlantic.net>,
James Tolley <jtolley@bellatlantic.net> wrote:
>Kragen Sitaker wrote:
>> >Hope this helps, and thanks for any help anyone might have on this
>> >SaveAs("filename:=whatever.xls")?!? issue,
>>
>> 'filename' => 'whatever.xls', perhaps?
>
>Thanks, but it doesn't seem to work.
OK, I'll look it up in McMahan's book when I get home. I have no
experience with Win32::OLE, but I saw nobody else had tried to help you
yet.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 3 Nov 1999 03:34:54 GMT
From: slganzho@unity.ncsu.edu (Salem Lee Ganzhorn)
Subject: Re: perl lang parser
Message-Id: <7voagu$shf$1@uni00nw.unity.ncsu.edu>
: I am looking for a package which can parse a perl script and store the
: information in a structure.
:
: This is for creating and managing code dependancies.
: TIA
Whew, thanks for the information all.
I guess my answer is I need to learn another language... YACC
--
Salem Lee Ganzhorn... slganzho@unity.ncsu.edu
------------------------------
Date: Wed, 03 Nov 1999 18:44:34 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl Unicode Support
Message-Id: <mo%T3.25220$23.1299020@typ11.nn.bcandid.com>
In article <7vo9kk$1kk$1@nnrp1.deja.com>, <mehkriakram@my-deja.com> wrote:
>Hi. Hope to find u in great health
>I am writing a cgi script which is supposed to take in user input and
>convert it to pdf format.
>
>I am using Image::Magick for the conversion to pdf.
>
>The script works fine with english (iso-8859-1)(basic latin) but when
>the user inputs non english language data string then the output is just
>junk.
Does Image::Magick support other character sets? I imagine it doesn't
matter if the rest of Perl does or not, since Image::Magick is what's
translating the user-entered sequences of bytes into PDF stuff, right?
If it doesn't, you will have to build your PDF files by a different
method or fix Image::Magick so it does.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 3 Nov 1999 19:14:13 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: perldoc and the string "PI::"
Message-Id: <7vq1i5$qo9$1@news1.bu.edu>
Check this out:
% cat > Foo.pm
=head1 NAME
PI::Foo - PI::Foo module.
^D
% perldoc Foo.pm
[snip]
NAME
pi::Foo - pi::Foo module.
[snip]
Why is "PI::" being converted to lowercase everwhere? pod2text
honors the capital "PI::", and other strings like "PO::" or
"PP::" are left uppercase by perldoc. Can anyone else reproduce
this error?
-----------------+----------------------------------------
John Siracusa | If you only have a hammer, you tend to
macintsh@bu.edu | see every problem as a nail. -- Maslow
------------------------------
Date: Wed, 03 Nov 1999 19:42:14 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: perldoc and the string "PI::"
Message-Id: <qe0U3.25295$23.1306587@typ11.nn.bcandid.com>
In article <7vq1i5$qo9$1@news1.bu.edu>,
John Siracusa <macintsh@cs.bu.edu> wrote:
>Why is "PI::" being converted to lowercase everwhere? pod2text
>honors the capital "PI::", and other strings like "PO::" or
>"PP::" are left uppercase by perldoc. Can anyone else reproduce
>this error?
pod2man is converting the word "PI" to the greek letter. But since you're
viewing it on a tty, that greek letter can't be shown and it gets converted
back. Try pod2man Foo.pm | groff -Tps | lpr :)
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Wed, 03 Nov 1999 18:39:38 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: shared memory and semaphores
Message-Id: <Kj%T3.25215$23.1298860@typ11.nn.bcandid.com>
In article <7vponm$2th$1@nnrp1.deja.com>,
Bruce <the_ferret@my-deja.com> wrote:
>I know that perl offers some functions for System V shared memory and
>System V semaphores. That's fine when I'm developing on Solaris.
>However, for the project on which I'm currently working, the client is
>using Red Hat Linux.
>
>Can someone offer me a definitive answer, information from experience or
>point me to a website regarding the use of these same functions on
>Linux?
It supports them. There's even a kernel hack 'DIPC' that lets you
transparently use sysv ipc across a cluster.
I've never tried to use them myself on Linux; I'm an mmap() and sockets
kind of guy, and sockets work better with select() and poll() anyway.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 03 Nov 1999 19:43:18 GMT
From: bababozorg@aol.com
Subject: Simple translation, doesnt work!!!
Message-Id: <7vq38l$ag7$1@nnrp1.deja.com>
can any one please tell me why this simple translation doesn't work?
$hamed = qq~<html><body><a href="mysite?
aaaaa">iojfiowjfiefijief</a></body></html>~;
$hamed2 = qq~<a href="mysite?aaaaa">iojfiowjfiefijief</a>~;
$hamed =~ s/$hamed2/ppppppppppppp/g;
print $hamed;
thanks
hamed
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 03 Nov 1999 14:55:57 -0500
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Simple translation, doesnt work!!!
Message-Id: <brian-0311991455580001@61.new-york-78-79rs.ny.dial-access.att.net>
In article <7vq38l$ag7$1@nnrp1.deja.com>, bababozorg@aol.com wrote:
>can any one please tell me why this simple translation doesn't work?
>$hamed2 = qq~<a href="mysite?aaaaa">iojfiowjfiefijief</a>~;
>$hamed =~ s/$hamed2/ppppppppppppp/g;
you have to be careful when interpolating a string into a regex
because regex special characters, such as the ? are still special.
the are a variety of ways to deal with this, but i like to use the
\Q sequence
s/\Q$var/REPLACEMENT/;
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 3 Nov 1999 19:25:01 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: speeding up split()
Message-Id: <7vq26d$nh$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to TK Soh
<r28629@email.sps.mot.com>],
who wrote in article <38203DE5.9CD8F444@email.sps.mot.com>:
> I have looked into all the .gz and .zip in ./patches/ , but couldn't
> find the keyword 'explicit' with 'split'. Perhaps I am looking the wrong
> way?
Patches happen on p5p. ./patches/ contains maybe 0.1% of things: those
which were lost on p5p, thus need to exist by other means.
Ilya
------------------------------
Date: Wed, 03 Nov 1999 19:45:02 +0200
From: Re'em Bar <reembar@hotmail.com>
To: Tom Phoenix <rootbeer@redcat.com>
Subject: THANK YOU!
Message-Id: <3820749E.C0042E3B@hotmail.com>
thanks a lot!
I have put the title's regulat expression inside the condition and it
now works fine in both Linux & NT!
also head your @results advice.
thanks again!
--
Re'em
http://snark.co.il
------------------------------
Date: Mon, 1 Nov 1999 04:44:39 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: to Alan Flavell
Message-Id: <7enjv7.235.ln@magna.metronet.com>
Diane (tech1@magicnet.net) wrote:
: FUCK YOU!!
You should brush up on your vocabulary a bit so that you can
express yourself without resorting to profanity.
*plonk*
: I come to this group for help.
with a CGI question.
This is the Perl newsgroup. Perl questions go here.
CGI questions go in the CGI newsgroup.
Do you ask your Doctor why your brakes are squealing?
Do you ask your Mechanic what to do about an angry rash?
You may get some not-so-good answers with that approach.
: If you cannot find it in your useless no life
: heart to give help when asked for, just butt out!!!
: Please do NOT answer my posts with condescending crap!! I dont need it, nor
: do I deserve it!!
But off-topic posts _do_ deserve it. You made an off-topic post.
The well-socialized response to being told that there is a place
where you can get a better answer is more along the lines of:
"Oh, I didn't know that. I'll go ask there."
The answer to the Perl-related part of your question is:
use the print() function for making output.
_What_ should be output to accomplish your goal is a CGI question.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 03 Nov 1999 17:05:54 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: What does HAND mean?
Message-Id: <SXZT3.24687$23.1286870@typ11.nn.bcandid.com>
In article <3820676B.93BC6880@visi.com>,
Scott McGerik <scottlm@visi.com> wrote:
>Abigail wrote:
>> HTH. HAND.
>
>What does HAND mean? I am not familiar with it.
Have a nice day.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 03 Nov 1999 17:15:27 GMT
From: Mike Salter <msalter@bestweb.net>
Subject: Re: What does HAND mean?
Message-Id: <Pine.BSF.4.05.9911031215170.16305-100000@monet.bestweb.net>
On Wed, 3 Nov 1999, Scott McGerik wrote:
SM>Abigail wrote:
SM>
SM>> HTH. HAND.
SM>
SM>What does HAND mean? I am not familiar with it.
Have A Nice Day
------------------------------
Date: Wed, 3 Nov 1999 09:43:25 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: What does HAND mean?
Message-Id: <MPG.128a1414675cb1d098983d@nntp1.ba.best.com>
Scott McGerik (scottlm@visi.com) seems to say...
> Abigail wrote:
>
> > HTH. HAND.
>
> What does HAND mean? I am not familiar with it.
Helping Another Newbie, Damn.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Wed, 03 Nov 1999 12:14:14 -0600
From: Scott McGerik <scottlm@visi.com>
Subject: Re: What does HAND mean?
Message-Id: <38207B76.377F1075@visi.com>
Jonathan Stowe wrote:
> Scott McGerik <scottlm@visi.com> wrote:
> > Abigail wrote:
> >
> >> HTH. HAND.
> >
> > What does HAND mean? I am not familiar with it.
> >
> Its one of those things that most people have on the ends of their arms -
> alternatively it might be 'Have A Nice Dingo' ...
Hmmm, I did not ask what it was, I asked what it meant, so your first
response failed. Oh wait, you were trying to be funny!
Actually, I was amused by your response. :) Thanks!
Scott.
------------------------------
Date: 3 Nov 1999 13:44:43 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: What does HAND mean?
Message-Id: <slrn8214ce.dk.abigail@alexandra.delanet.com>
Scott McGerik (scottlm@visi.com) wrote on MMCCLV September MCMXCIII in
<URL:news:3820676B.93BC6880@visi.com>:
&& Abigail wrote:
&&
&& > HTH. HAND.
&&
&& What does HAND mean? I am not familiar with it.
It's the piece of meat that connects your fingers to your wrist.
HTH. HAND.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54\n" and s/<<EOT/<<EOT/ee and print;
"Just another Perl Hacker"
EOT
-----------== 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: Wed, 03 Nov 1999 12:51:40 -0500
From: Lee Silver <lsilver@information-concepts.com>
To: Peter Steele <psteele@opticalnetworks.com>
Subject: Re: Why am I getting an undefined subroutine error?
Message-Id: <3820762C.2562@information-concepts.com>
Peter:
> use Net::ping;
>
> print "alive" if pingecho('localhost', 10);
>
> but when I run this I get the error
>
> Undefined subroutine &main::pingecho called at - line 2
>
> Can anyone explain what is causing this error?
use Net::Ping;
--
// Lee Silver
// Information Concepts Inc.
Facilitating the automated conversion of Data into Information
since 1982
------------------------------
Date: Wed, 3 Nov 1999 09:09:00 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Why not DB_File?
Message-Id: <Pine.GSO.4.10.9911030903050.29670-100000@user2.teleport.com>
On Wed, 3 Nov 1999, John Shaft wrote:
> I have a client that has their server setup so that I cannot use DB_File.
> They say that they don't want any "database access" from PERL.
> Can anyone think of a reason why they would not want to use this?
No good ones. But what does their stupidity have to do with Perl? Maybe
you should ask your qusetion in alt.dilbert.pointy-haired-bosses. :-)
If you were a plumber and the client told you to use the other end of the
plunger, you'd know what to do, right?
> I guess I'll end up putting this into a text file which WILL slow down
> their server...
I'd suggest that you work on improving your skills to the point where
you'll attract a better class of client. :-)
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 03 Nov 1999 18:37:37 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Why not DB_File?
Message-Id: <Rh%T3.25213$23.1297874@typ11.nn.bcandid.com>
In article <Pine.LNX.4.10.9911031001090.30482-100000@alfred.laffeycomputer.com>,
John Shaft <shaft@meanmutha.com> wrote:
>I have a client that has their server setup so that I cannot use DB_File.
>They say that they don't want any "database access" from PERL. I have to
>use JSP or Java Servlets or similar.
Maybe they don't want you building any significant applications in
Perl, or applications that manage or access significant amounts of
data. Or maybe they're just confused.
If the latter, you can build and install DB_File yourself.
>I guess I'll end up putting this into a text file which WILL slow down
>their server...
It'll probably also be easier for them to get data out of if they throw
your script away, assuming they don't know anything about Berkeley DB.
This might be a reasonable reason for them to prefer SQL or flat text
to DB_File.
You should ask them about the text file; they might prefer that you
store it in a database so its updates have ACID properties and so it
gets backed up.
If they insist you do it that way, you might want to look into mod_perl
or FastCGI.
>Any ideas? I need to be able to find a line in a file quickly. The data I
>am searching on is the first three characters in the file. The file will
>have no more than 1000 lines. am thinking that sequentially reading will
>be fast enough. Unless anyone has a good way to do a binary search on
>something like this?
The first three characters in another file, I assume you mean?
If I were doing this and the 1000-line-index-file scheme proved too
slow, I'd split the index file into a bunch of smaller files, with
names like indexfile.a, indexfile.b, indexfile.c. Then I'd use the
first or last character of the three I was searching for (or perhaps a
hash value of the three if that character was very nonuniformly
distributed) to decide which file a particular record should be stored
or searched for in.
> I could ALWAYS have 1000 lines in the file, but
>getting to a certain line number still requires reading every line, right?
Yes, unless you make the lines fixed length, or build an external index
(like GNU info and fortune do) that tells what file offsets the lines
begin at.
>There is only one lookup per invocation so creating an index of offsets
>(using tell in order to seek to them) would be a waste of time, right?
Unless you stored that index in a file. See the 'strfile' and
'fortune' commands for a terrific example of how can work.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
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 1268
**************************************