[23304] in Perl-Users-Digest
Perl-Users Digest, Issue: 5524 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 18 21:05:45 2003
Date: Thu, 18 Sep 2003 18:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 18 Sep 2003 Volume: 10 Number: 5524
Today's topics:
bibliographic database perl modules (john harrold)
Re: copy list until... <bart.lateur@pandora.be>
Re: copy list until... <abigail@abigail.nl>
create new file <cjh2011@columbia.edu>
Re: create new file <bwalton@rochester.rr.com>
Re: create new file <noreply@gunnar.cc>
Re: Intermediate Page w/ CGI Script <jgibson@mail.arc.nasa.gov>
Re: Intermediate Page w/ CGI Script <asu1@c-o-r-n-e-l-l.edu>
Re: list-parsing problem <tore@aursand.no>
Re: OT: WebGUI, any reviews? <dwilga-MUNGE@mtholyoke.edu>
Re: Parsing A Report <tore@aursand.no>
Re: perl lib all over the place (ko)
Re: Quoting "$vars" and open() (Chris Marshall)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Sep 2003 14:24:09 -0700
From: jmh17@pitt.edu (john harrold)
Subject: bibliographic database perl modules
Message-Id: <31d0e2b6.0309181324.506fec89@posting.google.com>
so i've been working on an online reference manager for our research
group. it's dandy, i'm using the Text::BibTeX module at cpan to do
imports and stuff. we use latex and so this suits our needs fairly
well. however other people using other programs like endnote would
like to use the database if it only exported in a more useful format.
so i was wondering if there was anyone out there working on a perl
module which could spit out references in various formats? that way i
could make my tool as generic as possible. if not is there anyone out
there who would be interested in creating something like this?
------------------------------
Date: Thu, 18 Sep 2003 22:20:11 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: copy list until...
Message-Id: <slbkmvo0lm5ab6nvcdcqtib30fgmtbhmmg@4ax.com>
Anno Siegel wrote:
> my @oldpresidents = grep { do { 1} .. $_ eq 'Bush' } @presidents;
Not good. Let me give an easier to test example:
rint grep { do { 1 } .. $_ eq 'N' } 'A'..'Z';
This is supposed to print letter 'A' .. 'N', no? Yet it doesn't stop at
'N':
ABCDEFGHIJKLMNOPQRSTUVWXYZ
All of them. The problem is off course that when it finished at the end,
it'll start testing again upfront, and pass!
You need an extra flag, I'm afraid there's no way around it.
print grep { !$a++ .. $_ eq 'N' } 'A'..'Z';
-->
ABCDEFGHIJKLMN
Maybe somebody can find a way using double use of .. to eliminate the
variable, but I'm not sure.
--
Bart.
------------------------------
Date: 18 Sep 2003 23:33:38 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: copy list until...
Message-Id: <slrnbmkg6i.5ci.abigail@alexandra.abigail.nl>
Bart Lateur (bart.lateur@pandora.be) wrote on MMMDCLXX September MCMXCIII
in <URL:news:slbkmvo0lm5ab6nvcdcqtib30fgmtbhmmg@4ax.com>:
() Anno Siegel wrote:
()
() > my @oldpresidents = grep { do { 1} .. $_ eq 'Bush' } @presidents;
()
() Not good. Let me give an easier to test example:
()
() rint grep { do { 1 } .. $_ eq 'N' } 'A'..'Z';
()
() This is supposed to print letter 'A' .. 'N', no? Yet it doesn't stop at
() 'N':
()
() ABCDEFGHIJKLMNOPQRSTUVWXYZ
()
() All of them. The problem is off course that when it finished at the end,
() it'll start testing again upfront, and pass!
()
() You need an extra flag, I'm afraid there's no way around it.
()
() print grep { !$a++ .. $_ eq 'N' } 'A'..'Z';
Sure there is:
print grep {!($_ eq "N" .. do {0})} "A" .. "Z"'
---> ABCDEFGHIJKLM
Or:
perl -wle 'print grep {!(/N/ ... /N/)} "A".. "Z"'
Abigail
--
BEGIN {$^H {q} = sub {pop and pop and print pop}; $^H = 2**4.2**12}
"Just "; "another "; "Perl "; "Hacker\n";
------------------------------
Date: Thu, 18 Sep 2003 18:41:05 -0400
From: Cody Hess <cjh2011@columbia.edu>
Subject: create new file
Message-Id: <bkdca1$cg7$1@newsmaster.cc.columbia.edu>
I want my script to create new files when opening a filehandle to a file
that doesn't exist.
open FILE, "> new_file.dat" or die "Failed: $!";
I believe this should happen automatically, but I get the error
Failed: No such file or directory at ./write_file_experiment.pl line 3.
Is there something wrong with my filehandle? Is there another way to
create a new file if it doesn't already exist?
------------------------------
Date: Thu, 18 Sep 2003 23:41:29 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: create new file
Message-Id: <3F6A429F.9060009@rochester.rr.com>
Cody Hess wrote:
> I want my script to create new files when opening a filehandle to a file
> that doesn't exist.
>
> open FILE, "> new_file.dat" or die "Failed: $!";
>
> I believe this should happen automatically, but I get the error
>
> Failed: No such file or directory at ./write_file_experiment.pl line 3.
>
> Is there something wrong with my filehandle? Is there another way to
> create a new file if it doesn't already exist?
>
Your code, run verbatim, works fine on my system (Windoze 98SE, AS Perl
build 806). You don't say what your OS and Perl versions are -- would
you happen to be in a directory where the user you are running doesn't
have directory write (or maybe read) priviledge (and on an OS where that
is possible)?
--
Bob Walton
------------------------------
Date: Fri, 19 Sep 2003 01:47:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: create new file
Message-Id: <bkdgiv$jr7o$1@ID-184292.news.uni-berlin.de>
Bob Walton wrote:
> Cody Hess wrote:
>>
>> open FILE, "> new_file.dat" or die "Failed: $!";
>>
>> I believe this should happen automatically, but I get the error
>>
>> Failed: No such file or directory at ./write_file_experiment.pl
>> line 3.
>
> would you happen to be in a directory where the user you are
> running doesn't have directory write (or maybe read) priviledge
> (and on an OS where that is possible)?
I had the same thought, but when testing it I got the "Permission
denied" error message, and not "No such file...".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 18 Sep 2003 11:29:56 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Intermediate Page w/ CGI Script
Message-Id: <180920031129560958%jgibson@mail.arc.nasa.gov>
In article <Xns93FA77767D91Basu1cornelledu@132.236.56.8>, A. Sinan Unur
<asu1@c-o-r-n-e-l-l.edu> wrote:
> pmbutler@attbi.com (Pete Butler) wrote in
> news:9b766f0.0309180706.3bf607b@posting.google.com:
>
> > I'm working on a CGI application using Perl. My client would like the
> > user to get some sort of "processing request" page immediately upon
> > clicking "Submit", because right now, he occasionally sees a delay
> > between clicking "Submit" and getting the results page. Is there a
> > good way to do this with CGI?
>
> http://www.stonehenge.com/merlyn/WebTechniques/col20.html
Randal provided another version in the Aug 2002 issue of Linux
Magazine, available here:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html
------------------------------
Date: 18 Sep 2003 19:43:27 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Intermediate Page w/ CGI Script
Message-Id: <Xns93FA9FF531BFDasu1cornelledu@132.236.56.8>
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote in
news:180920031129560958%jgibson@mail.arc.nasa.gov:
> In article <Xns93FA77767D91Basu1cornelledu@132.236.56.8>, A. Sinan
> Unur <asu1@c-o-r-n-e-l-l.edu> wrote:
>
>> pmbutler@attbi.com (Pete Butler) wrote in
>> news:9b766f0.0309180706.3bf607b@posting.google.com:
>>
>> > I'm working on a CGI application using Perl. My client would like
>> > the user to get some sort of "processing request" page immediately
>> > upon clicking "Submit", because right now, he occasionally sees a
>> > delay between clicking "Submit" and getting the results page. Is
>> > there a good way to do this with CGI?
>>
>> http://www.stonehenge.com/merlyn/WebTechniques/col20.html
>
> Randal provided another version in the Aug 2002 issue of Linux
> Magazine, available here:
>
> http://www.stonehenge.com/merlyn/LinuxMag/col39.html
I had the other one bookmarked. Thank you for pointing that out.
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Thu, 18 Sep 2003 20:17:46 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: list-parsing problem
Message-Id: <pan.2003.09.18.18.04.26.724533@aursand.no>
On Thu, 18 Sep 2003 09:47:00 +0000, Anno Siegel wrote:
> undef $coll{ $first}->{ $second}; # undef brings the key to existence
Uhm. I don't know what you've been drinking, but I sure want some of it! :-)
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Thu, 18 Sep 2003 14:52:09 -0400
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: OT: WebGUI, any reviews?
Message-Id: <dwilga-MUNGE-1B9F84.14520918092003@nap.mtholyoke.edu>
In article <s8kimv0rcmgj7kcati32bol2c7eqju6ou1@4ax.com>,
Bart Lateur <bart.lateur@pandora.be> wrote:
> Dan Wilga wrote:
>
> >Last I checked, the source code is available. Why not download it and
> >try it for yourself?
>
> So everybody's a security expert now, are they?
Considering that two of the original poster's questions can be answered
by installing the program (or, for that matter, using the online demo),
it's obvious that he or she was looking for a quick answer without doing
any real research first.
If I were to consider using WebGUI, I know the online demo is the first
place I'd look for answers to my questions. Then I'd probably go to
Goolge and look for negative mentions in newsgroups and web pages.
A simple search of Google using the words "WebGUI security OR flaw"
shows that the program is regularly updated, and there have been a
number of security enhancements. I should think this would suffice for
most users, even the ones who can't search for the flaws themselves.
--
Dan Wilga dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **
------------------------------
Date: Thu, 18 Sep 2003 20:17:46 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Parsing A Report
Message-Id: <pan.2003.09.18.18.16.36.526082@aursand.no>
On Thu, 18 Sep 2003 09:43:02 -0700, raven wrote:
> I have a system report that some of you may be familiar with. It is
> the output from the print_manifest command on an HP-UX system with
> ignite installed. There are divisions in the text file that I am
> trying to break up, but feel like I am going about wrong. I am trying
> to extract the block of text within 'Installed Software' up to the
> next major heading. Can someone check my work and comment? Thanks. See
> below:
> [...]
Actually, it's very easy. I won't provide you with any code for now, only
the "way of thinking" (although I might be wrong).
Start collecting data after you've recognized that 'Installed Software' is
the beginning string on the line.
Stop collecting data when you reach the next string that begins at the
beginning of the line (hope you'll understand what I mean with that), as
all the lines you want seem to be indented.
However, I wouldn't have done it this way. :-) I would have looped
through the lines and started collection data as soon as I reach something
I can count as 3 columns (eventually, and in addition, after having met
that 'Product', 'Revision', 'Description' line).
Something like that (although I have no idea if it works);
while ( <DATA> ) {
chomp;
my @cols = split( /\s+/ );
if ( $cols[0] =~ m,\d+, ) {
## Yeah, I want those lines with numbers in the first column!
print join( "\t", @cols );
}
}
I don't know if this works; I'm watching soccer and have had a few beer,
so... :-)
> $flag = 0;
One thing I've learnt during my "Perl period" is that you never should use
any "flags" in your code. If you have to, you most probably do something
wrong. Can't really explain it, though...
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: 18 Sep 2003 17:15:42 -0700
From: kuujinbo@hotmail.com (ko)
Subject: Re: perl lib all over the place
Message-Id: <92d64088.0309181615.1dc2b6d@posting.google.com>
"Sam" <samj@austarmetro.com.au> wrote in message news:<3f69c8ff@news.comindico.com.au>...
> Hello
>
> I have Perl modules all over the place and I think it would be good house
> keeping practice to get them all in one common dir. If that is true then how
> can I do that?
>
> Or just keep adding "use lib "/my/location";" at the top of the programs?
>
> I have some module.pm in the following locations
>
> /usr/local/lib/perl/5.6.1
>
> /usr/lib/perl/5.6.1
>
> /usr/local/lib/perl5/5.8.0/i686-linux
>
> /usr/local/lib/perl5/5.8.0
>
> /usr/local/lib/perl5/site_perl/5.8.0/i686-linux
>
> /usr/local/lib/perl5/site_perl/5.8.0
>
> /usr/local/lib/perl5/site_perl
>
>
>
> thanks
Please *don't* mess with the modules in these locations. These are the
default (built when Perl is installed) libraries that Perl searches
when you 'use' or 'require' a module/file, which can also be found in
Perl's special @INC array. If you type:
perl -e 'print "$_\n" foreach (@INC)'
You will get the same directories listed above (actually half of the
directories, since you seem to have two versions of Perl installed).
So if you're using one of Perl's core modules or have installed other
CPAN modules and haven't messed with the makefile, you should not need
to "use lib '/my/location';" in your programs as stated above.
*Usually*, you only need the 'use lib' pragma in two cases: (1)
personal libraries, or (2) if you don't have permission (no
root/administrator privileges) to install CPAN modules in the system
directories.
On an off topic note, I just saw your post regarding browsing the perl
documentation. If you don't find the 'perldoc...' interface intuitive,
may I suggest that you try http://www.perldoc.com/ ? It may be easier
to browse the documentation in HTML, and there is documentation for
the last six versions of Perl. The 'Perl Manpage' link takes you to
Perl's *core* documentation.
HTH - keith
------------------------------
Date: 18 Sep 2003 14:03:29 -0700
From: c_j_marshall@hotmail.com (Chris Marshall)
Subject: Re: Quoting "$vars" and open()
Message-Id: <cb9c7b76.0309181303.3121c2c4@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message
>
> What is "bad" is quoting when the *only thing* quoted is a
> scalar variable.
>
> The FAQ says that
>
> "$var"
>
> is wrong. The FAQ does not say anything about
>
> ">$var"
>
ah - ok I get it now.
Thanks for the advice and apologies if the question was badly worded.
------------------------------
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.
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 5524
***************************************