NAME
warnings::method - Produces warnings if methods are called as functions
VERSION
This document describes method version 0.02
SYNOPSIS
use warnings::method; # or use warnings::method 'FATAL';
package Foo;
sub bar :method{
# ...
}
Foo::bar(); # WARN: 'Method Foo::bar() called as a function'
Foo->bar(); # OK
DESCRIPTION
This pragmatic module produces warnings if methods are called as
functions. Here, *methods* are subroutines declared with the :method
attribute.
This module scans compiled opcode tree, checks subroutine calls and
warns when dangerous function calls are detected. All the processes
finish in compile time, so this module has no effect on run-time
performance.
INTERFACE
"use/no warnings::method;"
Enable/Disable the "method" warnings. These are equivalent to "use/no
warnings 'method'" if "warnings::method" is already loaded.
DEPENDENCIES
Perl 5.8.1 or later, and a C compiler.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
"bug-warnings-method@rt.cpan.org/", or through the web interface at
.
SEE ALSO
The following has the same concept to forbid people to call methods as
functions.
UNIVERSAL::isa - Attempt to recover from people calling UNIVERSAL::isa
as a function
UNIVERSAL::can - Hack around people calling UNIVERSAL::can() as a
function
AUTHOR
Goro Fuji
LICENSE AND COPYRIGHT
Copyright (c) 2008, Goro Fuji . Some rights reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.