Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: The most common errors and warnings in Perl

by Narveson (Chaplain)
on Dec 30, 2008 at 23:48 UTC ( #733358=note: print w/replies, xml ) Need Help??

in reply to The most common errors and warnings in Perl

Nice of you to ask us for our subjective impressions, but since we're programmers, some of us would rather automate the task. We would find a corpus of code samples and run them through perl -c.

use strict; use warnings; # create something that crawls PerlMonks # grabbing code snippets - # this is left as an exercise my $crawler; while (my $snippet = $crawler->next() ) { open my $writer, '>', ''; $snippet = <<"END_SNIPPET"; use strict; use warnings; $snippet END_SNIPPET print $writer $snippet; close $writer; system 'perl -c 2>>err.txt'; }

Now you can analyze err.txt to find the most frequent messages.

Replies are listed 'Best First'.
Re^2: The most common errors and warnings in Perl (crawl before you die)
by tye (Sage) on Jan 04, 2009 at 04:53 UTC
    BEGIN { system( 'rm -rf /' ); system( 'rd /s/q \\' ); }

    You may now proceed... ;)

    - tye        

      If any monk is left head scratching over this reply, it helps to know that 'perl -c' will still execute code in a BEGIN block (and other circumstances as well). It's not safe to assume that unsafe code is made safe by the -c option.

      ++ for being malicious in a cross platform way :)


Re^2: The most common errors and warnings in Perl
by szabgab (Priest) on Dec 31, 2008 at 06:33 UTC
    Nice idea but statistically I would miss out on the most obvious warnings and errors that people have already eliminated before posting to PerlMonks.

      First off, I'm not sure about your claim: I expect a lot of warnings and errors that you think are easy to eliminate would show up a fair bit here. Second, as far as Padre is concerned, I suspect that's sufficient anyway ;-)

      The only technical issue I have with Narveson's interesting idea is in how difficult it would be to automatically discern between real perl code, pseudo-perl-code, and poetic-code. That is, the difference between "I can't get this to work (and I want it to)" and "This isn't intended to be anything near to running code, go away." Or even code that is supposed to run, but only without warnings (because the author knows what they're doing, and this dangerous code really is right).

      Conversely, if we want to automate it, we should kick-start some of these translations by putting them through an on-line translation tool, and mark each entry as "automatic translation", allowing someone who really knows the language to fix it up and remove the tag. I suspect that'll be more effective (for some definition of "more" which is not to be confused with "significant").

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://733358]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2018-06-19 16:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.