Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
In the latest (0.22) release of Padre we started to support the localization of diagnostic messages from perl.

Normally if you receive an error or warning from perl you can either put use diagnostics; in your code to get a more detailed explanation or you can save the error message in a file perl my_script.pl > err.txt and then run splain err.txt to get the relevant explanation from perldiag

With the latest release of Padre you can get translated version of this diagnostics message when you run your code from Padre. Actually it is a bit virtual claim as so far we only found a French translation of the perldiag.pod file in POD2::FR.

So I would like to encourage others to start translating the perldiag messages and uploading POD2::Your_Language to CPAN but that's quite a lot of work so I'd like to help people focus on the most common errors and warnings one might receive. Translating those would go a long way in helping people who are new to Perl and are not well prepared in English either.

So I'd like to collect a set of example scripts along with the error messages or warnings they generate. Let me show what I have so far:

hello with warn

#!/usr/bin/perl use strict; use warnings; my $name; print "Hello $name\n"; my $x = "2x"; print 3+$x; print "done\n";
Gives two:
Use of uninitialized value $name in concatenation (.) or string at t/f +iles/hello_with_warn.pl line 7 Argument "2x" isn't numeric in addition (+) at t/files/hello_with_warn +.pl line 9.

no strict

#!/usr/bin/perl use warnings; $what = 42;
gives
Name "main::what" used only once: possible typo at t/files/no_strict.p +l line 4.

Missing semicolon

#!/usr/bin/perl use strict; use warnings; my $x if ($x) { print "ok"; }
gives
Global symbol "$x" requires explicit package name at t/files/missing_s +emicolon.pl line 7. syntax error at t/files/missing_semicolon.pl line 7, near ") {" Execution of t/files/missing_semicolon.pl aborted due to compilation e +rrors.

What else?

This is the list I came up with. I'd like to get your other examples for what you think are the most common error messages and warnings.

Once you are done with that, I'd like to ask you to go and translate the relevant entries in perldiag and upload the first version of POD2::Your_Language to CPAN. While this is not Padre specific, if you need an SVN server for cooperating with others, we'd be glad to provide space for this on the SVN server of Padre.


In reply to The most common errors and warnings in Perl by szabgab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (4)
    As of 2014-10-26 05:08 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (151 votes), past polls