[7752] in Perl-Users-Digest
Perl-Users Digest, Issue: 1377 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 27 15:07:21 1997
Date: Thu, 27 Nov 97 12:00:25 -0800
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, 27 Nov 1997 Volume: 8 Number: 1377
Today's topics:
Re: 'Perl_dowarn' error? <rootbeer@teleport.com>
Re: ?: in lhs (Jason Gloudon)
Can I do $! = 'string' ? (Marek Rouchal)
Re: Compiling perl (Jason Gloudon)
Conditional compilation? <goetz@watson.ibm.com>
Re: Conditional compilation? <rootbeer@teleport.com>
Re: FAQ? 5.004_04 "Illegal character \015 (carriage ret <rootbeer@teleport.com>
Re: How i leave HTML tags alone ? <rootbeer@teleport.com>
Re: interpreted languages <Brian.Ewins@gssec.bt.co.uk>
Re: last element in an array? <rootbeer@teleport.com>
Newbie question. Do you recommend moving from C? <sysdev@mb.sympatico.ca>
Not a programming problem... <Xavier.Canehan@in2p3.fr>
Re: PERL Hourly Rates <Jacqui.Caren@ig.co.uk>
Re: PERL Hourly Rates <stevenjm@olywa.net>
Re: PERL Hourly Rates (I R A Aggie)
Re: problem with perl or Solaris? <rootbeer@teleport.com>
Re: Proxy Client (Faust Gertz)
Re: read from end of file (by line) (Jason Gloudon)
Re: regexp problem (Jason Gloudon)
Removing HTML tag (Ryujiy)
Re: Removing HTML tag <sfarrell+usenet@farrell.org>
Re: Silly diamond operator (<>) problem? <rootbeer@teleport.com>
Re: Strange 'print Location:' problem with Perl <rootbeer@teleport.com>
Re: Strange 'print Location:' problem with Perl (Gary Weinstein)
Re: strange problem with regular expression memory vari <rootbeer@teleport.com>
Re: sytem command test (Andrew M. Langmead)
Re: Text Matching <rootbeer@teleport.com>
Windows 95 flock problem (hapless newbie question) <benjamin.geer@worldnet.att.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 26 Nov 1997 09:11:16 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Re: 'Perl_dowarn' error?
Message-Id: <Pine.GSO.3.96.971126091022.3023C-100000@usertest.teleport.com>
On Mon, 24 Nov 1997, Mark Hazen wrote:
> Error: can't resolve symbol 'Perl_dowarn'
That's probably a sign that you've got incompatible binaries that you're
trying to link dynamically. Recompile. :-(
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 26 Nov 1997 18:05:29 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: ?: in lhs
Message-Id: <65hod9$hpl$2@daily.bbnplanet.com>
Ed Young (youngej@magpage.com) wrote:
: Dirk Vleugels wrote:
: I have no idea why this failed, it did for me also,
: but I have the workaround:
It is a bug.
: @data = qw( yes !no !nyet si ja !nien);
: foreach (@data)
: {
: push @{/^!/ ? 'reject' : 'accept'}, $_;
: }
This won't work compile with use strict nor will it work if reject or accept
are lexical variables.
Jason Gloudon
------------------------------
Date: 26 Nov 1997 19:31:23 +0100
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Can I do $! = 'string' ?
Message-Id: <65hptr$o46@buffalo.HL.Siemens.DE>
I'd like to set the error message in a module, in a way that
the caller can do:
die "Error occurred: $!\n" unless(&my_module_function);
( &my_module_function returns undef on failure and sets(?) $! )
The manual says that $! can take only numerical values; on the
other hand, $! contains error messages when evaluated in a string
context. Is it possible to assign error messages to $! somehow?
Thanks for any pointers! (my setup: p5.00305/Solaris 5.5.1)
Cheers,
Marek
PS. If you want to reply by Email, please remove -nospam- from the
address. Thank you.
--
Marek Rouchal Phone : +49 89/636-25849
SIEMENS AG, HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
------------------------------
Date: 26 Nov 1997 18:19:22 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Compiling perl
Message-Id: <65hp7a$hpl$4@daily.bbnplanet.com>
Anthony Licciardi (914398N@knotes.kodak.com) wrote:
: I have downloaded perl5 and extracted all the files into a directory. I
: have run the Configure command followed by the config.sh command. I am
: still unable to see the new directories where the libraries and
: executable should have been put into. (these directories were specified
: while running the Configure command)
: if anyone has done this could they please tell me where I went wrong. In
: the end I just want an executable 'perl' program.
: Thanks
Did you read the INSTALL and REAMDE file ?
Did you do a 'make install' ?
'make -n install' will tell you what make install would do.
Jason Gloudon
------------------------------
Date: Wed, 26 Nov 1997 11:32:04 -0500
From: Thilo Goetz <goetz@watson.ibm.com>
Subject: Conditional compilation?
Message-Id: <347C4F04.167E@watson.ibm.com>
Hi all,
first, let me say that:
- I'm new to Perl
- I checked the Camel book
- I checked the FAQ
and could not find an answer to my question.
So here it goes. I wrote a lengthy perl script that uses some features
of perl5, so it won't compile under perl4. If somebody tries to run
this script with an older version of perl, I'd like a controlled death
like so:
if ($] < 5.0) { die "$0 error: needs perl v. 5 or better, aborting.\n";
}
However, this line is never executed due to compilation errors when run
under perl4. So my question is, is there a standard way of handling
this problem? Do I need a metascript just to handle this?
-- Thilo
------------------------------
Date: Wed, 26 Nov 1997 10:05:49 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Thilo Goetz <goetz@watson.ibm.com>
Subject: Re: Conditional compilation?
Message-Id: <Pine.GSO.3.96.971126100240.3023M-100000@usertest.teleport.com>
On Wed, 26 Nov 1997, Thilo Goetz wrote:
> I wrote a lengthy perl script that uses some features
> of perl5, so it won't compile under perl4. If somebody tries to run
> this script with an older version of perl, I'd like a controlled death
In general, it's not possible. Perl4 will fail during compiling before it
can run any of your code. Another good reason to tell people to install
5.004! :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 09:14:01 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Rick Morlang <rick@ihermes.com>
Subject: Re: FAQ? 5.004_04 "Illegal character \015 (carriage return)"
Message-Id: <Pine.GSO.3.96.971126091152.3023D-100000@usertest.teleport.com>
On Tue, 25 Nov 1997, Rick Morlang wrote:
> This has got to be a FAQ, doesn't it? I can't find reference to it
> anywhere however.
> Illegal character \015 (carriage return) at ./acme2.cgi line 2.
> (Maybe you didn't strip carriage returns after a network transfer?)
Yep, this is in perldiag(1).
> Yes, I know I can just do a "fromdos" or a "sed" and get the script to
> work, but I can't go and call up or email my users who program Perl
> scripts on DOS/Win based machines and tell them they need to do this. I
> probably couldn't get half of them to understand in the first place.
Just tell them to upload text files in text (or ASCII) mode, in their FTP
client. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 09:27:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Patrick, http://www.fictional.net" <Venice@euronet.nl>
Subject: Re: How i leave HTML tags alone ?
Message-Id: <Pine.GSO.3.96.971126092638.3023J-100000@usertest.teleport.com>
On Mon, 24 Nov 1997, Patrick, http://www.fictional.net wrote:
> I want to replace the text in a HTML document...
> but i don't want to change the HTML code...
You should probably use a module which parses the HTML. I think there's
one on CPAN. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 26 Nov 1997 17:04:18 +0000
From: Brian Ewins <Brian.Ewins@gssec.bt.co.uk>
Subject: Re: interpreted languages
Message-Id: <y1u2003k2nh.fsf@gssec.bt.co.uk>
lvirden@cas.org writes:
[snipped discussion of sf in MIT Scheme]
>
> Curious that the interpreter just doesn't 'run SF' itself when ever the
> code is run - or does it modify the original source?
>
I imagine for the same reasons you don't invoke optimisers in other compilers
by default - it makes debugging harder. It's a matter of opinion whether
compilers should generate debug versions or optimised versions of code by
default (with the alternatives as options), but me, I go with this
quote from the perl manpage ( just making the crosspost relevant ;o) )
"BUGS
" The -w switch is not mandatory.
-Baz
--
Followups trimmed...
------------------------------
Date: Wed, 26 Nov 1997 09:23:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: snailgem@aol.com
Subject: Re: last element in an array?
Message-Id: <Pine.GSO.3.96.971126092223.3023G-100000@usertest.teleport.com>
On Tue, 25 Nov 1997, it was written:
> how do I reference the last element of @matches?
That would be $matches[-1]. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 11:30:20 -0600
From: Programming <sysdev@mb.sympatico.ca>
Subject: Newbie question. Do you recommend moving from C?
Message-Id: <347C5CAC.6C29@mb.sympatico.ca>
I have been experiencing
"the joy of C" the past few months.
My big complaint of using c is
that it has no string type.
This also involves memory, pointers,
syntax, etc. Massive learning curve.
So, what would be 2 statements in say Visual Basic,
dim ls_temp as string
ls_temp = "testing"
becomes many statements in c.
int li_temp; /* local integer */
char *ls_temp;
li_temp = strlen("testing");
ls_temp = (char *) malloc( ( li_temp + 1) );
/* if statements to check if malloc worked. */
/* And finally, functions to copy the string to the
pointer, and to null terminate it. (if I don't
null terminate, I usually get problems )
*/
strncpy (ls_temp, "testing", li_temp );
strncpy (&ls_temp[li_temp], "\0", 1);
Yet, the supposed advantage of C is that it is,
get this, compact! Imagine Oracle making
a database, that would have no string field.
You could have date fields, integers, reals,
boolean, individual characters,
but no string fields. Get real!
I have heard that both Java, and Perl have
string types.
Does anyone have any experience moving from
C to either of these two languages on AIX.
What have your experiences been? Would
you recommend it, or just stick with C?
What I am concerned with is:
- software/code that is reliable!
- relatively short learning curves.
- simple business that is simple, not complicated
(ie. assign the string to the variable)
- what works one year, will work 10 years from now
(no frequent upgrades and code changes required)
- compilers that give meaningful error messages
- code interfaces easily with Oracle, and can do
embedded SQL.
I am looking at this from a manager's standpoint.
Can we use the language as a reliable tool that
will do what we expect a language to do for us?
That is, in creating and writing full blown
business applications.
Another question would be, are there any special
considerations that need to be taken into
account when using either of these languages?
Special compilers, etc.
All comments welcome.
Regards,
Rodger
------------------------------
Date: Wed, 26 Nov 1997 18:49:32 +0100
From: Xavier Canehan <Xavier.Canehan@in2p3.fr>
Subject: Not a programming problem...
Message-Id: <347C612C.BD82C330@in2p3.fr>
Hi !
I have just discovered Perl and I'm already fond of it !
But I have a TERRIBLE question : why is there a camel or a llama on the
frontpage of the books ?
I have read the little poem in the llama book, but I don't think it is
just for that reason... Although it is a great poem... ;)
Please, I need the answer soon : I'm going to introduce Perl to an IT
class, and it is the only information I don't have about Perl (hum hum
;).
Thanks a lot !
Xavier.
_______________________________________________________________
La realite, c'est ce qui fait mal quand on eteint l'ordinateur.
John Warsen.
------------------------------
Date: Wed, 26 Nov 1997 16:54:59 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: PERL Hourly Rates
Message-Id: <EK9Izo.D7v@ig.co.uk>
In article <65ft6b$8ut@mtinsc03.worldnet.att.net>,
brian d foy <comdog@computerdog.com> wrote:
>In article <EK7EGp.4qr@ig.co.uk>, Jacqui Caren <Jacqui.Caren@ig.co.uk> wrote:
>
>> In article <comdog-ya02408000R2411972104240001@news.panix.com>,
>> brian d foy <comdog@computerdog.com> wrote:
>
>> >CGI scripting is trivial.
>
>> But advanced perl programming requires a level of skill that takes
>
>but i argue from the standpoint that advanced Perl programming is
>something different than CGI programming.
Agreed - but there are still a large number of CGI programmers
who do not know the difference between HTTP and CGI response headers. :-)
Many people (customers) consider all interactive web application software
to be CGi programs and therefore CGI programming. The fact that you need
to interact with databases, telephone exchanges etc is invisible to
them. Saying CGI scripting is trivial may be true in the purest
sense of the word but it gives an incorrect impression to the many.
> one's ability to program
>Perl has no relevance on the complexity of the CGI. one's ability
>to implement the CGI may be greater with experience, but that still
>doesn't change what the CGI is.
Agreed :-)
Almost everything I do these days is high-end WDB stuff. For me
well written perl/PLSQL/... is a must. The days of getting away with
hacks has long gone :-(
Can we agree to differ - I agree with your definition of CGI work
but my customers use a different definition - and the customer
is always right :-)
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 26 Nov 1997 09:36:08 -0800
From: Steven May <stevenjm@olywa.net>
Subject: Re: PERL Hourly Rates
Message-Id: <347C5E08.2FD1E9A@olywa.net>
So...
I thought this thread was going to turn into an extremely nasty flame
war. But then the focus shifted to posts dealing with programmers
perceptions of personal work, and how it stands the test of time.
Insight into other folks attitudes towards their own code, is one of the
most personally helpful things I've seen for a while.
I've noted posts where the posters seem to feel that the 'gurus' look
down on newbies and their ignorance. Careful reading of this tread
shows that is not the case at all. Ignorance is a condition we all
suffer from, but treatment IS available. Stupidity and laziness and
wanting someone else to do all the work on the other hand.....
It's nice to know that I'm not alone when I get disgusted with an ugly
piece of code I've written.
Steve
--
Blackwater-Pacific Services
------------------------------
Date: Wed, 26 Nov 1997 13:33:53 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: PERL Hourly Rates
Message-Id: <-2611971333530001@aggie.coaps.fsu.edu>
In article <347C5E08.2FD1E9A@olywa.net>, Steven May <stevenjm@olywa.net> wrote:
+ Stupidity and laziness and
I thought laziness was a virtue?
+ wanting someone else to do all the work on the other hand.....
well, ok...
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Wed, 26 Nov 1997 09:20:42 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jon Bernard <jbbernar@midway.uchicago.edu>
Subject: Re: problem with perl or Solaris?
Message-Id: <Pine.GSO.3.96.971126091911.3023F-100000@usertest.teleport.com>
On Mon, 24 Nov 1997, Jon Bernard wrote:
> I have a script which runs with MacPerl, but causes a segmentation fault
> when run with perl 5.003 under Solaris 2.5.
If it still dumps core under 5.004, try posting a short example script.
Say, five or ten lines. Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 18:22:40 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Proxy Client
Message-Id: <347c6123.589674@news.wwa.com>
On 26 Nov 1997 03:59:53 GMT, abigail@fnx.com (Abigail) wrote the
following to a recent "Aaron Young" <aaron@soltec.net> article:
>Perhaps you can try again, and indicate what the _Perl_ problems
>of what you attempt to do are?
As he is so busy sending me e-mail to tell me how rude I am and
posting 'thank very much' articles to comp.lang.perl.misc, I doubt he
will have the time.
On Tue, 25 Nov 1997 18:00:23 -0600, "Aaron Young" <aaron@soltec.net>
wrote:
>I am attempting to write a proxy client in perl. I do not want to do this
>using the LWP module as I am more interested in how the LWP module itself
>works. I looked at the source for the LWP module but my perl obviously
>isn't up to snuff to understand it that way just yet.
Then perhaps you need to follow many people's suggestions and learn
about HTTP or ask about the code you don't understand.
>What I get is this:
>
>I connect to the port
>Pass a request to the proxy server
>The server then responds with a 407 error and then the "Your client doesn't
>know how to authenticate message."
[snip]
>The proxy server is netscape. I can post the source if that will make it
>clearer (I can't right now as I don't have it handy)
That would help us figure out the Perl parts of your problem. If it
turns out that you understood the Perl, but not the HTTP, I bet
someone would kindly help you there too. But no code often equals no
helpful advice.
Another rude recommendation of mine is to purchase Clinton Wong's _Web
Client Programming with Perl_. I don't own it, but I seem to recall
that it had a chapters on learning HTTP, writing simple clients with
the socket library (not LWP), and then using LWP to write various and
sundry clients. I think there were even examples with Perl/Tk.
Perhaps the sections on using the socket library will get you started
on understanding what must go on in the LWP modules even if you can't
understand the LWP source code.
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
"If only you had plead guilty! We can manage the guilty - it is
the innocent who escape us, who cause nothing but anarchy"
-- Jean Cocteau's _Bacchus_
------------------------------
Date: 26 Nov 1997 17:57:47 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: read from end of file (by line)
Message-Id: <65hnur$hpl$1@daily.bbnplanet.com>
Scott Anthony Hamilton (sah@uow.edu.au) wrote:
: >> What I am looking to do is open a file, then read the last line,
: >> the the 2nd last line, then the 3rd last line, and so on ...
: >> until I read the first line in the file.
<
| Responses removed
>
: for $scalar (reverse <FH>) { }
: This works, but does it mean that, like the above approach, the entire
: file is read into memory? I specifically want to avoid this. It is why
: I want to read from the end of the file first, ie. anything of possible
: interest to me will be at the end of the file.
Yes, it does read the entire file into memory.
The _only_ way to do what you want without having another program do it
involves seeking from the end of the file to find the beginning and end of
each line.
It is likely someone may have done this before and is willing to share the
code.
Jason Gloudon
------------------------------
Date: 26 Nov 1997 18:13:28 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: regexp problem
Message-Id: <65hos8$hpl$3@daily.bbnplanet.com>
brian d foy (comdog@computerdog.com) wrote:
: In article <347B295C.1430@algonet.se>, rowanfan@algonet.se wrote:
: > I want to replace all the links in a document with another link,
: > I only want to change the href-attribute, the other shall be intact
: > a) <a href="http://www.asd.com" target="top">
: > b) <a target="out" href="http://www.asd.com">
: >
: > how do I do it? I tried this, but it won4t work when the case is as in
: > example b) above
: >
: > $doc =~ s/\<a(.*?)href=(.*?)\s*(.*?)\>/&fixurl($1,$2,$3)/egs;
: if you only want to change the HREF value, try isolating it from the
: other parts by checking for the value delimiters ['"\s]
: #!/usr/bin/perl -w
:
: my @tests;
:
: push @tests, q|<a href="http://www.asd.com" target="top">|;
: push @tests, q|<a target="out" href="http://www.asd.com">|;
I ^^'d what he might want to add.
foreach ( @tests )
{
m/(?:<a.*?href=['"]) #all the beginning stuff
^^
(.*?) #the URL portion
(?:['"\s].*?>) #whatever is left
^^
/six;
Since he's only changing the HREF attribute he most likely doesn't
doesn't need the rest of the tag. He might find it useful not to have
to reconstruct the tag.
Jason Gloudon
------------------------------
Date: 26 Nov 1997 17:12:07 GMT
From: ryujiy@aol.com (Ryujiy)
Subject: Removing HTML tag
Message-Id: <19971126171201.MAA03557@ladder02.news.aol.com>
Hello All !
I am new to Perl and have been working on a simple search engine as my
practice. However, I got a problem which is following After the target
sentence is found, how can I remove HTML tag. For instance, if I got following
string, I only want to display "Some sentence". I can easily remove "</A>"
using chop() function, but I cannot figure out the way to remove "<A NAME
="label"> part. Is there any function to remove front part of character or Is
there any good way to do this?
<A NAME="label">Some sentence.</A>
Thanks! I appreciate any advice.
Ryuji
------------------------------
Date: Wed, 26 Nov 1997 18:14:35 GMT
From: stephen farrell <sfarrell+usenet@farrell.org>
Subject: Re: Removing HTML tag
Message-Id: <87k9dv5xpw.fsf@phaedrus.uchicago.edu>
ryujiy@aol.com (Ryujiy) writes:
> I am new to Perl and have been working on a simple search engine as
> my practice. However, I got a problem which is following After the
> target sentence is found, how can I remove HTML tag. For instance,
> if I got following string, I only want to display "Some sentence".
> I can easily remove "</A>" using chop() function, but I cannot
> figure out the way to remove "<A NAME ="label"> part. Is there any
> function to remove front part of character or Is there any good way
> to do this?
> <A NAME="label">Some sentence.</A>
> Thanks! I appreciate any advice.
> Ryuji
I imagine something like s/<.*>//gs would be a good first
approximation at what you want...
--sf
------------------------------
Date: Wed, 26 Nov 1997 09:29:37 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Greg McDermid <mcdermidg@acm.org>
Subject: Re: Silly diamond operator (<>) problem?
Message-Id: <Pine.GSO.3.96.971126092833.3023K-100000@usertest.teleport.com>
On 26 Nov 1997, Greg McDermid wrote:
> The problem is that if the input is a specified list of files, or
> redirected input it works OK, but if I use wildcards it fails, e.g. perl
> x.pl *.err, the error being like "Can't open *.err". Is there something
> silly I missed here?
Sounds as if your perl can't find the program it uses to expand globs on
Windows-type machines. I think it's called something like perlglob.exe,
and it should have been installed with perl. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 09:17:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Strange 'print Location:' problem with Perl
Message-Id: <Pine.GSO.3.96.971126091432.3023E-100000@usertest.teleport.com>
On Tue, 25 Nov 1997, Tim Gilman wrote:
> this doesn't work (it just shows a blank page in the target frame):
>
> $article = $in{'ArticleList'};
> print "Location: $article\n\n";
Although that's valid Perl, it's possible that $in{'ArticleList'} has
something different than you expect.
> and I have confirmed that $article is being set equal to sib97181.pdf.
> I confirmed this by printing the statement to text.
Could it be that $article contains other (nonprintable) characters, such
as nulls? For debugging that sort of possibility, I often use something
like this.
print "article (in hex) is ", unpack("H*",$article), "\n";
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 17:45:41 GMT
From: gary@cs.depaul.edu (Gary Weinstein)
Subject: Re: Strange 'print Location:' problem with Perl
Message-Id: <65hnd8$obi$1@news.depaul.edu>
In article <Pine.GSO.3.96.971126091432.3023E-100000@usertest.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>On Tue, 25 Nov 1997, Tim Gilman wrote:
>
>> this doesn't work (it just shows a blank page in the target frame):
>>
>> $article = $in{'ArticleList'};
>> print "Location: $article\n\n";
>
>> and I have confirmed that $article is being set equal to sib97181.pdf.
>> I confirmed this by printing the statement to text.
It looks like the problem is one of location. Your code basically sends back
this:
Location: sib97181.pdf
Since there is no path information in the URL, the web browser will request
it from the *same* directory as the program that referenced it, which in
this case is a CGI program and (probably) resides under /cgi-bin. This means
it will request /cgi-bin/sib97181.pdf. I doubt this is the correct location
(at least it shouldn't be since a PDF file is definitely not executable).
Try something like this instead:
print "Location: /articles/$article\n\n"
Assuming, of course, that the PDF file is in /articles.
Hope this helps,
Gary
------------------------------
Date: Wed, 26 Nov 1997 09:47:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Rodkey <rodkey@citation.uptimecorp.com>
Subject: Re: strange problem with regular expression memory variables
Message-Id: <Pine.GSO.3.96.971126093138.3023L-100000@usertest.teleport.com>
On Wed, 26 Nov 1997, John Rodkey wrote:
> I have need to store a regular expression in a variable,
> and then assign another variable the memory variable
> which must be determined based on yet another variable.
That seems hard. When something seems hard in Perl, that usually means
that you're not doing it the easy way. :-)
> Here's the code I'm attempting...
>
> #!/usr/local/bin/perl -w
> # match one or more digits surrounded by non-digits
> $RE = "m@\\D+(\\d+).*@" ;
You're making an expression which will match the same things as
/m@\D+(\d+).*@/ does. That's not what you want. (The m// aren't part of
the regular expression; they merely quote it.) But even if you take the
outside junk off, you don't have an expression which does as the comment
claims.
> $_ = "Our 923 number in the middle of a String";
> $N = '$1';
> if ( $_=~$RE ) {
Although that could work, it would be better to write the regex as either
/$RE/ or /$RE/o in most cases.
> $result=$$N ;
That's using $N as a soft reference, which probably isn't what you want.
(You might be able to get what you want by setting $N to '1', but there
are better ways.)
> } else {
> $result=0;
> }
Say you're given a regular expression in $RE to match against $_ and you
need parenthesized item $N from its match. You could do this, with or
without the /o modifier.
my @matches;
my $result;
if (@matches = /$RE/) { # matching against $_
$result = $matches[$N-1];
}
Now $result is either undef or a matched string. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 16:34:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: sytem command test
Message-Id: <EK9I2C.FzD@world.std.com>
Dean Parratt <eeparrad@swansea.ac.uk> writes:
>I want to test out perl's system() command. I have been told to use
>something along the lines of "pwd >/tmp/pwd" so that I can actualy read
>the file in tmp. Can anyone tell we the correct way to implement this?
What are you trying to test out.
That you can call system()?
That they command was successful in what you intended it to do?
If you can't do the first, then you probably have a misconfigured
computer. If you are trying to test the second, then you might be
interested in the fact that system returns a number that corresponds
to the status of the execution of the command that you ran. (On a unix
system the lower 8 bits correspond to the the signal number it
received, if any, and the upper 8 bits reveal the return code.)
If the program returns a meaninful exit status, you use that to
determine if it ran correctly.
--
Andrew Langmead
------------------------------
Date: Wed, 26 Nov 1997 09:25:54 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Brian <nyc-guy@ix.netcom.com>
Subject: Re: Text Matching
Message-Id: <Pine.GSO.3.96.971126092451.3023H-100000@usertest.teleport.com>
On Wed, 26 Nov 1997, Brian wrote:
> I am trying to chop up a like of text that looks like :
> ABC "XXXXX" GHI
>
> I want to do a search on the line of text and store the data
> between the two quotes into a variable. Any help on
> how to do this would be extremely helpful.
I recommend that you use Perl to do this. Its pattern matching abilities
should make this easy. If you get stuck, let us know how far you've
gotten. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 26 Nov 1997 12:24:00 -0500
From: "Benjamin Geer" <benjamin.geer@worldnet.att.net>
Subject: Windows 95 flock problem (hapless newbie question)
Message-Id: <65hllc$r83@mtinsc02.worldnet.att.net>
Using code lifted from "Learning Perl for Win32", I'm writing a little CGI
script, under Windows 95, that takes form input and appends it to a file.
The program runs fine, as long as this line is commented out :
flock(MESSAGES, $LOCK_EX) || bail("Can't flock $filename : $!");
Otherwise, the program seems to hang there, and the browser gets an
incomplete page. Perhaps flock is never getting the lock on the file? This
happens even with a freshly created file.
I'm using ActiveState's Perl 5.003 Build 312 and Microsoft's Personal Web
Server.
I'm really stumped. The program is so small that I'm attaching it.
--
Benjamin Geer
benjamin.geer@worldnet.att.net
begin 666 message3.pl
M(R!M97-S86=E,RYP; T*(R!B>2!"96YJ86UI;B!'965R#0HC(#(U+4YO=BTY
M-PT*#0IU<V4@<W1R:6-T.PT*=7-E($-'22!Q=R@Z<W1A;F1A<F0I.PT*=7-E
M($9C;G1L('%W*$]?4D174B!/7T-214%4*3L-"@T*;7DH#0H)#0H))&9I;&5N
M86UE+ T*"21M97-S86=E+ T*"21,3T-+7T58+ T**3L-"@T*)$Q/0TM?15@@
M/2 R.PT*)&9I;&5N86UE(#T@(FUE<W-A9V5S+G1X="([#0H-"G-U8B!B86EL
M('L-"@EM>2 D97)R;W(@/2 B0%\B.PT*"7!R:6YT(&@Q*")%<G)O<B(I+"!P
M*"1E<G)O<BDL(&5N9%]H=&UL.PT*"61I92 D97)R;W([#0I]#0H-"G!R:6YT
M(&AE861E<BP@<W1A<G1?:'1M;"@B4V%V92!A(&UE<W-A9V4B*3L-"@T*:68@
M*'!A<F%M*"DI('L@(R!F;W)M(&AA<R!A;')E861Y(&)E96X@9FEL;&5D(&]U
M= T*"6UY("1M97-S86=E(#T@<&%R86TH(FUE<W-A9V4B*3L-"@ES>7-O<&5N
M*$U%4U-!1T53+" D9FEL96YA;64L($]?4D174GQ/7T-214%4+" P-C8V*2!\
M?"!B86EL*")#86XG="!O<&5N("1F:6QE;F%M92 Z("0A(BD[#0H)9FQO8VLH
M34534T%'15,L("1,3T-+7T58*2!\?"!B86EL*")#86XG="!F;&]C:R D9FEL
M96YA;64@.B D(2(I.PT*"7-E96LH34534T%'15,L(# L(#(I('Q\(&)A:6PH
M(G-E96L@9F%I;&5D(&]N("1F:6QE;F%M92 Z("0A(BD[#0H)<')I;G0@3453
M4T%'15,@*"(D;65S<V%G95QN(BD[#0H)8VQO<V4H34534T%'15,I('Q\(&1I
M92@B0V%N)W0@8VQO<V4@)&9I;&5N86UE.B D(2(I.PT*#0H)<')I;G0@<"@B
M66]U<B!M97-S86=E(&AA<R!B965N('-A=F5D+B(I.PT*"7!R:6YT(&5N9%]H
M=&UL.PT*?2!E;'-E('L-"@EP<FEN="!S=&%R=%]M=6QT:7!A<G1?9F]R;2@I
M.PT*"7!R:6YT(' H(DUE<W-A9V4Z(BD[#0H)<')I;G0@<"AT97AT87)E82@B
M;65S<V%G92(L("(B+" Q,"P@-3 I*3L-"@EP<FEN="!P*'-U8FUI="@B4V%V
M92(I+"!R97-E="@B4F5S970B*2D[#0H)<')I;G0@96YD7V9O<FTL(&5N9%]H
)=&UL.PT*?0T*
`
end
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1377
**************************************