|
What you are describing is functions; not methods. Both are implemented as subroutines. Functions are invoked with just their name:
do_function($some_arg);
Methods are invoked via an object:
$obj->my_method($arg);
Methods are inherited, so you don't have to do anything extra to access a parent class's methods from a child class's objects.
To access functions outside of a class, you must either use a fully-qualified function name:
Parent::Class::some_function($an_arg);
Or you can use the Exporter module to export a function name into another class's namespace. Do 'perldoc Exporter' for how to do this.
Finally, ':Restricted' and ':Private' only work on method; not functions.
|