[25129] in Perl-Users-Digest
Perl-Users Digest, Issue: 7379 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 8 18:05:21 2004
Date: Mon, 8 Nov 2004 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 8 Nov 2004 Volume: 10 Number: 7379
Today's topics:
Re: cgi question <noreply@gunnar.cc>
Re: cgi question <spamtrap@dot-app.org>
Re: Check POP3 E-mail <dsgSPAMFILTER@alum.dartmouth.org>
Re: Check POP3 E-mail <jgibson@mail.arc.nasa.gov>
Re: Extract a number from a string. <someone@example.com>
FAQ 8.8: How do I get the screen size? <comdog@panix.com>
Grabbing a PDF file from the web...how? (funkyville)
Re: Grabbing a PDF file from the web...how? <1usa@llenroc.ude.invalid>
Re: how greedy is nongreedy in regexp ? <ddunham@redwood.taos.com>
Re: map()'s BLOCK [was: "Re: Q: re Inline and Benchmark <dformosa@zeta.org.au>
Re: matching all perldoc names but no more <jgibson@mail.arc.nasa.gov>
Re: matching all perldoc names but no more <ioneabu@yahoo.com>
Re: matching all perldoc names but no more <flavell@ph.gla.ac.uk>
Re: matching all perldoc names but no more <jgibson@mail.arc.nasa.gov>
perl script with parameters (using xml) <lievemario@hotmail.com>
Re: perl script with parameters (using xml) <mritty@gmail.com>
Re: perl script with parameters (using xml) <1usa@llenroc.ude.invalid>
Re: Problem with cp in system call running Mac OS X <Joe.Smith@inwap.com>
Re: Q: re Inline and Benchmark <nospam-abuse@ilyaz.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 08 Nov 2004 23:28:21 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: cgi question
Message-Id: <2vaa4sF2j1652U1@uni-berlin.de>
Bryan Williams wrote:
> This is probably OT,
Yes, it is. You obviously have an HTML problem, and this group discusses
Perl programming.
> but I hope someone here can tell me what I am
> doing wrong.
You'd have a better reason to be hopeful if you had asked in a group
that deals with HTML.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 08 Nov 2004 17:29:21 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: cgi question
Message-Id: <Io2dnXi_AvnfbhLcRVn-pQ@adelphia.com>
Bryan Williams wrote:
> I am trying to update some old Perl cgi scripts. The following html
> generation works fine in Firefox, but returns a blank screen in IE
> ..... any clues why?
Check the HTML for errors with a validator.
One error that's readily visible is this:
> <!-- CONTENT TABLE -->
> <table border="0" cellpadding="0" cellspacing="0">
> <tr>
>
> <table border=0 cellspacing=1 cellpadding=1>
You have content here that's not enclosed in a <td> - even if we ignore
for the moment all the usual issues about (ab)using tables for layout,
that isn't kosher and can easily lead to unpredictable results.
There are probably more issues - I didn't look very closely.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Mon, 8 Nov 2004 15:37:46 -0500
From: "David Gale" <dsgSPAMFILTER@alum.dartmouth.org>
Subject: Re: Check POP3 E-mail
Message-Id: <2va3snF2eihvfU1@uni-berlin.de>
Quoth Ben Morrow <usenet@morrow.me.uk>:
> Quoth "David Gale" <dsgSPAMFILTER@alum.dartmouth.org>:
>> Wait, you're saying that the perl interpretter doesn't just skip the
>> unnecessary assignment?
>
> ~% perl -MO=Concise -e'my $x = undef'
> 6 <@> leave[1 ref] vKP/REFC ->(end)
> 1 <0> enter ->2
> 2 <;> nextstate(main 1 -e:1) v ->3
> 5 <2> sassign vKS/2 ->6
> 3 <0> undef s ->4
> 4 <0> padsv[$x:1,2] sRM*/LVINTRO ->5
> -e syntax OK
>
> Note the sassign and the undef; so no, it doesn't.
Huh. Well, that's new to me.
>> That's a surprise to me; I've always had the impression that perl
>> optimizes fairly well (I've never had a problem with its running
>> speed),
>
> I did say a trivial waste. I would bet that it almost never makes any
> difference, so it's not worth the optimizer finding it.
Yes, I'd tend to say that if this optimization is enough to make a
noticeable difference in your code, well, you've got a bigger problem to
worry about.
>> and since most early perl programmers were coming from languages
>> which did require explicit initialization,
>
> What, like shell and awk? :)
Actually, C was what I was thinking of; when I was in school, C was the
default language, and, from what I've seen, extremely common in business
programming as well. Of course, I must confess to not knowing Fortran or
COBOL, so I don't know if those required explicit initialization or not,
though I do know that both were very widely used.
>> As for wasting a reader's time: a) Anyone as familiar with perl as
>> you would immediately realize that this is an extraneous hold-over,
>> and thus not waste any time wondering about the initialization;
>
> Not true. I am familiar with Perl; however, although I had a little
> knowledge of C when I learned Perl most of my background was in BASIC
> and FoxPro, which do not require explicit initialization. When someone
> puts an explicit initial value in, it makes me think immediately that
> there is some reason why that value a. is not there anyway and b. is
> necessary (I tend to start with the assumption that the writer of the
> code wasn't a fool). If I can't see any obvious reason for it it makes
> me worry for a minute that there is something going on that I don't
> understand, which is not a kind thing to do to a reader of your code.
Hrm, always fun to see what preconceptions different people have. My early
programming was in BASIC, quickly supplanted by C; I honestly couldn't have
told you whether you needed to initialize BASIC variables or not. I do find
that, for me, at least, seeing an explicit variable initialization helps,
since I immediately without thinking, "Oh, this variable has that value".
And, of course, this is especially helpful when reading through code in a
language that I'm not intimately familiar with--imagine a language with a
default numeric value of pi, for instance. If you didn't know that and ran
across an uninitialized variable in someone's code, it could be, well,
confusing.
>> b) anyone not as wise and experienced, or whose primary experience is
>> in a different language, wouldn't even notice the initialization as
>> being out-of-place.
>
> Languages which require explicit initialization are by no means as
> common as those which do not.
Last I checked, C/C++ was very, very common. Of course, that might just be
because there are many Windows programs these days, a large number of them
written in the same language the OS is. Of course, I haven't done any sort
of survey...:-)
>> In neither case would it slow the reader down, and, in
>> fact, can often aid in interpretation--if I initialize a scalar to 0,
>> then it's clear that I intend that variable to be numeric; if I
>> initialize it to '', then it's clear that I intend to use it as a
>> string. Granted, wise perl programmers like yourself would know that
>> 0 and '' are both false values, and thus equivalent
>
> NO! They are both false, yes; but they are *NOT* equivalent, and are
> *NOT* equivalent to undef. I will occasionally write something like
>
> my $x = '';
>
> where I wish to avoid uninit value warnings, or am going to use undef
> as a flag later, or something; and that initialization tells the
> reader that there is some reason why the default initial value of
> undef won't do.
Ok, I stand corrected. My statement (and most of my subsequent argument)
was based on my personal programming style, in which I rarely leave a
variable undefined for long, so I rarely need the defined check (unless,
like you suggested, I'm using undef as a flag), and since I know that a
scalar is initialized to a numeric/string 'false' value based on what it'll
be used for, I tend to think of the false values as being equivalent.
A quick check shows that ('' == 0) is true, while ('' eq 0) is false; this
makes sense, of course. However, since I keep numeric variables and string
variables separate, I don't do cross-type checking, so I've not been
bothered by this difference.
So I stand guilty of arguing a position based on my personal coding style.
And, of course, I feel that there are enough benefits to my personal style
that I think everyone else ought to follow it as well. :-)
>> And, as argued above, I think that it does help keep things clear.
>>
>> my $var; my $var = 0; my $var = '';
>>
>> are all equivalent statements,
>
> NO THEY ARE NOT.
Again, you're right, and I'm wrong.
>> but, as pointed out above, the first
>> tells you *nothing* about how the variable is intended to be used;
>> that has to be determined through code examination. The second and
>> third, however, show their purpose immediately.
But I do still feel that this is right.
>> Ah, the great philosophy of, "If you can't become an instant expert
>> in whatever language your boss determines to be appropriate for the
>> job, you might as well flip burgers at the local burger joint."
>
> I said noting about 'expert', and nothing about 'instant'. You should
> read enough about the language to understand how it works before
> writing (real) code in it. I would have thought this was obvious.
You know, as was demonstrated at the very beginning of this post, I still
don't know how Perl works. Sure, I know a goodly percentage of the syntax,
and I know enough of it to get it to do everything I need it to, but I sure
don't know what the optimizer is doing, and I'll confess that I periodically
look stuff up in my "Programming Perl" book (it's right here next to my
keyboard as I'm typing this). And yet I use Perl pretty much every day at
the office, and consider it to be my strongest programming language
currently. (I've also heard rumor that Ada is so complex that no single
programmer fully understands it, and so the military uses it, but that
smacks of Urban Legend to me...)
If I were to hire on at a job and they told me that they needed a Prolog
program upgraded, I'd get a good reference and learn enough of that to get
the job done. If I waited until I knew fully how Prolog works, I know I'd
miss far more deadlines than I'd hit.
To me, the obvious statement is that you need to know enough of how the
language works to get the job done.
>> Code is code. Often, habits that are helpful in one language are
>> helpful in others--or do you not use subroutines, because they are
>> too similar to C's functions?
>
> Yes, I use subs, because they are a feature of *Perl*. I do not
> explicitly initialize variables where I don't need to, because such
> initializations not being required is a feature of *Perl*.
What about, oh, proper indentation? That's not a feature of Perl; in fact,
if anything, Perl would seem to encourage improper indentation, since it
treats all white space as equivalent. Other languages, such as Python,
*require* proper indentation.
>> I do, in perl. But not in most other languages. And, again, 'my
>> $x;' tells me nothing of the expected use of the variable, whereas
>> 'my $x = 0;' does. (Incidentally, 'my $x = undef;' suffers from the
>> same problem, and so I never use it. So, *in my opinion*, 'my $x;'
>> and 'my $x = undef;' are both equivalent unclear constructs, and
>> ought to be avoided.)
>
> They are not unclear; they leave $x with a value of undef, which has a
> function in Perl similar to SQL's NULL. If you came to Perl from C you
> may not yet have realised it's usefulness, as C has no equivalent.
I do use undef variables, but only when I feel I need them. This, in my
opinion, is a good case of "teach the rules to protect the student; when he
is wise enough, he will find that some rules are breakable--but he will
break them only when necessary." If you use uninitialized variables
frequently, you can end up with buggy or harder-to-read code (eg., "if(
defined($x) and $x ne '' )" vs "if( $x ne '' )" ).
------------------------------
Date: Mon, 08 Nov 2004 14:44:39 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Check POP3 E-mail
Message-Id: <081120041444396046%jgibson@mail.arc.nasa.gov>
In article <2va3snF2eihvfU1@uni-berlin.de>, David Gale
<dsgSPAMFILTER@alum.dartmouth.org> wrote:
> Quoth Ben Morrow <usenet@morrow.me.uk>:
> > Quoth "David Gale" <dsgSPAMFILTER@alum.dartmouth.org>:
[ long discussion about initializing variables in Perl snipped]
> (I've also heard rumor that Ada is so complex that no single
> programmer fully understands it, and so the military uses it, but that
> smacks of Urban Legend to me...)
This is off-topic for a Perl NG, but you brought it up, and I feel the
need to correct this misinformation. That would indeed be an Urban
Legend. I have programmed in both Ada (many years ago) and C++ (for the
past 9 years) and IMHO Ada is no where near as complex as C++. The
reference manual for Ada 83 is 330 pages, and that includes 20 pages on
Tasks, which Ada has built-in and C++ does not. Ada 95 added many more
features, but they are all optional and backwards compatible with Ada
83. (I do not have an Ada 95 reference manual.) My "C++ In A Nutshell"
runs 791 pages. While this may not be an accurate comparison, I think
you get the point (unfortunately, O'Reilly doesn't publish an "Ada In A
Nutshell".)
Ada has a bad reputation, but it is a very fine general purpose
computer language. (Of course, it's no Perl! :)
------------------------------
Date: Mon, 08 Nov 2004 21:46:44 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Extract a number from a string.
Message-Id: <8PRjd.79919$VA5.66857@clgrps13>
Adam wrote:
>
> Apologies if this is laughably simple, but it's been a long time since
> I've used Perl, and I seem to suffer from Homer Simpson's problem:
> every time I learn something new, it pushes old stuff out.
>
> I'm trying to extract a number from a line of text returned by a
> license-checking command. I open a pipe to the command, and read
> through each line that is returned. When I find the text "Maximum..."
> or "Current..." I want to extract and store the number in that line. I
> tried using something like this to start with:
>
> $lic_usage{$lic_type}{$max} = /\d+/ if (/Maximum/);
> $lic_usage{$lic_type}{$cur} = /\d+/ if (/Current/);
>
> Of course, this only stores a 1 ('True') when it finds the string, and
> I want it to record the actual digits.
$lic_usage{$lic_type}{$max} = $1 if /Maximum/ && /(\d+)/;
$lic_usage{$lic_type}{$cur} = $1 if /Current/ && /(\d+)/;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 8 Nov 2004 23:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 8.8: How do I get the screen size?
Message-Id: <cmotv6$62f$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
8.8: How do I get the screen size?
If you have Term::ReadKey module installed from CPAN, you can use it to
fetch the width and height in characters and in pixels:
use Term::ReadKey;
($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize();
This is more portable than the raw "ioctl", but not as illustrative:
require 'sys/ioctl.ph';
die "no TIOCGWINSZ " unless defined &TIOCGWINSZ;
open(TTY, "+</dev/tty") or die "No tty: $!";
unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
die sprintf "$0: ioctl TIOCGWINSZ (%08x: $!)\n", &TIOCGWINSZ;
}
($row, $col, $xpixel, $ypixel) = unpack('S4', $winsize);
print "(row,col) = ($row,$col)";
print " (xpixel,ypixel) = ($xpixel,$ypixel)" if $xpixel || $ypixel;
print "\n";
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: 8 Nov 2004 14:40:32 -0800
From: dean@realideas.com (funkyville)
Subject: Grabbing a PDF file from the web...how?
Message-Id: <cfe020bf.0411081440.2e4f0d96@posting.google.com>
All I need my script to do is go to a website and download a .pdf from
that site and save it to my hard drive. Example,
http://www.anysite.com/report.pdf
How do I do it?
I've searched for hours (groups, CPAN, etc.) and can't find anything.
For a normal html page I would just do something like this:
use LWP::Simple;
my $url;
my $content;
$url = "http://www.yahoo.com";
$content = get($url);
#then save
open(FILE, ">>C:/temp/new.html") || die "$!";
print FILE $content;
close(FILE);
This approach won't work with PDFs.
Does anyone know what to do?
Do I need special modules? What am I missing?
Thanks.
------------------------------
Date: 8 Nov 2004 22:51:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Grabbing a PDF file from the web...how?
Message-Id: <Xns959BB5A3F8311asu1cornelledu@132.236.56.8>
dean@realideas.com (funkyville) wrote in news:cfe020bf.0411081440.2e4f0d96
@posting.google.com:
> All I need my script to do is go to a website and download a .pdf from
> that site and save it to my hard drive. Example,
> http://www.anysite.com/report.pdf
>
> How do I do it?
You might want to read the docs for the actual module you are trying to
use: perldoc LWP::Simple
perl -MLWP::Simple -e"getstore(q{http://www.anysite.com/report.pdf}, q
{report.pdf})"
Enter the above as one line in your shell.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Mon, 08 Nov 2004 23:03:01 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: how greedy is nongreedy in regexp ?
Message-Id: <FWSjd.6378$zx1.6090@newssvr13.news.prodigy.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> peter pilsl <pilsl@goldfisch.at> wrote in comp.lang.perl.misc:
>>
>>
>> the following substitution does not what I want. So I ask myself where
>> the knot in my brain is this time.
>>
>> I want to clean up urls and make a/b/c/../e/f => a/b/e/f
> The standard module File::Spec has canonpath() to do this. Since
> canonpath() does a logical cleanup without looking at a physical
> file system, it should work for URLs.
Note that this is not a valid cleanup in the presence of symbolic links.
So when run on Unix (or Mac or OS2), File::Spec->canonpath() will not
convert the string.
$ perl -MFile::Spec -le 'print File::Spec->canonpath("a/b/c/../d/e");'
a/b/c/../d/e
Because Win32 filesystems don't support symlinks, you can explicitly run
the win32 module to do this...
$ perl -MFile::Spec::Win32 -le 'print File::Spec::Win32->canonpath("a/b/c/../d/e");'
a\b\d\e
Whether you can cope with the backslashes is another question....
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
------------------------------
Date: 09 Nov 2004 07:32:10 +1100
From: ? the Platypus {aka David Formosa} <dformosa@zeta.org.au>
Subject: Re: map()'s BLOCK [was: "Re: Q: re Inline and Benchmark"]
Message-Id: <m31xf46q0l.fsf@dformosa.zeta.org.au>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Michele Dondi <bik.mido@tiscalinet.it> wrote in comp.lang.perl.misc:
[...]
> > Well, I guess I can live with it too. Especially since I had never
> > even noticed up until now! However, out of curiosity: do you think
> > that it "ought" to be allowed, hypothetically speaking?
>
> It ought to work if we expected orthogonal design: Never mind what kind
> of block, "use" and "no" can go into it. But this is Perl...
I don't think this is fair, perl brakes orthogonality when
orthogonality makes things harder. When orthogonality makes things
easer then orthogonality shouldn't be broken.
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
------------------------------
Date: Mon, 08 Nov 2004 12:55:00 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: matching all perldoc names but no more
Message-Id: <081120041255008693%jgibson@mail.arc.nasa.gov>
In article <10oq6todvqrl2e8@news.supernews.com>, wana
<ioneabu@yahoo.com> wrote:
> Tad McClellan wrote:
>
> > wana <ioneabu@yahoo.com> wrote:
> >
[ problem of untainting perldoc subjects snipped ]
> >
> > I think this ought to work though: /^(\w|::)+$/
>
> I only avoided \w because perlre states that it is not portable across
> character sets and may be insecure, which is critical in my case. That may
> or may not be an issue in my program.
Where in perldoc perlre does it say that? It does not say it in the
version (5.8.5) on my computer. I could not find the string 'insecure'
anywhere in 'perldoc perlre', and 'portable' only occurs once in a
discussion of character ranges.
------------------------------
Date: Mon, 08 Nov 2004 17:37:10 -0500
From: wana <ioneabu@yahoo.com>
Subject: Re: matching all perldoc names but no more
Message-Id: <10ovpuorbdjee88@news.supernews.com>
Jim Gibson wrote:
> In article <10oq6todvqrl2e8@news.supernews.com>, wana
> <ioneabu@yahoo.com> wrote:
>
>> Tad McClellan wrote:
>>
>> > wana <ioneabu@yahoo.com> wrote:
>> >
>
> [ problem of untainting perldoc subjects snipped ]
>
>> >
>> > I think this ought to work though: /^(\w|::)+$/
>>
>> I only avoided \w because perlre states that it is not portable across
>> character sets and may be insecure, which is critical in my case. That
>> may or may not be an issue in my program.
>
> Where in perldoc perlre does it say that? It does not say it in the
> version (5.8.5) on my computer. I could not find the string 'insecure'
> anywhere in 'perldoc perlre', and 'portable' only occurs once in a
> discussion of character ranges.
The words to look for are 'unsafe' and 'unportable' about 78% into perlre.
The discussion about character ranges is what I am talking about.
[a-zA-Z1-9] is safe but \w may vary in different locales.
wana
------------------------------
Date: Mon, 8 Nov 2004 22:41:06 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: matching all perldoc names but no more
Message-Id: <Pine.LNX.4.61.0411082225240.17835@ppepc56.ph.gla.ac.uk>
On Mon, 8 Nov 2004, wana wrote:
> Jim Gibson wrote:
>
> > In article <10oq6todvqrl2e8@news.supernews.com>, wana
> >> I only avoided \w because perlre states that it is not portable
> >> across character sets and may be insecure, which is critical in
> >> my case. That may or may not be an issue in my program.
That depends on what you mean by "insecure".
> > Where in perldoc perlre does it say that? It does not say it in
> > the version (5.8.5) on my computer. I could not find the string
> > 'insecure' anywhere in 'perldoc perlre', and 'portable' only
> > occurs once in a discussion of character ranges.
>
> The words to look for are 'unsafe' and 'unportable' about 78% into perlre.
I don't read that as being about "security" (in the usual meaning of
that term)...
> The discussion about character ranges is what I am talking about.
> [a-zA-Z1-9] is safe
It'll reliably do a specific job. I'd suggest that the use of the
word "unsafe" in the documentation is a bit misleading. I think in
this specific reference it means "might not do what the naive reader
expects"; but "unsafe" often refers to the possibility of malicious
data causing security-relevant damage to result (such as, for example,
unintended interpolation taking place using externally-derived data),
and that's not what is intended here, AFAICS.
> but \w may vary in different locales.
Which, in some situations, might be exactly what one wants.
all the best
------------------------------
Date: Mon, 08 Nov 2004 14:54:11 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: matching all perldoc names but no more
Message-Id: <081120041454110367%jgibson@mail.arc.nasa.gov>
In article <10ovpuorbdjee88@news.supernews.com>, wana
<ioneabu@yahoo.com> wrote:
> Jim Gibson wrote:
>
> > In article <10oq6todvqrl2e8@news.supernews.com>, wana
> > <ioneabu@yahoo.com> wrote:
> >
> >> Tad McClellan wrote:
> >>
> >> > wana <ioneabu@yahoo.com> wrote:
> >> >
> >
> > [ problem of untainting perldoc subjects snipped ]
> >
> >> >
> >> > I think this ought to work though: /^(\w|::)+$/
> >>
> >> I only avoided \w because perlre states that it is not portable across
> >> character sets and may be insecure, which is critical in my case. That
> >> may or may not be an issue in my program.
> >
> > Where in perldoc perlre does it say that? It does not say it in the
> > version (5.8.5) on my computer. I could not find the string 'insecure'
> > anywhere in 'perldoc perlre', and 'portable' only occurs once in a
> > discussion of character ranges.
>
> The words to look for are 'unsafe' and 'unportable' about 78% into perlre.
> The discussion about character ranges is what I am talking about.
> [a-zA-Z1-9] is safe but \w may vary in different locales.
The warning is about defining your own character ranges, such as [ -~]
for the ascii printable set. That may give an error in other character
sets. The doc says nothing about character classes such as \w being
unsafe or unportable across character sets. In fact, it implies that
using \w is safer than defining your own character sets.
Here it is from perlre:
"Note also that the whole range idea is rather unportable between char-
acter sets--and even within character sets they may cause results you
probably didn't expect. A sound principle is to use only ranges that
begin from and end at either alphabets of equal case ([a-e], [A-E]), or
digits ([0-9]). Anything else is unsafe. If in doubt, spell out the
character sets in full."
------------------------------
Date: Mon, 8 Nov 2004 21:10:37 +0100
From: "lievemario" <lievemario@hotmail.com>
Subject: perl script with parameters (using xml)
Message-Id: <cmojos$rce$1@snic.vub.ac.be>
hello,
I 'm trying to write a perl script wich is adjustable via parameters that
gets some specific information out of a database and that makes a xml file
of that information.
Can someone help me, give me an example or so of such a perl script.
Thank you.
------------------------------
Date: Mon, 08 Nov 2004 20:24:46 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: perl script with parameters (using xml)
Message-Id: <iCQjd.91$Bj2.37@trndny01>
"lievemario" <lievemario@hotmail.com> wrote in message
news:cmojos$rce$1@snic.vub.ac.be...
> hello,
> I 'm trying to write a perl script wich is adjustable via parameters
that
> gets some specific information out of a database and that makes a xml
file
> of that information.
> Can someone help me, give me an example or so of such a perl script.
Your problem description is remarkably vague. What exactly do you need
help with? What have you tried so far?
Help with command line parameters?
perldoc perlvar (search for @ARGV)
Help with database access?
perldoc DBI
Help with creating a file and printing text to it?
perldoc -f open
perldoc -f print
Help with XML usage?
http://search.cpan.org (search for XML)
Paul Lalli
------------------------------
Date: 8 Nov 2004 22:00:29 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl script with parameters (using xml)
Message-Id: <Xns959BAD05837B1asu1cornelledu@132.236.56.8>
"lievemario" <lievemario@hotmail.com> wrote in
news:cmojos$rce$1@snic.vub.ac.be:
> hello,
> I 'm trying to write a perl script wich is adjustable via parameters
> that gets some specific information out of a database and that makes a
> xml file of that information.
> Can someone help me, give me an example or so of such a perl script.
See http://search.cpan.org/~rustyp/Config-Magic-0.75/lib/Config/Magic.pm
You might want to browse/search CPAN before posting here. Once you attempt
to put together a script, feel free to post specific questions here. Before
doing so, however, you should read the posting guidelines posted here
frequently.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Mon, 08 Nov 2004 19:50:09 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Problem with cp in system call running Mac OS X
Message-Id: <R5Qjd.382062$D%.339518@attbi_s51>
Tom McDonough wrote:
> $copy = `cp mris/$thisone mris/temp/$thisone`;
>
> Elicits this:
> usage: cp [-R [-H | -L | -P]] [-f | -i] [-p] src target
> cp [-R [-H | -L | -P]] [-f | -i] [-p] src1 ... srcN directory
> sh: mris/temp/test.pl: No such file or directory
Any time you have a problem with backticks or system(), the first thing
you should do is print out the command that you think you are executing.
Adding a simple
print "About to execute 'cp mis/$thisone mris/temp/$thisone'\n";
would have immediately pointed out the source of your problem.
-Joe
------------------------------
Date: Mon, 8 Nov 2004 22:51:37 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Q: re Inline and Benchmark
Message-Id: <cmot9p$2pn4$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Sisyphus
<kalinaubears@iinet.net.au>], who wrote in article <418f14e0$0$6553$5a62ac22@per-qv1-newsreader-01.iinet.net.au>:
> >> SvPOK_on(outsv);
> >> SvCUR_set(outsv, len);
> >> return outsv;
> > This is not enough.
> >
> > *SvEND(outsv) = 0; /* Terminate by \0 */
And, of course, the initial NEWSV() should have len+1 to accomodate
this 0...
> Aahh!! I had done a Devel::Peek::Dump of the various return values and
> noticed that the \0 was missing - though CUR and LEN were set correctly.
> I couldn't work out how to remedy that. Every successful attempt to add
> the \0 seemed to screw up either LEN or CUR (or both). Now I know how to
> achieve it. Thanks Ilya.
Sorry for giving help in so small increments... Usually I just
cut&paste from my old XS code...
Yours,
Ilya
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7379
***************************************