finding invalid method names

Discussion in 'Perl Misc' started by ivan@0x4849.net, Apr 27, 2007.

  1. Guest

    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?

    Thanks,

    --
    Ivan Novick
    http://www.0x4849.net
     
    , Apr 27, 2007
    #1
    1. Advertising

  2. <> 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();



    There are no method calls anywhere in that code.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 28, 2007
    #2
    1. Advertising

  3. On 4/27/2007 5:41 PM, wrote:
    >
    > 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.


    Method dispatch happens at runtime. There's really no way for a static analysis
    tool to determine whether or not a given method call is valid.

    > 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.


    Umm, as Tad said, there are no method calls in that code. Did you want to ask
    about detecting undefined *subroutines*?

    -mjc
     
    Michael Carman, Apr 28, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paddy McCarthy
    Replies:
    3
    Views:
    733
    Anthony J Bybell
    Sep 24, 2004
  2. Bob
    Replies:
    1
    Views:
    393
    Lucas Tam
    Jul 30, 2004
  3. Replies:
    1
    Views:
    318
  4. John Lenton
    Replies:
    0
    Views:
    381
    John Lenton
    Jan 11, 2005
  5. Greg Hauptmann
    Replies:
    1
    Views:
    114
    Yossef Mendelssohn
    Nov 6, 2008
Loading...

Share This Page