CLASS3pm
Alias for __package__
Usage
package Foo;use CLASS;print CLASS; # Fooprint "My class is $CLASS\n"; # My class is Foosub bar { 23 }print CLASS->bar; # 23print $CLASS->bar; # 23
Overview
CLASS and $CLASS are both synonyms for __PACKAGE__. Easier to type.
$CLASS has the additional benefit of working in strings.
Notes
CLASS is a constant, not a subroutine call. $CLASS is a plain variable, it is not tied. There is no performance loss for using CLASS over __PACKAGE__ except the loading of the module. (Thanks Juerd)
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 4 times.