Re: finding invalid method names



On Apr 27, 3:41 pm, i...@xxxxxxxxxx wrote:
Hi,

I would like to run a command on my perl scripts / modules to find out if
there are any method names that are being called which are not defined.

So for example where I run:

perl -c test.pl

on this script:
1 #!/usr/bin/perl
2 use strict;
3
4 blah_blah_foo();

The result is test.pl syntax OK.

Is there any other program i can run to do a static analysis of perl code
and find these errors?


Function names? I'd use Perl::Critic with
Perl::Critic::StricterSubs. E.g.,

$ perlcritic -theme "strictersubs" demo.pl
Subroutine "blah_blah_foo" is neither declared nor explicitly imported
at line 4, column 1. This might be a major bug. (Severity: 4)

A caveat from the documentation mentions false violations.

In any case, if you use Perl::Critic (static checks) as well as
TAP-based tests (e.g., Devel::Cover, Test::More, Test::Pod::Coverage,
etc.), you (or your boss) should start to feel better about
code quality.

--
Hope this helps,
Steven




.



Relevant Pages

  • Re: Problem passing arguments in WindowsXP
    ... The problem is that perl scripts don't receive argurments if I type ... I read another message suggesting using ftype to see how perl is run ... it displays the current open command string for that file type. ...
    (comp.lang.perl.misc)
  • Re: dbmopen compatibility from perl 5.6 to 5.8
    ... solution but your original post sounded very ungrateful towards the Perl ... > password database files implemented as persistent hashes in perl ... > every line of code that used dbmopen in pre-existing perl scripts, ... open model and refactor the legacy code into an updated open cross ...
    (perl.beginners)
  • No Starch Press releases "Wicked Cool Perl Scripts"
    ... Popular Wicked Cool Book Series Tackles Perl Scripts: ... New book takes Perl programming to the extreme ... Useful Perl Scripts That Solve Difficult Problems" (No Starch Press, ...
    (comp.os.linux.announce)
  • Re: perl extension for PHP - stuck?
    ... So I want to use my old perl scripts, ... functionality of php. ... One night, being, as I suppose, inspired by love, isidro made a dart at the ...
    (comp.lang.php)
  • Re: Best Way to accomplish a Task
    ... You do need to download Perl for Windows, ... if the Linux Perl scripts make systemcalls to other ...
    (comp.lang.perl.misc)