1Clownfish::Class(3)   User Contributed Perl Documentation  Clownfish::Class(3)
2
3
4

NAME

6       Clownfish::Class - Class.
7

SYNOPSIS

9           my $class = Clownfish::Class->fetch_class('Foo::Bar');
10           my $subclass = Clownfish::Class->singleton('Foo::Bar::Jr', $class);
11

DESCRIPTION

13       Classes are first-class objects in Clownfish.  Class objects are
14       instances of Clownfish::Class.
15

CONSTRUCTORS

17   fetch_class
18           my $class = Clownfish::Class->fetch_class($class_name);
19
20       Find a registered class.  May return undef if the class is not
21       registered.
22
23   singleton
24           my $class = Clownfish::Class->singleton(
25               class_name => $class_name,  # required
26               parent     => $parent,      # required
27           );
28
29       Return a singleton.  If a Class can be found in the registry based on
30       the supplied class name, it will be returned.  Otherwise, a new Class
31       will be created using "parent" as a base.
32
33       If "parent" is undef, an attempt will be made to find it.  If the
34       attempt fails, an error will result.
35

METHODS

37   make_obj
38           my $obj = $class->make_obj();
39
40       Create an empty object of the type defined by the Class: allocate,
41       assign its class and give it an initial refcount of 1.  The caller is
42       responsible for initialization.
43
44   get_name
45           my $string = $class->get_name();
46
47       Return the name of the class.
48
49   get_parent
50           my $result = $class->get_parent();
51
52       Return the parent class, or undef for a root of the class hierarchy.
53
54   get_obj_alloc_size
55           my $int = $class->get_obj_alloc_size();
56
57       Return the number of bytes needed to hold an instance of the class.
58

INHERITANCE

60       Clownfish::Class isa Clownfish::Obj.
61
62
63
64perl v5.28.1                      2019-02-02               Clownfish::Class(3)
Impressum