CLASS(3pm)

CLASS3pm

Alias for __package__

Usage

  package Foo;
  use CLASS;
  print CLASS;                  # Foo
  print "My class is $CLASS\n"; # My class is Foo
  sub bar { 23 }
  print CLASS->bar;     # 23
  print $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.

  1. 6.0–7
  2. 8–9
  3. 10–11
  4. 12
  5. 13

Author

From February 2022 onward: Jacques Deguest <[email protected]>

Michael G Schwern <[email protected]>

License

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <http://www.perl.com/perl/misc/Artistic.html>

From libclass-perl 1.1.8-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.