[13063] in Perl-Users-Digest
Perl-Users Digest, Issue: 473 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 12 00:17:19 1999
Date: Wed, 11 Aug 1999 21:10:11 -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 Wed, 11 Aug 1999 Volume: 9 Number: 473
Today's topics:
Re: meaning of $mode (lstat) (Martien Verbruggen)
Need Help with regular expression malharsire@cwix.com
Re: Newbie: Sockets on Win32 (Chris)
Re: perl -splice - add an element/delete (Abigail)
Re: Problem reading forms with perl (Abigail)
Re: Problem reading forms with perl (Abigail)
Re: Problem using last with a label (Larry Rosler)
Re: problem(modules(mutual inclusion)) <rootbeer@redcat.com>
Re: suggestions for CRAP (Eric Bohlman)
Re: Win32 Perl won't display HTML <stirling@banet.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Aug 1999 03:16:48 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: meaning of $mode (lstat)
Message-Id: <A0rs3.235$gi1.46481@nsw.nnrp.telstra.net>
In article <793qx@questionexchange.com>,
QuestionExchange <USENET@questionexchange.com> writes:
[INSERTING ATTRIBUTION]
Peter Huesser <huesser@physik.unizh.ch> wrote:
[SNIPPING UNNECESSARILY QUOTED TEXT]
>> Can anybody explain me the meaninig of the mode field in the
>> lstat
^^^^^
>> returnvalue? For example a file with mode
>> -rwxr-xr-x gives the number 33261.
> Does the same thing as the C<stat()> function .....
^^^^
No, it does NOT. He asked about lstat, not stat. Even though the man
page says:
Does the same thing as the C<stat()> function
it continues to say:
(including setting the
special C<_> filehandle) but stats a symbolic link instead of the file
the symbolic link points to. If symbolic links are unimplemented on
your system, a normal C<stat()> is done.
Your omission of that is a severe error.
lstat stats the symbolic link. stat stats the file the symlink points
to.
Have a look at the man pages for stat(2) and lstat(2) on a unix box,
and maybe that will show you your errors. Many of perl's builtins are
reflections or wrappers for system calls. These are some of those.
Besides that, he did NOT ask what lstat was.
> perlfunc manpage, stat entry:
> 2 mode file mode (type and permissions)
> ...
> Because the mode contains both the file type and its
> permissions, you
And other information.
> should mask off the file type portion and (s)printf using a
> C<"%o">
> if you want to see the real permissions.
They are no more real than the other ones.
> $mode = (stat($filename))[2];
> printf "Permissions are %04o\n", $mode & 07777;
groan. He did not ask about just getting the permissions, did he? He
asked about the meaning of the field. That's all. All you had to do
was refer him to the documentation or explain it.
Answer could have been:
That number reflects the mode of the statted symbolic link. It makes
more sense if you look at it in an octal base. Your number:
# perl -e 'printf "%o\n", 33261'
100755
The last three numbers are the permissions for user, group and other
respectively. If you want to know what exactly the others mean on your
system, you should read the man page for mknod(2).
Mr/Ms/Mrs QuestionExchange,
Are you delibrately trying to piss us off? You have been told many
many times now to _NOT_ quote more than the relevant parts of the post
you reply to. You have been told to attribute the quotes. You have
been asked to format your replies correctly. You have been informed
that we don't like people hiding behind aliases like yours, posing as
an expert, while you obviously are not. It has been shown repeatedly
that many of your answers are incomplete, off the mark or plainly
wrong. The worst thing is that people who care about correct
information in this group can't even killfile you, because they need
to keep correcting you.
Please, stop posting until you get a clue from somewhere.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Thu, 12 Aug 1999 02:04:29 GMT
From: malharsire@cwix.com
Subject: Need Help with regular expression
Message-Id: <7ota36$78q$1@nnrp1.deja.com>
I have a pattern of the type
$pattern = "(PE 19PE2PS1.2PIN0)VIH_0";
I want to put back slashes before the parens to use it in a
grep later....
I tried
$pattern = s/(\(??)(.*?)(\)??)(.*?)$/\\$1$2\\$3$4/
This returns
\\(PE 19PE2PS1.2PIN0)VIH_0
TO get the correct output
\(PE 19PE2PS1.2PIN0\)VIH_0
I had to
$pattern =~ s/(\(??)([^\)\(]*?)(\)??)([^\)\(]*?)$/\\$1$2\\$3$4/
Can someone explain why???
Am I making this too complicated?? This also needs to work on
patterns like
(PE 19PE2PS1.2PIN0)
i.e. nothing after )
thanks,
Ameesh
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 12 Aug 1999 02:28:58 GMT
From: chrisl@tourneyland.com (Chris)
Subject: Re: Newbie: Sockets on Win32
Message-Id: <37b2310a.1366125@news.swbell.net>
Good Lord. I'd say something, but how can you make fun of a guy who's
idea of fun is to keep track of multiple posters & mock them, and then
make a big show of putting them in their killfile?
Sheesh.
On Thu, 12 Aug 1999 11:38:54 +1000, elephant@squirrelgroup.com
(elephant) wrote:
>Chris writes ..
>>You might want to think about trying some of the Eastern Religions
>>newsgroups, elephant, for an apparantly greatly needed dose of inner
>>peace.
>
>I hope you've already read my response to your previous post .. the
>response that told you where to find sockets examples .. because I'm
>feeling petty - so I've cancelled the article
>
>*plonk*
>
>--
> jason - elephant@squirrelgroup.com -
------------------------------
Date: 11 Aug 1999 21:56:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl -splice - add an element/delete
Message-Id: <slrn7r4dv6.d88.abigail@alexandra.delanet.com>
jatgirl@yahoo.com (jatgirl@yahoo.com) wrote on MMCLXXII September
MCMXCIII in <URL:news:7ot2qe$29j$1@nnrp1.deja.com>:
Why on earth is your posting masquerading as belonging in the thread
named 'Renaming a hash key?'. You don't followup to any posting, you
don't contribute to the thread, yet you copy an entire References:
line.
That's real bad netiquette. If you don't know how to post, don't post
at all. Learn what the buttons do before you press them.
[question snipped]
I refuse to answer questions if you can't make proper postings.
[References header fixed]
Abigail
--
ACHTUNG! ALLES LOOKENSPEEPERS!
Das Internet ist nicht fuer gefingerclicken und giffengrabben. Ist easy
droppenpacket der routers und overloaden der backbone mit der spammen und
der mime-attachmenten. Ist nicht fuer gewerken bei das dumbkopfen. Das
mausclicken sichtseeren keepen das bandwit-grabben hans in das pockets
muss; relaxen und watchen der cursorblinken.
-----------== 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: 11 Aug 1999 22:07:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problem reading forms with perl
Message-Id: <slrn7r4ei8.d88.abigail@alexandra.delanet.com>
Alan J. Flavell (flavell@mail.cern.ch) wrote on MMCLXXI September
MCMXCIII in <URL:news:Pine.HPP.3.95a.990812012831.28742B-100000@hpplus03.cern.ch>:
,, As I read it, the questioner was trying to find out what to install.
,,
,, You're telling them to read the manual that's sealed into the package,
,, before the package has even been delivered, let alone been opened.
His question was "can I dice and slice with what's in the package?". The
answer was "open it and read the instructions". What's wrong with that?
I did not answer with "open it and read the instructions" on his question
"how do I get the package?"
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: 11 Aug 1999 22:25:06 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problem reading forms with perl
Message-Id: <slrn7r4fjv.d88.abigail@alexandra.delanet.com>
genelong@my-deja.com (genelong@my-deja.com) wrote on MMCLXXI September
MCMXCIII in <URL:news:7osp15$r5o$1@nnrp1.deja.com>:
==
== My understanding is that perl is a language,
== and cgi is a method of executing a language, perl or otherwise on the
== server to do a function for a client. Is this right?
No, that is wrong. CGI is a data-exchange protocol between the invoker
of a program and the invokee. More detailed questions about CGI should
be asked in a newsgroup about CGI. And the language is spelled "Perl".
== I don't know what you mean by a shell program. When I say interpret, I
== mean that I only load the source code out on the server, not the
== compiled object code. I doubt it is compiled on the fly, so I assume
== the source is interpreted during actual execution.
Well, you are wrong. As you can find in the manual. And don't come with
the argument you don't have the manual. Every distribution of Perl comes
with the manual. You have to possibility of executing Perl programs;
hence you should have access to the manuals.
== I have heard one
== can also compile a program and put the compilation output, like an .exe
== file, out on the server, but I don't understand how an .exe file could
== run on unix, since that is a dos/windows extension.
Well, you can. And you either have to compile natively, or do a
cross-compile. But why do you *want* this? Did you read the FAQ (which
is part of the standard distribution, *and* is posted in this group
question by question) about this topic? Note that even if you don't want
to run Perl on your machine, and can't figure out ActiveStates website,
you can always grab the official, platform independent, tarball from
a CPAN site in your friendly neighbourhood, untar it (again, this is a
platform independent task) and read the podfile (which are also written
in a platform independent format). Isn't this all great?
== > Also beware that if you want to run your scripts from a web-browser,
== you
== > need to install a web-server as well. I would recommend a visit to
== > http://www.apache.org/ to get that.
==
== Ack!!! I don't want to install a web-server on my home machine! I just
== want to run my nice Windows 98 and ftp programs out to my isp when I
== want to modify my web site. Why would I need to install a web server
== at home?
Well... then what's the hassle about wanting to install Perl on your
machine, if all you're doing with Perl is writing CGI programs? I guess
someone made the assumption you actually wanted to test out your CGI
programs.
== Maybe this is where some of the miscommunication is coming from. I
== *only* use my ISP to run perl, not my home machine. They obviously
== have something, because my web site is up and running, complete with
== about 20 html forms, 4 perl programs, and icons and other goodies. So
== I already *do* interpret input from forms using perl. I can pick up
== input from the user, detect when he clicks on a button, take a certain
== action accordingly, and write html out from my perl program to create
== the next form. All that works. The only thing that does not work is
== stopping the angle brackets from disappearing when they go from the
== form to the perl program.
Well, that's the second time you mention this problem. It's also the second
time you omit your code. I guess you have a bug in line 17. Or perhaps
it's because of the drop bears. Whatever.
If your kid is ill, and you go to see the doctor, do you also leave your
kid at home, assuming all the doctor need is "my kid has red spots on
his face"?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== 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, 11 Aug 1999 19:58:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problem using last with a label
Message-Id: <MPG.121bd83281348b0a989e43@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <781qx@questionexchange.com> on 12 Aug 1999 1:2:24 GMT,
QuestionExchange <USENET@questionexchange.com> says...
<SNIP of entire article except for its first line, oddly enough>
> LINE: foreach $record...
> and not the open command. This may cause strange behaviour.
If you are going to post here, why do you refuse to conform to Usenet
etiquette? Post only that portion of the article to which you are
responding, instead of repeating the whole thing.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 11 Aug 1999 20:31:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: problem(modules(mutual inclusion))
Message-Id: <Pine.GSO.4.10.9908112028370.7774-100000@user2.teleport.com>
On Wed, 11 Aug 1999, David L Rubin wrote:
> two modules, P::M1 and P::M2.
> P::M1 exports &m1foo and &m1fee under the tag "common".
> P::M2 exports &m2foo.
>
> P::M1 uses P::M2 and imports &m2fee.
> P::M2 uses P::m1 and imports :common.
>
> P::M1::m1foo calls &m2foo.
> P::M2::m2foo calls &m1fee.
These aren't two separate modules; they're conjoined twins. If they can't
be separated without killing one, you should probably do the humane thing
and combine them into one module. After all, you can't use one without the
other being around. Or am I missing something?
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 12 Aug 1999 02:58:19 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: suggestions for CRAP
Message-Id: <7otd8b$jta@dfw-ixnews12.ix.netcom.com>
Trond Michelsen (mike@crusaders.no) wrote:
: I dont mean to step on any toes here, but wouldn't it be a good idea to
: sweep through CPAN first and identify poor/sloppy modules first?
I rather doubt that's necessary. Most of the people who use modules from
CPAN are familiar enough with Perl that they can recognize problems, and
are inclined to contact the authors directly if they think there's some
sloppy code (and the authors are inclined to fix bad code). Thus such
problems tend to be self-fixing. But pre-written scripts, which are often
used in an appliance-like way, have no such built-in review mechanism.
------------------------------
Date: Wed, 11 Aug 1999 23:27:43 -0400
From: <stirling@banet.net>
Subject: Re: Win32 Perl won't display HTML
Message-Id: <37b23d98@news1.us.ibm.net>
>Well, it works fine with command level but it won't display HTML output on
>web browser.
Check to see if you use the following statement before any HTML output:
print "Content-type:text/html\n\n";
Not having those lines would most definetly cause your script to bug,
also if would help if you would give more specific error messages.
--
Good Luck,
Stirling Hughes
sh@banet.net
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 473
*************************************