![]() |
|
more useful options | |
PerlMonks |
How to Ask a Question (With Test::More)by tphyahoo (Vicar) |
on Aug 06, 2005 at 10:25 UTC ( #481465=perltutorial: print w/replies, xml ) | Need Help?? |
The newbie has questions... the wise old monks have answers... but all too often newbie can't communicate the question, and the wise old monks fall over each other trying to guess what the newbie might have meant -- perhaps what merlyn meant when he wrote "the only personality trait Perl programmers have in common is that they're all pathologically helpful" (Programming Perl, "Perl Culture"). Examples of this happen all the time -- see for instance the recent post at Regex doubt.
Well, pathological helpfulness (or xp greed :) ) has its bright side as a cultural feature, but enough is enough. With this series of posts I want to help everyone save time, newbies and wise old owls alike, by providing templates for how to ask certain common types of questions. This is intended to be an alternative place to point newbies to, rather than the (also very helpful, but in a more general way) How (Not) To Ask A Question. As a bonus feature, newbies learning this will also learn Test::More, a powerful tool every monk should incorporate into their life. The first example will be short. My comments are in ~ . Here goes. ******************BEGIN QUESTION TEMPLATE************************ O Wise Monks, I am having a problem I hope you can help me with. As you can see, in the following code, my zero test for the "multiplies_by_seven" function fails. ~the problem is isolated~ I tried googling on "perldoc shift" but no dice. Am I searching with the wrong search terms? ~the newbie tried to help himself first before going to the perlmonks~ What the heck am I doing wrong? ~The novice now posts his code using code tags: see Writeup Formatting Tips~ I'm on Windows XP system using the standard ActiveState perl distribution. ~The novice mentions what system he is on.~ I got both standard and error output out of my test, into one output file, by running this with perl multiplyBySeven.pl > output.txt 2>&1 output.txt. ~Enables newbie to communicate his test result with a minimum of putzing around~ The output is:
Any ideas? Thanks very much in advance, o wise monks :) ******************END QUESTION TEMPLATE************************ That's basically it. Why the 0 test fails is left as an exercise for the reader :) Update: More tutorials in this series to come. See tphyahoo's homenode for tutorials under construction :)
Back to
Tutorials
|
|