[23168] in Perl-Users-Digest
Perl-Users Digest, Issue: 5389 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 19 06:05:52 2003
Date: Tue, 19 Aug 2003 03:05:07 -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 Tue, 19 Aug 2003 Volume: 10 Number: 5389
Today's topics:
Re: Encrypting a superuser <matthew.garrish@sympatico.ca>
Re: Encrypting a superuser (UK\)
Re: excel to csv (James Willmore)
Re: excel to csv <josh@nospam.pixael.com>
Re: excel to csv <josh@nospam.pixael.com>
Re: excel to csv <josh@nospam.pixael.com>
Re: excel to csv <josh@nospam.pixael.com>
Re: excel to csv <peter@semantico.com>
Re: excel to csv <g4rry.sh0rt@zw4llet.com>
Re: Find and Replace Howto <simon@unisolve.com.au>
Re: finding subdirectories without parsing every file (Helen)
Re: Hudson River <dha@panix.com>
I love Perl <senior_citizen@alaska.com>
Re: Order of evaluation of expressions <abigail@abigail.nl>
Perl web developer wanted (London, UK) <branwell.moffat@fsite.com>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Regular Expression Question <simon@unisolve.com.au>
Re: Regular Expression Question <abigail@abigail.nl>
Send Message over UNIX Socket (Didatus)
Why a sudden taint error with change in ISP server's pe (Bill)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Aug 2003 00:35:03 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Encrypting a superuser
Message-Id: <sOh0b.749$HB4.198073@news20.bellglobal.com>
"JJ (UK)" <gee@i.cant.think.why.you'd.want.my.email.address.com> wrote in
message news:qWG%a.79$Bt5.26@newsfep1-gui.server.ntli.net...
>
> Ah, good point, I didn't make it clear that they're using Windows NT4 so
> that's not an option...
>
Can you not just set up a scheduled task for the script and let it run as a
more powerful user?
Matt
------------------------------
Date: Tue, 19 Aug 2003 09:17:26 +0100
From: "JJ \(UK\)" <gee@i.cant.think.why.you'd.want.my.email.address.com>
Subject: Re: Encrypting a superuser
Message-Id: <u0l0b.883$tS2.747653@newsfep2-win.server.ntli.net>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:sOh0b.749$HB4.198073@news20.bellglobal.com...
>
> "JJ (UK)" <gee@i.cant.think.why.you'd.want.my.email.address.com> wrote in
> message news:qWG%a.79$Bt5.26@newsfep1-gui.server.ntli.net...
> >
> > Ah, good point, I didn't make it clear that they're using Windows NT4 so
> > that's not an option...
> >
>
> Can you not just set up a scheduled task for the script and let it run as
a
> more powerful user?
>
> Matt
Nice idea, but no, there is a certain amount of manual checking and the name
of the input file changes from month to month.
--
JJ (UK)
------------------------------
Date: 19 Aug 2003 00:22:04 -0700
From: jwillmore@cyberia.com (James Willmore)
Subject: Re: excel to csv
Message-Id: <e0160815.0308182322.440af30f@posting.google.com>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message news:<Sze0b.478$HB4.84432@news20.bellglobal.com>...
> "James Willmore" <jwillmore@cyberia.com> wrote in message
> news:20030818155210.749a5661.jwillmore@cyberia.com...
> >
> > My suggestion is pick one and stick with it's functionality. I
> > believe this has been done successfully in both languages - pick one.
> >
> > If you still have a burning desire or some company restriction that
> > requires you to write in Perl for this task, have a look at the
> > Spreadsheet::WriteExcel module. This should do what you're asking to
> > do.
> >
>
> You're going in the wrong direction. The OP wants excel -> csv not csv ->
> excel. The Spreadsheet::WriteExcel module won't help for the latter.
> Assuming you're on a Windows machine and you have Excel installed, you might
> be able to use the Win32::OLE module to open the file in Excel and then use
> Excel itself to save the file to csv (from a simple macro:
> ActiveWorkbook.SaveAs FileName:="C:\test.csv", FileFormat:=xlCSV).
Spreadsheet::ParseExcel is what I meant :(
I agree that, if on a WIN32 platform, Win32::OLE is more the way to go.
I just wanted to suggest a portable option.
Both should work fine.
Half asleep.
Jim
------------------------------
Date: Tue, 19 Aug 2003 10:51:01 +0200
From: "Josh" <josh@nospam.pixael.com>
Subject: Re: excel to csv
Message-Id: <bhsoi2$2obgm$1@ID-203386.news.uni-berlin.de>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> ha scritto nel messaggio
news:Xns93DBAC1EB2F10sdn.comcast@206.127.4.25...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> "Josh" <josh@nospam.pixael.com> wrote in news:bhr2b9$275ib$1@ID-
> 203386.news.uni-berlin.de:
>
>
> Perhaps Visual Basic, or VBA, would be a better tool for doing this? Why
> do you have your heart set on Perl?
because this is like php
------------------------------
Date: Tue, 19 Aug 2003 10:52:01 +0200
From: "Josh" <josh@nospam.pixael.com>
Subject: Re: excel to csv
Message-Id: <bhsoi3$2obgm$2@ID-203386.news.uni-berlin.de>
"James Willmore" <jwillmore@cyberia.com> ha scritto nel messaggio
news:20030818155210.749a5661.jwillmore@cyberia.com...
> On Mon, 18 Aug 2003 15:55:43 +0200
> "Josh" <josh@nospam.pixael.com> wrote:
> > anybody knows a script to save an excel in csv?
> >
> > i need it for a php script
>
> If you need this for a PHP script, then wht not post to a PHP group?
> Why are you mixing languages? This is an annoying pet peeve I have.
because in php i can't do this...
> My suggestion is pick one and stick with it's functionality. I
> believe this has been done successfully in both languages - pick one.
>
> If you still have a burning desire or some company restriction that
> requires you to write in Perl for this task, have a look at the
> Spreadsheet::WriteExcel module. This should do what you're asking to
> do.
ok tnx
------------------------------
Date: Tue, 19 Aug 2003 10:52:52 +0200
From: "Josh" <josh@nospam.pixael.com>
Subject: Re: excel to csv
Message-Id: <bhsoi5$2obgm$3@ID-203386.news.uni-berlin.de>
"Matt Garrish" <matthew.garrish@sympatico.ca> ha scritto nel messaggio
news:Sze0b.478$HB4.84432@news20.bellglobal.com...
>
> "James Willmore" <jwillmore@cyberia.com> wrote in message
> news:20030818155210.749a5661.jwillmore@cyberia.com...
> >
> > My suggestion is pick one and stick with it's functionality. I
> > believe this has been done successfully in both languages - pick one.
> >
> > If you still have a burning desire or some company restriction that
> > requires you to write in Perl for this task, have a look at the
> > Spreadsheet::WriteExcel module. This should do what you're asking to
> > do.
> >
>
> You're going in the wrong direction. The OP wants excel -> csv not csv ->
> excel. The Spreadsheet::WriteExcel module won't help for the latter.
> Assuming you're on a Windows machine and you have Excel installed, you
might
> be able to use the Win32::OLE module to open the file in Excel and then
use
> Excel itself to save the file to csv (from a simple macro:
> ActiveWorkbook.SaveAs FileName:="C:\test.csv", FileFormat:=xlCSV).
i'm sorry... i'm working on a linux server
------------------------------
Date: Tue, 19 Aug 2003 10:55:47 +0200
From: "Josh" <josh@nospam.pixael.com>
Subject: Re: excel to csv
Message-Id: <bhsoj9$2pg60$1@ID-203386.news.uni-berlin.de>
<ctcgag@hotmail.com> ha scritto nel messaggio
news:20030818220430.333$2N@newsreader.com...
> "Josh" <josh@nospam.pixael.com> wrote:
> > hi all
> >
> > anybody knows a script to save an excel in csv?
>
> perldoc Spreadsheet::ParseExcel
> gives a script on the first page that should be readily adaptable
> to your need.
very good this is ok ;)
> >
> > i need it for a php script
>
> What difference does it make what script you need it for?
in my php script i download the zipped excel from a server...
then i extract the excel and save it on the server... now i can't read the
excel... i need some tool that convert excel in csv
------------------------------
Date: Tue, 19 Aug 2003 10:06:53 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: excel to csv
Message-Id: <3f41e8ad$1$10773$afc38c87@news.easynet.co.uk>
Josh wrote:
> "Matt Garrish" <matthew.garrish@sympatico.ca> ha scritto nel messaggio
> news:Sze0b.478$HB4.84432@news20.bellglobal.com...
>
>>"James Willmore" <jwillmore@cyberia.com> wrote in message
>>news:20030818155210.749a5661.jwillmore@cyberia.com...
>>
>>>My suggestion is pick one and stick with it's functionality. I
>>>believe this has been done successfully in both languages - pick one.
>>>
>>>If you still have a burning desire or some company restriction that
>>>requires you to write in Perl for this task, have a look at the
>>>Spreadsheet::WriteExcel module. This should do what you're asking to
>>>do.
>>>
>>
>>You're going in the wrong direction. The OP wants excel -> csv not csv ->
>>excel. The Spreadsheet::WriteExcel module won't help for the latter.
>>Assuming you're on a Windows machine and you have Excel installed, you
>
> might
>
>>be able to use the Win32::OLE module to open the file in Excel and then
>
> use
>
>>Excel itself to save the file to csv (from a simple macro:
>>ActiveWorkbook.SaveAs FileName:="C:\test.csv", FileFormat:=xlCSV).
>
>
> i'm sorry... i'm working on a linux server
>
>
Staroffice perhaps?
------------------------------
Date: Tue, 19 Aug 2003 10:38:13 +0000
From: Garry Short <g4rry.sh0rt@zw4llet.com>
Subject: Re: excel to csv
Message-Id: <3f41f025$0$46005$65c69314@mercury.nildram.net>
Josh wrote:
> hi all
>
> anybody knows a script to save an excel in csv?
>
> i need it for a php script
>
> tnx
Josh,
*PLEASE* try reading the posting guidelines. It would have suggested (among
other things) doing a search on something like Google Groups ... if you
had, you'd have found the following thread:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=Xns93B49CBD9408Easu1cornelledu%40132.236.56.8&rnum=5&prev=/groups%3Fq%3Dexcel%2Bcsv%2Bgroup:comp.lang.perl.misc%26hl%3Den%26lr%3D%26ie%3DUTF-8%26as_drrb%3Db%26as_mind%3D12%26as_minm%3D5%26as_miny%3D2003%26as_maxd%3D19%26as_maxm%3D8%26as_maxy%3D2003%26selm%3DXns93B49CBD9408Easu1cornelledu%2540132.236.56.8%26rnum%3D5
where I provided a sample script to do just this for Sara.
Regards,
Garry
------------------------------
Date: Tue, 19 Aug 2003 18:06:34 +1000
From: Simon Taylor <simon@unisolve.com.au>
Subject: Re: Find and Replace Howto
Message-Id: <bhslt9$nn7$1@otis.netspace.net.au>
Anuradha wrote:
> I am newbie to Perl and would like to know if this possible doing in
> Perl.
>
> I have huge number of .4gl files. I need to find and replace the
> string which contains mySchema.TO_CHAR( to CHAR( .
>
> This can be accomplished in one-liner. While the problem I am facing
> is
> mySchema.TO_CHAR() is overloaded with arguments. I need to replace
> ones which does not have ',' to TO_CHAR(). Here also care should be
> taken that
> TO_CHAR ( SUBSTR()) can also be done. so while searching it should
> handle this also.
>
> Any idea if this can be done in Perl or better do it manually.
>
> Let me know and thanks for reading this query.
>
> Anu
Hello Anu,
When I've dealt with transformations like this I first consider whether
or not the data that needs to be transformed will always
appear in some regular (and trivial) pattern, or whether it may indeed
appear in any pattern that is legally acceptable to the program that was
designed to read it.
What I mean by this is if you have lines that are all of the format:
mySchema.TO_CHAR(12)
mySchema.TO_CHAR(12, 2)
mySchema.TO_CHAR(substr(blah, blah), 10, 2)
then regular expressions may be the best solution
However, if the data is more variable:
mySchema.TO_CHAR(
12
)
other(things) that are
unrelated('mySchema').....
mySchema.TO_CHAR( -- oops a legal SQL comment?
12);
mySchema.TO_CHAR
(12, 2)
mySchema.TO_CHAR(
substr(blah
, blah), 10, 2)
then it may pay you to build a little parser to process the data.
It can be difficult working out how to strike a good balance between
these two approaches.
However in my experience doing similar transformations, the input is
usually rather orderly and lends itself well to transformation via
simple regular expressions.
Why don't you follow up this post with a small sample of the existing
data, *exactly* as it appears in the ".4gl" file, and how this data
should be transformed.
Hope this helps,
Simon Taylor
------------------------------
Date: 18 Aug 2003 22:02:56 -0700
From: helen@helephant.com (Helen)
Subject: Re: finding subdirectories without parsing every file
Message-Id: <33517f44.0308182102.525ba70b@posting.google.com>
<snip>
> If you want to do benchmarking, you can use the Benchmark module.
> This should give you a snapshot of how the changes you make far as far
> as time and CPU are concerned.
Just wanted to thank you for this suggestion. It's made my
optimisation a *lot* easier. :)
Helen
------------------------------
Date: Tue, 19 Aug 2003 05:43:33 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Hudson River
Message-Id: <slrnbk3e85.ik.dha@panix2.panix.com>
In article <f343kv8u2sq56n5k4p0iob1g2p36vboder@4ax.com>, hudson wrote:
>
> I use google search, and I think anyone in their right mind does
> several searches, reads several posts, trys things out and chooses the
> best solution.
>
> Many times I have used google and come up with bad answers or things
> that don't work...that is part of the process.
The problem is that many people, beginning programmers especially, are
not necessarily the best judges of what the "best solution" is. Leaving
a bad solution unchallenged can give the impression that it's not
actually bad... which is bad.
Bad is a *three* letter word. :-)
dha, and, no, I don't know what I mean by that last bit either... but
I'm amused. *shrug*
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
If you have a square-pattern aura, you will be shot to death by Federal
agents. - NYC street lunatic with a red hat.
------------------------------
Date: Tue, 19 Aug 2003 04:22:54 GMT
From: "Gerald Newton" <senior_citizen@alaska.com>
Subject: I love Perl
Message-Id: <1061266974.352449@prawn>
My final good bye to this world is I learned Perl. I am 59 and intend to
learn Perl this winter. I bought a whole bunch of books including the O
Reilly series. I have studied PL1, Basic, JavaScript, Fortran 4, but Perl
seems like the ultimate challenge and the ultimate money maker or monkey
maker! Anyway, I love the idea of a Swiss army chainsaw programming
language, especially after having owned several Swiss army knifes and
several Leathermans.
I want to thank you guys, especially Larry Wall, for making it all
possible.
------------------------------
Date: 19 Aug 2003 06:48:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Order of evaluation of expressions
Message-Id: <slrnbk3i17.336.abigail@alexandra.abigail.nl>
John W. Krahn (krahnj@acm.org) wrote on MMMDCXL September MCMXCIII in
<URL:news:3F417BDC.7F24A9F3@acm.org>:
==
== Just going by perlop.pod, shift() is a named unary operator which has
== lower precedence than . and . is left associative which would mean it
== would evaluate the left side first. Correct me if I'm wrong. :-)
Precedence isn't the same as order of evaluation.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: Tue, 19 Aug 2003 10:31:42 +0100
From: "Branwell Moffat" <branwell.moffat@fsite.com>
Subject: Perl web developer wanted (London, UK)
Message-Id: <3f41ee7e$0$12646$afc38c87@news.easynet.co.uk>
Hi guys
We are e-business solutions provider based in South West London, UK and are
looking for a Perl web developer to start within the next 4 weeks.
The applicant will need to have at least 2 years commercial experience and
will need to demonstrate a good to high level of skill and knowledge of:
Perl (Object oriented and as CGI scripting)
MySQL
Linux / Unix
Any other skills such as Oracle, JavaScript, ASP etc will be an advantage.
You will be part of small but growing development team and your work will
consist of creating the back-end for, and maintaining, a range of dynamic
websites and internet applications for organisations ranging from small /
medium companies to large blue chips and public sector.
Please send CV to branwell.moffat@fsite.com
Look forward to hearing from you.
Branwell Moffat
------------------------------
Date: Tue, 19 Aug 2003 02:22:41 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <EWudnUm8pPjcTdyiXTWJig@august.net>
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information
- Do not provide too much information
- Do not post binaries, HTML, or MIME
Social faux pas to avoid
- Asking a Frequently Asked Question
- Asking a question easily answered by a cursory doc search
- Asking for emailed answers
- Beware of saying "doesn't work"
- Sending a "stealth" Cc copy
Be extra cautious when you get upset
- Count to ten before composing a followup when you are upset
- Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------
Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
This newsgroup, commonly called clpmisc, is a technical newsgroup
intended to be used for discussion of Perl related issues (except job
postings), whether it be comments or questions.
As you would expect, clpmisc discussions are usually very technical in
nature and there are conventions for conduct in technical newsgroups
going somewhat beyond those in non-technical newsgroups.
This article describes things that you should, and should not, do to
increase your chances of getting an answer to your Perl question. It is
available in POD, HTML and plain text formats at:
http://mail.augustmail.com/~tadmc/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
A note to newsgroup "regulars":
Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume
A note about technical terms used here:
In this document, we use words like "must" and "should" as
they're used in technical conversation (such as you will
encounter in this newsgroup). When we say that you *must* do
something, we mean that if you don't do that something, then
it's unlikely that you will benefit much from this group.
We're not bossing you around; we're making the point without
lots of words.
Do *NOT* send email to the maintainer of these guidelines. It will be
discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary that
writes down the consensus of the group.
Before posting to comp.lang.perl.misc
Must
This section describes things that you *must* do before posting to
clpmisc, in order to maximize your chances of getting meaningful replies
to your inquiry and to avoid getting flamed for being lazy and trying to
have others do your work.
The perl distribution includes documentation that is copied to your hard
drive when you install perl. Also installed is a program for looking
things up in that (and other) documentation named 'perldoc'.
You should either find out where the docs got installed on your system,
or use perldoc to find them for you. Type "perldoc perldoc" to learn how
to use perldoc itself. Type "perldoc perl" to start reading Perl's
standard documentation.
Check the Perl Frequently Asked Questions (FAQ)
Checking the FAQ before posting is required in Big 8 newsgroups in
general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.
You can use the "-q" switch with perldoc to do a word search of the
questions in the Perl FAQs.
Check the other standard Perl docs (*.pod)
The perl distribution comes with much more documentation than is
available for most other newsgroups, so in clpmisc you should also
see if you can find an answer in the other (non-FAQ) standard docs
before posting.
It is *not* required, or even expected, that you actually *read* all of
Perl's standard docs, only that you spend a few minutes searching them
before posting.
Try doing a word-search in the standard docs for some words/phrases
taken from your problem statement or from your very carefully worded
"Subject:" header.
Really Really Should
This section describes things that you *really should* do before posting
to clpmisc.
Lurk for a while before posting
This is very important and expected in all newsgroups. Lurking means
to monitor a newsgroup for a period to become familiar with local
customs. Each newsgroup has specific customs and rituals. Knowing
these before you participate will help avoid embarrassing social
situations. Consider yourself to be a foreigner at first!
Search a Usenet archive
There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if you
can find where it has already been answered.
One such searchable archive is:
http://groups.google.com/advanced_group_search
If You Like
This section describes things that you *can* do before posting to
clpmisc.
Check Other Resources
You may want to check in books or on web sites to see if you can
find the answer to your question.
But you need to consider the source of such information: there are a
lot of very poor Perl books and web sites, and several good ones
too, of course.
Posting to comp.lang.perl.misc
There can be 200 messages in clpmisc in a single day. Nobody is going to
read every article. They must decide somehow which articles they are
going to read, and which they will skip.
Your post is in competition with 199 other posts. You need to "win"
before a person who can help you will even read your question.
These sections describe how you can help keep your article from being
one of the "skipped" ones.
Is there a better place to ask your question?
Question should be about Perl, not about the application area
It can be difficult to separate out where your problem really is,
but you should make a conscious effort to post to the most
applicable newsgroup. That is, after all, where you are the most
likely to find the people who know how to answer your question.
Being able to "partition" a problem is an essential skill for
effectively troubleshooting programming problems. If you don't get
that right, you end up looking for answers in the wrong places.
It should be understood that you may not know that the root of your
problem is not Perl-related (the two most frequent ones are CGI and
Operating System related), so off-topic postings will happen from
time to time. Be gracious when someone helps you find a better place
to ask your question by pointing you to a more applicable newsgroup.
How to participate (post) in the clpmisc community
Carefully choose the contents of your Subject header
You have 40 precious characters of Subject to win out and be one of
the posts that gets read. Don't waste them. Take care while
composing them, they are the key that opens the door to getting an
answer.
Spend them indicating what aspect of Perl others will find if they
should decide to read your article.
Do not spend them indicating "experience level" (guru, newbie...).
Do not spend them pleading (please read, urgent, help!...).
Do not spend them on non-Subjects (Perl question, one-word
Subject...)
For more information on choosing a Subject see "Choosing Good
Subject Lines":
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post
Part of the beauty of newsgroup dynamics, is that you can contribute
to the community with your very first post! If your choice of
Subject leads a fellow Perler to find the thread you are starting,
then even asking a question helps us all.
Use an effective followup style
When composing a followup, quote only enough text to establish the
context for the comments that you will add. Always indicate who
wrote the quoted material. Never quote an entire article. Never
quote a .signature (unless that is what you are commenting on).
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"Jeopardy" (because the answer comes before the question), or
"TOFU".
Reversing the chronology of the dialog makes it much harder to
understand (some folks won't even read it if written in that style).
For more information on quoting style, see:
http://web.presby.edu/~nnqadmin/nnq/nquote.html
Speak Perl rather than English, when possible
Perl is much more precise than natural language. Saying it in Perl
instead will avoid misunderstanding your question or problem.
Do not say: I have variable with "foo\tbar" in it.
Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).
Ask perl to help you
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings) and enable
"strict"ures (perldoc strict).
You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find your
problem. It is demeaning to be asked to do the work of a machine. It
will annoy the readers of your article.
You can look up any of the messages that perl might issue to find
out what the message means and how to resolve the potential mistake
(perldoc perldiag). If you would like perl to look them up for you,
you can put "use diagnostics;" near the top of your program.
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Provide enough information
If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.
First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)
Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program.
Show the output (including the verbatim text of any messages) of
your program.
Describe how you want the output to be different from what you are
getting.
If you have no idea at all of how to code up your situation, be sure
to at least describe the 2 things that you *do* know: input and
desired output.
Do not provide too much information
Do not just post your entire program for debugging. Most especially
do not post someone *else's* entire program.
Do not post binaries, HTML, or MIME
clpmisc is a text only newsgroup. If you have images or binaries
that explain your question, put them in a publically accessible
place (like a Web server) and provide a pointer to that location. If
you include code, cut and paste it directly in the message body.
Don't attach anything to the message. Don't post vcards or HTML.
Many people (and even some Usenet servers) will automatically filter
out such messages. Many people will not be able to easily read your
post. Plain text is something everyone can read.
Social faux pas to avoid
The first two below are symptoms of lots of FAQ asking here in clpmisc.
It happens so often that folks will assume that it is happening yet
again. If you have looked but not found, or found but didn't understand
the docs, say so in your article.
Asking a Frequently Asked Question
It should be understood that you may have missed the applicable FAQ
when you checked, which is not a big deal. But if the Frequently
Asked Question is worded similar to your question, folks will assume
that you did not look at all. Don't become indignant at pointers to
the FAQ, particularly if it solves your problem.
Asking a question easily answered by a cursory doc search
If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.
If you are flamed for not checking when you *did* check, then just
shrug it off (and take the answer that you got).
Asking for emailed answers
Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your
question, then you can take the time to go get the answer in the
same place where you asked the question.
It is OK to ask for a *copy* of the answer to be emailed, but many
will ignore such requests anyway. If you munge your address, you
should never expect (or ask) to get email in response to a Usenet
post.
Ask the question here, get the answer here (maybe).
Beware of saying "doesn't work"
This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you
want.
Sending a "stealth" Cc copy
A "stealth Cc" is when you both email and post a reply without
indicating *in the body* that you are doing so.
Be extra cautious when you get upset
Count to ten before composing a followup when you are upset
This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They
are most often for what was seen as a breach of netiquette. If you
have lurked for a bit, then you will know what is expected and won't
make such posts in the first place.
But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.
Count to ten after composing and before posting when you are upset
After you have written your followup, wait *another* 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.
AUTHOR
Tad McClellan <tadmc@augustmail.com> and many others on the
comp.lang.perl.misc newsgroup.
------------------------------
Date: Tue, 19 Aug 2003 17:52:34 +1000
From: Simon Taylor <simon@unisolve.com.au>
Subject: Re: Regular Expression Question
Message-Id: <bhsl32$ni6$1@otis.netspace.net.au>
Awrigh01 wrote:
> I have been working with regular expressions and was wondering if
> anyone can help me tackle this problem.
>
> I was wondering if anyone could help me with a regular expression to
> strip the following two text patterns:
>
> Bob Jones Comm'n College, Inc.,
> Tufts University,
>
> I believe that this pattern should strip words that begin with capital
> letters:
> [A-Z]\w*(\s+[A-Z]\w*)*
>
> Could someone help me with a pattern than would get both words that
> begin with capital letters or a non-word character like a "," or "."
I think it would help if you were to refine the question a litle more.
Do I understand correctly that you want to strip away lines that begin
with text like:
Bob Jones Comm'n College, Inc.,
Tufts University,
Put more generally, do you want to strip away lines that contain
words that always begin with uppercase letters?
Do these kind of lines occur at the same place in each file?
What kind of data do you *not* want to strip away?
Hope this helps,
Look forward to seeing your follow up.
Simon Taylor
------------------------------
Date: 19 Aug 2003 07:53:17 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Regular Expression Question
Message-Id: <slrnbk3lrd.bap.abigail@alexandra.abigail.nl>
Awrigh01 (awright@ymail.yu.edu) wrote on MMMDCXL September MCMXCIII in
<URL:news:cad8a63c.0308181950.2a9f2fef@posting.google.com>:
??
?? Could someone help me with a pattern than would get both words that
?? begin with capital letters or a non-word character like a "," or "."
That depends a bit on what you call a "word". Is "isn't" a word,
or are they two words? You call "," and "." non-words characters,
but what about, say, a space or a dash? Perl considers them non-word
characters, but do you?
Abigail
--
($;,$_,$|,$\)=("\@\x7Fy~*kde~box*Zoxf*Bkiaox","."x25,1,"\r");
s/./ /;{vec($_=>1+$"=>8)=ord($/^substr$;=>$"=int rand 24=>1);
print&&select$,,$,,$,,$|/($|+tr/.//c);redo if y/.//};sleep 1;
------------------------------
Date: 19 Aug 2003 00:13:57 -0700
From: christian.hammer@dynarize.de (Didatus)
Subject: Send Message over UNIX Socket
Message-Id: <a948a960.0308182313.7676fa47@posting.google.com>
i have a problem to send data over an unix domain socket
after the socket is created i am reading data from stdin und want to
send it over socket to a listener but it doesn't work. I don't know
why. There is no Errormessage. Syswrite only returns false.
This is my program:
#!/usr/bin/perl -w
use strict;
use IO::Handle;
use IO::Select;
use IO::Socket::UNIX;
use Getopt::Long;
Getopt::Long::Configure("bundling");
$|=1;
my $usock = "";
GetOptions ('socket|s=s' => \$usock);
my $sock;
$sock = IO::Socket::UNIX->new(PeerAddr => "$usock",
Type => SOCK_STREAM,
Timeout => 10 );
die "could not open socket: $!\n" unless $sock;
my $in = new IO::Handle;
$in->fdopen(fileno(STDIN),"r");
$in->blocking(0);
my $select = new IO::Select ($in);
while($select->can_read(200))
{
my $data = '';
while(my $length = $in->sysread($data,4096))
{
my $newlen = $sock->syswrite($data,$length);
}
}
------------------------------
Date: 18 Aug 2003 23:37:26 -0700
From: wherrera@lynxview.com (Bill)
Subject: Why a sudden taint error with change in ISP server's perl 5 version?
Message-Id: <239ce42f.0308182237.1174ee07@posting.google.com>
Hello all,
Recently, apparently after a version upgrade on a server, the
following taint code error message started occuring. Prior to the
change, both of the above snippets worked without error--afterwards,
only the second one did.
Could someone explain why EITHER might raise a taint error?
== version 1 ===========================================
#!/usr/bin/perl -w -T
use CGI;
use strict;
my $q = new CGI;
my $tainted = $query->param("theirs");
if($tainted && open(OUTFILE, ">filename") { print OUTFILE "data\n" }
== version 2 ==========================================
#!/usr/bin/perl -w -T
use CGI;
use strict;
my $q = new CGI;
my $tainted = $query->param("theirs");
if($tainted) {
if(open(OUTFILE, ">filename")) { print OUTFILE "data\n" }
}
=============================================
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5389
***************************************