1Class::Virtually::AbstrUascetr(3C)ontributed Perl DocumeCnltaastsi:o:nVirtually::Abstract(3)
2
3
4

NAME

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

SYNOPSIS

9         package My::Virtual::Idaho;
10         use base qw(Class::Virtually::Abstract);
11
12         __PACKAGE__->virtual_methods(qw(new foo bar this that));
13
14
15         package My::Private::Idaho;
16         use base qw(My::Virtual::Idaho);
17
18         sub new { ... }
19         sub foo { ... }
20         sub bar { ... }
21         sub this { ... }
22         # oops, forgot to implement that()!!  Whatever will happen?!
23
24
25         # Meanwhile, in another piece of code!
26         # KA-BLAM!  My::Private::Idaho fails to compile because it didn't
27         # fully implement My::Virtual::Idaho.
28         use My::Private::Idaho;
29

DESCRIPTION

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

BUGS and CAVEATS

36       Because this relies on import() it is important that your classes are
37       used instead of required.  This is a problem, and I'm trying to figure
38       a way around it.
39
40       Also, if a subclass defines its own import() routine (I've done it)
41       Class::Virtually::Abstract's compile-time checking is defeated.
42
43       Got to think of a better way to do this besides import().
44

AUTHOR

46       Original idea and code from Ben Tilly's AbstractClass
47       http://www.perlmonks.org/index.pl?node_id=44300&lastnode_id=45341
48
49       Embraced and Extended by Michael G Schwern <schwern@pobox.com>
50

SEE ALSO

52       Class::Virtual
53
54
55
56perl v5.32.0                      2020-07-28     Class::Virtually::Abstract(3)
Impressum