logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

CLASS - Alias for __PACKAGE__

Author

       From February 2022 onward: Jacques Deguest <jack@deguest.jp>

       Michael G Schwern <schwern@pobox.com>

Description

       CLASS and $CLASS are both synonyms for __PACKAGE__.  Easier to type.

       $CLASS has the additional benefit of working in strings.

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>

Name

       CLASS - Alias for __PACKAGE__

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)

See Also

perlmod(1)

perl v5.36.0                                       2023-10-01                                         CLASS(3pm)

Synopsis

         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

See Also