Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Detect undefined subroutines

by Anonymous Monk
on Sep 17, 2004 at 16:55 UTC ( [id://391841]=note: print w/replies, xml ) Need Help??


in reply to Detect undefined subroutines

Many people have asked this this question and many have gotten the same useless answers. It is true that subs can be defined on the fly and that can be made hard to check things at compile time. HOWEVER, variables can also be made on the fly, so it seems like a stupid argument, because 'use strict' can enforce that variables be declared somewhere.
The place where there is really a problem is with method calls, because you can not always know what type of object something is at compile time. For example:
sub foo { my $thing = shift; $thing->bar(); }
Here "$thing" could be any type of object, so it is impossible for the compiler to know what package to check for the existance of the method.

Replies are listed 'Best First'.
Re^2: Detect undefined subroutines
by dragonchild (Archbishop) on Sep 17, 2004 at 18:40 UTC
    HOWEVER, variables can also be made on the fly, so it seems like a stupid argument, because 'use strict' can enforce that variables be declared somewhere.

    Strictures enforces this because it is much less likely you will want to use a variable that has been defined on the fly than a subroutine that has. In fact, defining subroutines on the fly is the basis of several styles of programming. I haven't heard of a style that depends on defining variables on the fly. And, frankly, if you did, you'd use a hash. :-)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://391841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found