[28196] in Perl-Users-Digest
Perl-Users Digest, Issue: 9560 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 09:05:44 2006
Date: Fri, 4 Aug 2006 06:05:06 -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 Fri, 4 Aug 2006 Volume: 10 Number: 9560
Today's topics:
editing an article <nospam@home.com>
Get name of user invoking program? <justin.0511@purestblue.com>
Re: How can I call a sub in a dedicated file? anno4000@radom.zrz.tu-berlin.de
Re: How can I call a sub in a dedicated file? <mritty@gmail.com>
Re: How can I call a sub in a dedicated file? <mritty@gmail.com>
Re: How can I call a sub in a dedicated file? anno4000@radom.zrz.tu-berlin.de
Re: How can I call a sub in a dedicated file? <rvtol+news@isolution.nl>
Re: How can I call a sub in a dedicated file? <mritty@gmail.com>
Re: How probably not to hand over a variable from one p <youcontrol@hispeed.ch>
Re: How to pass 2D array to sub function and return 2D <zhushenli@gmail.com>
Re: Linux find and grep to pure Perl <not-for-replies@zombie.org.uk>
Perl script does nt parses d entire excel file please h <suvratj@gmail.com>
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Printing "" and $iIN <bik.mido@tiscalinet.it>
Re: Printing "" and $iIN <klaus03@gmail.com>
Re: Prototyping Subs as func expr, list As In map? <vtatila@mail.student.oulu.fi>
SNMP Blog about protocol and tools <deepesh_indore@yahoo.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 04 Aug 2006 12:00:42 GMT
From: "Nospam" <nospam@home.com>
Subject: editing an article
Message-Id: <KFGAg.4347$Ku5.3291@newsfe4-win.ntli.net>
I wonder if anyone can help me, I have on my site, a few articles, I would
like to edit, the articles are on three pages, with three articles per page,
each having the url link article, so far I am a little stuck on
automatically going through each article on each page and editing them, and
then moving onto the next page and editing them, and the next page. So far
this is what I have come up with:
#! perl\bin\perl
use strict;
use warnings;
use Data::Dumper;
use WWW::Mechanize;
my $text ='My new article...';
my $text2 = 'My second article...';
my $text3 = 'My third article...';
my $start;
my $mech1 = WWW::Mechanize->new(
agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
cookie_jar => {});
$mech1->get("http://www.example.com");
$mech1->form(1);
$mech1->field('username',"username");
$mech1->field('password',"password");
$mech1->click("login");
if ($mech1->success){ print "successfully logged on \n";} else{print !$;}
$mech1->follow_link( text_regex => qr/Articles/i );
#There are 3 articles per page all having the text_regex articles, one
underneath the other
for ($start=1;$start<=3;$start++) {
#at this particular point I have 3 articles per page as stated, and there
are 3 pages, I would like to edit the articles on the first page with the
same text in $text, and the the next three articles on the next page with
the text in $text2, and the next three articles on the last page with
$text3, I am a little stuck :( on how to proceed from here.
$mech1->click("Article1");
#I have 3 articles at this point, all having the link article, but three of
them of different lines, one underneath the other, I would like to go
through each of them, click on the edit article link and submit it with the
amended text in $text..$text2...$text3.
if( $mech1->success){print "success \n";} else{print !$;}
$mech1->click("Edit article");
if( $mech1->success){print "Editing article \n";} else{print !$;}
$mech1->field('text',"$text");
#I would like to do this for each articles on each page, after clicking on
the text_reg of articles, then clicking on the edit button, and filling in
the new text
$mech1->click("submit");
if ($mech1->success){ print "article successfully submitted \n";} else{print
!$;}
}
Would appreciate any help
------------------------------
Date: Fri, 04 Aug 2006 12:18:22 -0000
From: Justin C <justin.0511@purestblue.com>
Subject: Get name of user invoking program?
Message-Id: <slrned6eoe.4rb.justin.0511@stigmata.purestblue.com>
Probably an FAQ. I need to get the user name of who has invoked the
program. perldoc -q user doesn't show anything relevant, but perldoc -q
uid gives $< ... which gives the numerical id of the user. I need to get
the name from this. Is there a straightforward way of doing this or do I
have to grep /etc/passwd? ... or is there another way?
Justin.
--
Justin C by the sea.
------------------------------
Date: 4 Aug 2006 07:23:49 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <4jgb05F7u2ujU1@news.dfncis.de>
[newsgroups trimmed]
Davy <zhushenli@gmail.com> wrote in comp.lang.perl.misc:
> Hi all,
>
> If I want to call a sub function in a dedicated file like "my_sub.pl",
> how to do that?
You load the file, then call the sub. See "perldoc -f use" and
"perldoc -f require".
> Or if I have a lot of Perl file contain sub function, shall I use
> something like package?
Yes, probably. See "perldoc perlmod" for how to organize your Perl
subs.
Anno
------------------------------
Date: 4 Aug 2006 03:44:38 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <1154688278.627324.314770@b28g2000cwb.googlegroups.com>
Davy wrote:
> If I want to call a sub function in a dedicated file like "my_sub.pl",
> how to do that?
>
> Or if I have a lot of Perl file contain sub function, shall I use
> something like package?
No where near enough information given. Please post a
short-but-complete script (or scripts) which demonstrate what you want
to do. If the file contains subroutine definitions, you can simply
require 'my_sub.pl';
and then call the subroutine like you would any other subroutine. If
the code is contained in a package, you either have to export the
subroutine from the package file and import it in the main file, or you
have to fully qualify it (that is, precede the subroutine name with the
name of the package and two colons).
> Please give me some reference, thanks!
perldoc -f require
perldoc perlmod
perldoc perlmodlib
perldoc Exporter
Paul Lalli
------------------------------
Date: 4 Aug 2006 03:56:48 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <1154689008.078420.156240@h48g2000cwc.googlegroups.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> [newsgroups trimmed]
That was rather obnoxious and pointless, Anno. The OP very correclty
cross-posted instead of multi-posted, and you completely circumvented
the benefits of that decision - I was reading perl.beginners at the
time, and therefore did not see that you had answered the OP's question
in clpm. Had I, I would not have wasted my time by answering an
already answered question....
Paul Lalli
------------------------------
Date: 4 Aug 2006 11:26:44 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <4jgp7jF7vt1uU1@news.dfncis.de>
Paul Lalli <mritty@gmail.com> wrote in comp.lang.perl.misc:
>
> anno4000@radom.zrz.tu-berlin.de wrote:
> > [newsgroups trimmed]
>
> That was rather obnoxious and pointless, Anno. The OP very correclty
Huh? I trimmed perl.beginners because my news server doesn't carry it
and complained. There was no critique expressed and none implied.
Anno
------------------------------
Date: Fri, 4 Aug 2006 13:27:30 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <eavi4f.1eo.1@news.isolution.nl>
Paul Lalli schreef:
> anno4000:
>> [newsgroups trimmed]
>
> That was rather obnoxious and pointless, Anno. The OP very
correc[tl]y
> cross-posted instead of multi-posted, and you completely circumvented
> the benefits of that decision - I was reading perl.beginners at the
> time, and therefore did not see that you had answered the OP's
> question in clpm. Had I, I would not have wasted my time by
> answering an already answered question....
Maybe his newsclient just refused to post to an unknown group. I have
even heard of newsservers that allow themselves to change the Newsgroups
header field.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 4 Aug 2006 04:54:25 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How can I call a sub in a dedicated file?
Message-Id: <1154692465.374407.98300@m73g2000cwd.googlegroups.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Paul Lalli <mritty@gmail.com> wrote in comp.lang.perl.misc:
> >
> > anno4000@radom.zrz.tu-berlin.de wrote:
> > > [newsgroups trimmed]
> >
> > That was rather obnoxious and pointless, Anno. The OP very correclty
>
> Huh? I trimmed perl.beginners because my news server doesn't carry it
> and complained. There was no critique expressed and none implied.
My apologies. I misunderstood the reasoning. Mis-guessed, to be more
accurate, since there was no indication either way.
Sorry,
Paul Lalli
------------------------------
Date: Fri, 4 Aug 2006 10:54:37 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <44d30b49@news1.ethz.ch>
> it probably wasn't a good perl book if you learned all those poor perl
> coding ideas. what book was it? there are tons of bad perl books and web
> tutorials out there.
I've mentioned it several times in this thread, my book is "Learning
Perl" by Phoenix and Schwartz. One of the better solutions to my
problem (splitting code into more than one file), as it has been
recommended here a number of times, is the use of modules. In this book
modules are only mentioned as something prefabricated that one can use.
How to create them and in what situations to create them is not
mentioned in the book.
(I don't want to say modules are not important, I just want to say that
you can have read a decent book about Perl and don't know about the
importance of modules. And I know about it know, thanks to a lot of
helpful people in this thread.)
> you have some major flaws in your perl understanding there. you don't
> understand list vs scalar context and you don't 'call' an array.
That is exactly the kind of language that I appreciate in these kinds
of newsgroops and what keeps me coming back here...
'Calling an array' was figuratively speaking for using the name of an
array in some manner in one's code to access some kind of information
out of it or from it.
> @array
> is NOT reserved for anything. it is the array itself. but when it is
> evaluated in a scalar context (see context is important in perl, very
> important), it is the number of elements in the array.
Using the code '$variable = @array' and not '$variable = $array[0]' to
access the first variable of an array was an unneccessary mistake
(unneccessary in the sense that if I had been asked explicitly which of
the versions is the correct one I would have picked the correct one). I
do dozens of such mistakes every day, but in the end I find them all
(or find another way to code it), otherwise my code would not work and
produce correct results.
I was just trying to explain what my logic must have been that led me
to do such a mistake (I already knew a method to get the number of
entries in an array, $#array+1, thereby my ignorance of the fact that
'$variable = @array' gives you the number of elements was rather an
ignorance of the sort, 'I did not the other method to this'. Secondly,
Perl is such a wonderful language, in that almost always does something
whatever you code, not always what you want or expect, admittedly,
compared to other languages where compilation often fails when you try
to mix e.g. scalars and arrays. So, I sometimes guess what the correct
solution is and see what Perl makes out of it (Yes, I know, one might
call this the 'throw at the wall' technique), but I either go back to
my book and look up the correct notation or just run Perl. Both takes
time, debugging code or consulting a book.)
------------------------------
Date: 4 Aug 2006 00:46:58 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: How to pass 2D array to sub function and return 2D array?
Message-Id: <1154677618.750892.54600@m73g2000cwd.googlegroups.com>
Hi,
I understand. c's pointers are too flexible to generate bugs and Perl's
reference is more strict. Thanks!
Davy
Uri Guttman wrote:
> >>>>> "D" == Davy <zhushenli@gmail.com> writes:
>
> D> No, I use Perl in my work. And I found reference in Perl is not so
> D> clear as in C.
>
> well, considering they are dramatically different, why should they be as
> clear? c uses raw address pointers which can be manipulated, cast and
> broken in too many ways to count. perl uses intelligent references which
> can only be created by perl, can't be directly manipulated by user code
> (no segfaults from perl refs) and can only be dereferenced to the
> original thing that was referenced. does that sound like they are so
> similar that knowing c pointers would make it clear how perl's refs
> work? they have almost nothing in common.
>
> and if you think c's pointers are clear and perl's refs are not, you
> haven't done much deep data work and coding in either lang. i have done
> plenty in both and i much prefer perl's refs. tracking segfaults is not
> how i want to spend the rest of my life.
>
> uri
>
> --
> Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
> Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 04 Aug 2006 08:37:58 GMT
From: Brian Greenfield <not-for-replies@zombie.org.uk>
Subject: Re: Linux find and grep to pure Perl
Message-Id: <ki16d2h6etljcgegfm56r7iom6r8lvk9o2@4ax.com>
On 3 Aug 2006 16:58:16 -0700, fourfour2@gmail.com wrote:
>I have been looking at find2perl...
>
>I want this linux command converted to perl code, I guess using Perl
>grep and Perl find, that will run on any OS:
>
> find . -type f -exec egrep -i 'xbox|ps2' {} \; -print
>
>I don't want any OS system calls - just pure clean Perl.
If you want pure Perl versions of those commands (and many others), or
just see how others have done it, check out the Perl Power Tools
http://ppt.perl.org/.
------------------------------
Date: 4 Aug 2006 01:42:17 -0700
From: "neo" <suvratj@gmail.com>
Subject: Perl script does nt parses d entire excel file please help
Message-Id: <1154680937.928724.253180@p79g2000cwp.googlegroups.com>
The perl script does not parses d entire excel file.The problem is that
it just searches till d 9th record in the excel file.
the perl script
my $member = $FORM{'hiddenField'};
my $oExcel = new Spreadsheet::ParseExcel;
my $oBook = $oExcel->Parse($ExcelFile);
my $chipcount=0,$drivercount=0;
#print("<div id=\"Layer9\" style=\"position:absolute; left:123px;
top:197px; width:654px; height:54px; z-index:15; overflow: hidden\">");
#print("<font size=3>hidden field is $member$member</font><br></div>");
# Read the excel file
foreach my $oWkS (@{$oBook->{Worksheet}})
{
defined $oWkS->{MaxRow};
for($i=1;$i<=$oWkS->{MaxRow};$i++)
{
if($oWkS->{Cells}[$i][$membername]->Value eq "")
{
next;
}
$fullname = $oWkS->{Cells}[$i][$membername]->Value;
if(index(lc($fullname),$member)!= -1)
{
#found the member
$outname = $fullname;
$outest = $oWkS->{Cells}[$i][$est]->Value;
$outtst = $oWkS->{Cells}[$i][$tst]->Value;
for($j=0;$i<=$oWkS->{MaxRow};$i++)
{
print("row $i name $fullname<br>");
$outdriver[$drivercount] =
$oWkS->{Cells}[$i][$driver]->Value;
if($outdriver[$drivercount] ne "")
{
$drivercount++;
}
if($i<$oWkS->{MaxRow})
{
if($oWkS->{Cells}[$i+1][$membername]->Value ne "")
{
last;
}
}
}
last;
}
else
{
print("row $i name $fullname<br>");
}
}
}
please help me out
------------------------------
Date: 04 Aug 2006 07:22:07 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
Message-Id: <44d2f59e$0$57733$ae4e5890@news.nationwide.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.6 $)
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.
The article at:
http://www.catb.org/~esr/faqs/smart-questions.html
describes how to get answers from technical people in general.
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://www.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
"top-posting", "Jeopardy" (because the answer comes before the
question), or "TOFU" (Text Over, Fullquote Under).
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: 4 Aug 2006 11:16:22 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Printing "" and $iIN
Message-Id: <ju36d2lrtiv30or4ie6tcvqgagolek9de9@4ax.com>
On Fri, 04 Aug 2006 05:34:23 GMT, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:
>Escape them with a leading backslash:
> := \"0000000000000000\";
Or, since it has not been pointed out yet, use alternate delimiters:
my $string=qq|multved_HQrow${i}IN := "0000000000000000"|;
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 4 Aug 2006 05:45:29 -0700
From: "Klaus" <klaus03@gmail.com>
Subject: Re: Printing "" and $iIN
Message-Id: <1154695529.063340.82520@m73g2000cwd.googlegroups.com>
Michele Dondi wrote:
> On Fri, 04 Aug 2006 05:34:23 GMT, "J=FCrgen Exner"
> <jurgenex@hotmail.com> wrote:
>
> >Escape them with a leading backslash:
> > :=3D \"0000000000000000\";
>
> Or, since it has not been pointed out yet, use alternate delimiters:
>
> my $string=3Dqq|multved_HQrow${i}IN :=3D "0000000000000000"|;
I like using alternate delimiters, such as qq|...|
I just would like to add that you can even use curly braces qq{...}
which nest correctly with the ${i} inside the string:
my $string=3Dqq{multved_HQrow${i}IN :=3D "0000000000000000"};
------------------------------
Date: Fri, 4 Aug 2006 10:55:07 +0300
From: "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>
Subject: Re: Prototyping Subs as func expr, list As In map?
Message-Id: <eauuh8$frk$1@news.oulu.fi>
Ben Morrow wrote:
> Quoth "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>:
<snipped myself even more>
>> map { lc } @list;
>> and
>> map lc, @list;
>> Do the same thing.
>> reduce $a * $b, @list; # Won't compile.
>> Type of arg 1 to List::Util::reduce must be block or sub {} (not
>> multiplication (*))
>> Apparently the built-ins don't parse quite the same way as the
>> user-functions prototyped with the & character.
> This is correct. There is no way to get a perl sub to parse the way map
> does...
OK, that's what I thought, too. Thanks for confirming.
>> why not interpret the first argument & like map and
>> grep do it, when it isn't a code ref? From the user functions point of
>> view it could be indistinguishable from a normal code ref.
>>
>> The only downside I can see is not being able to use something totally
>> different from a code ref as the first argument, of a user sub then.
> I don't understand this: a &-prototyped sub can only accept a coderef.
> <snip>
In the above passage, I speculated a bit unclearly that: if map-like
user-functions interpreted anything that was not a coderef as though it was
an EXPR and put it inside a sub-routine, you could not pass such functions
any other type of first arguments then. But you would, however, get more
map-like behavior, I suppose. This is easier explained in perl than my
second language English skills, <smile>. Suppose that:
myMapLike EXPR, @list;
would be auto-converted to
myMapLike { EXPR } @list; # For convenience.
provided that:
ref(EXPR) ne 'CODE';
> suspect that map and grep are heavily special-cased in the lexer and
> parser, and it would be hard to get user subs to accept EXPR as well.
Impractical probably but hwy would it be hard? Couldn't you use the same
processing as for map and grep, when the usage resembles them? But one
would have to design the rest of the cases, too, such as whether this
map-like processing would work for other positional arguments than just the
first. There are probably other issues I've missed.
Hope this clarifies my original post.
--
With kind regards Veli-Pekka Tätilä (vtatila@mail.student.oulu.fi)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
------------------------------
Date: 4 Aug 2006 04:22:37 -0700
From: "Deepesh" <deepesh_indore@yahoo.co.uk>
Subject: SNMP Blog about protocol and tools
Message-Id: <1154690557.841253.99530@p79g2000cwp.googlegroups.com>
I feel glad to tell each one of you that I have started a new blog on
SNMP and network monitoring.
So if you are interested in it, do visit it regularly for some
intersting facts and some handy tutorials at following link:
http://netmng.blogspot.com
Subject: Network monitoring & management
Please feel free to comment articals and post your own ideas.
http://netmng.blogspot.com
Regards
Deepesh
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9560
***************************************