perldoc > Class::Virtually::Abstract

📖 NAME

Class::Virtually::Abstract - Compile-time enforcement of Class::Virtual

🚀 Quick Reference

Use Case Code/Usage Description
Declare virtual methods __PACKAGE__->virtual_methods(qw(new foo bar this that)); Define which methods subclasses must implement
Create a virtual base class use base qw(Class::Virtually::Abstract); Inherit from Class::Virtually::Abstract
Implement virtual methods sub foo { ... } Subclass must implement all declared virtual methods
Compile-time enforcement use My::Private::Idaho; Fails to compile if any virtual method is missing

📋 SYNOPSIS

      package My::Virtual::Idaho;
      use base qw(Class::Virtually::Abstract);

      __PACKAGE__->virtual_methods(qw(new foo bar this that));


      package My::Private::Idaho;
      use base qw(My::Virtual::Idaho);

      sub new { ... }
      sub foo { ... }
      sub bar { ... }
      sub this { ... }
      # oops, forgot to implement that()!!  Whatever will happen?!


      # Meanwhile, in another piece of code!
      # KA-BLAM!  My::Private::Idaho fails to compile because it didn't
      # fully implement My::Virtual::Idaho.
      use My::Private::Idaho;

📖 DESCRIPTION

This subclass of Class::Virtual provides compile-time enforcement. That means subclasses of your virtual class are required to implement all virtual methods or else it will not compile.

🐛 BUGS and CAVEATS

👤 AUTHOR

Original idea and code from Ben Tilly's AbstractClass
http://www.perlmonks.org/index.pl?node_id=44300&lastnode_id=45341

Embraced and Extended by Michael G Schwern <schwern AT pobox.com>

📚 SEE ALSO

Class::Virtual

Class::Virtually::Abstract
📖 NAME 🚀 Quick Reference 📋 SYNOPSIS 📖 DESCRIPTION 🐛 BUGS and CAVEATS 👤 AUTHOR 📚 SEE ALSO

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 15:26 @216.73.216.194
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format