Greetings monks,

A goodly portion of all new Seekers of Perl Wisdom posts seem to have as their first reply, that the poster should have added

use strict; use warnings;

at the top of their code before submitting the question to SoPW. This makes sense, since in many cases that would have given the right clues as to how to fix the problem.

So, how about having the SoPW input box give a gentle nudge/reminder in this direction - something to the effect of "Before submitting your question, have you made your program use strict and/or warnings?".

Currently these are the only reminders:

Not sure if you're posting in the right place? Check out Where do I post X?
Not sure how to use all of this? Check out How to link or How to display code and escape characters.

Thoughts?

...Guv

Replies are listed 'Best First'.
Re: Automatic reminder to use strict in new SoPW posts...
by $code or die (Deacon) on Feb 02, 2002 at 20:08 UTC

    IIRC, this has been suggested a few times before. The consensus was that it won't make very much difference: The current messages don't work very well (the main job of editors seems to be editing badly formatted posts and moving them to the correct section).

    People tend not read those messages. If they did, they'd think to look in Q&A first or do a search for similar posts, etc. Besides, where would we stop? If it's too long people will be less likely to read it.

    ___ Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
Re: Automatic reminder to use strict in new SoPW posts...
by trs80 (Priest) on Feb 02, 2002 at 19:22 UTC
    I think that is a good suggestion and an option to turn off the dispaly of the reminder should also be given in user settings.
      Good follow-up suggestion.
Re: Automatic reminder to use strict in new SoPW posts...
by cjf (Parson) on Feb 02, 2002 at 23:08 UTC
    This doesn't seem necessary to me, then again I haven't had to tell people to use strict; 452 times yet ;-).

    Either way, if this is implemented I'd highly recommend placing a link to an explanation of what strict/warnings are and why they should always be used. Many people new to Perl do not know, and it would be pretty useless asking them without providing an explanation.

Re: Automatic reminder to use strict in new SoPW posts...
by    (Sexton) on Feb 03, 2002 at 13:52 UTC

    If it's going to be read, it will have to be unavoidable.

    I'd say that to make it efficient, there has to be JavaScript executed when the users submits the form. This JS will have to check the textarea field and look for the words use strict;. This can be done using the JS version of regexes. (Yes, they exist, for those of you that didn't believe so. Not as powerful as Perl regexes, but they do exist.)
    If the use strict; is missing in the textarea, then a JS confirm() with an appropriate message shall be shown to the user, including the option to submit anyway or to cancel the submission.

    Then it would at least stand a chance to be read.

    Now, with the general (lack of) appreciation for JS at the Monastery, this may not be an option. But there's a (the?) solution.

    The white hole.

    P.S. <OPINION> JavaScript does have it's uses.</OPINION>

      Not all SOPW posts are the kinds of posts that require the use of "use strict;". Some posts don't include <CODE> at all. So I think this would be a bad idea.

      "Seekers of Perl Wisdom" != "What's wrong with this code"

      If I post a regex, for example, that's failing match a given text, my use of strict or not is irrelevant.

      Personally, I would support a c.l.p.m.-style FAQ that is emailed to a New User when they sign up. Something that gives all the necessary info like "How to post a question", "Where to post a question", etc. Of course, this doesn't guarantee that it will be read. But we can't force annoying popup windows on people.

      ___ Simon Flack ($code or die)
      $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
      =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
        I realise I ask many more questions than I do give responses, but on this one I feel the need to give my humble opinion. I support the idea of a FAQ sent at registration time. I feel it would have saved me much time, and quite a bit of embarassment here had things like "use strict" before submitting a question. Thanks for hearing me out. :)