Class-Mite

 view release on metacpan or  search on metacpan

lib/Class/More.pm  view on Meta::CPAN

    sub fetch {
        my $self = shift;
        return $self->name . " fetches the ball!";
    }

=head2 Class with Complex Attributes

    package Configuration;
    use Class::More;

    has 'settings' => ( default => sub { {} } );
    has 'counters' => ( default => sub { { success => 0, failure => 0 } } );
    has 'log_file' => ( required => 1 );

    sub BUILD {
        my ($self, $args) = @_;

        # Initialize complex data structures
        $self->{internal_cache} = {};
        $self->{start_time} = time;
    }

    sub increment {
        my ($self, $counter) = @_;
        $self->counters->{$counter}++;
    }

=head1 INTEGRATION WITH Role

When L<Role> is available, Class::More automatically exports:

=head3 with

    package My::Class;
    use Class::More;

    with 'Role::Printable', 'Role::Serialisable';

Composes roles into your class. See L<Role> for complete documentation.

=head3 does

    if ($obj->does('Role::Printable')) {
        $obj->print;
    }

Checks if an object consumes a specific role.

=head1 LIMITATIONS

=head2 Attribute System Limitations

=over 4

=item * B<No Type Constraints>: Attributes don't support type checking

=item * B<No Access Control>: All attributes are readable and writable

=item * B<No Coercion>: No automatic value transformation

=item * B<No Triggers>: No callbacks when attributes change

=item * B<No Lazy Building>: Defaults are applied immediately at construction

=item * B<No Private/Protected>: All attributes are publicly accessible via accessors

=back

=head2 Inheritance Limitations

=over 4

=item * B<No Interface Enforcement>: No compile-time method requirement checking

=item * B<Limited Meta-Object Protocol>: Basic metadata only

=item * B<No Traits>: No trait-based composition

=item * B<Diamond Problem>: Multiple inheritance may have ambiguous method resolution

=back

=head2 General Limitations

=over 4

=item * B<No Immutability>: Can't make classes immutable for performance

=item * B<No Serialisation>: No built-in serialisation/deserialisation

=item * B<No Database Integration>: No ORM-like features

=item * B<No Exception Hierarchy>: No custom exception classes

=back

=head2 Compatibility Notes

=over 4

=item * Designed for simplicity and speed over feature completeness

=item * Uses standard Perl OO internals (blessed hashrefs)

=item * Compatible with most CPAN modules that expect blessed hashrefs

=item * Not compatible with Moose/Mouse object systems

=item * Role integration requires separate L<Role> module

=back

=head1 DIAGNOSTICS

=head2 Common Errors

=over 4

=item * C<"Required attribute 'attribute_name' not provided for class Class::Name">

A required attribute was not passed to the constructor.



( run in 1.535 second using v1.01-cache-2.11-cpan-140bd7fdf52 )