Revision history for Class-Dot

1.5.0 Sat Nov 03 22:05:33 GMT+2 2007 [asksh@cpan.org]

2.0_04 Wed Oct 31 16:20:10 GMT+2 2007 [asksh@cpan.org]

        package Person;
        use Class::Dot qw(-new -chained :std);

        property name  => isa_String;
        property email => isa_String;
        property age   => isa_Int;

        package main;

        my $person = Person->new()
            ->set_name('Ask')
            ->set_email('asksh@cpan.org')
            ->set_age(25);

2.0_03 Tue Oct 30 01:19:37 GMT+2 2007 [asksh@cpan.org]

2.0_02 Mon Oct 29 18:08:12 GMT+2 2007 [asksh@cpan.org]

2.0_01 Sun Oct 28 17:16:32 GMT+2 2007 [asksh@cpan.org]

        Set a object attribute. This is great for those times when you want to
        do this:
    
            my %some_default_values = (
                'foo' => 'bar',
                'bar' => 'baz',
                'xuzzy' => 'fuzzy',
            );
    
            while (my ($attr_name, $attr_value) = each %some_default_values) {
            my $set_attribute = 'set_' . $attr_name;
            if ($object->can($set_attribute)) {
                $object->$set_attribute( $attr_value );
                }
            }

This isn't very pretty, so that's why you now can do this:

            while (my ($attr_name, $attr_value) = each %some_default_values) {
                $object->__setattr__($attr_name, $attr_value);
            }

        - $val = __getattr__($self, $attribute_name)

        Get an attributes value.

        - $bool = __hasattr__($self, $attribute_name)

        Returns true if $self has the attribute $attribute_name.

$object->{attribute} = $value;

because now the attributes are better hidden in the object's hash. You can probably find out how they are saved by doing keys %{ $object }, but we recommend against accessing that hash directly!.

property name => isa_String('foo');

        sub name {
            my ($self) = @;
            warn 'Accessing name property';
            return $self->_getattr__('name');
        }

        sub set_name {
            my ($self, $new_name) = @;
            warn $self->_getattr__('name') . " is changing name to $new_name";
            $self->__setattr__('name', $new_name);
            return;
        }

instead of using after_property_get() and after_property_set().

(Note: Just be sure not to use property() in a BEGIN block, you have to use after_property_* to do that!)

1.0.5 Mon Oct 01 17:13:03 GMT+2 2007 [asksh@cpan.org]

1.0.4 Thu Sep 20 16:30:11 GMT+2 2007 [asksh@cpan.org]

1.0.3 Thu Sep 12 16:55:48 GMT+2 2007 [asksh@cpan.org]

1.0.2 Tue Sep 12 10:13:04 GMT+2 2007 [asksh@cpan.org]

1.0.1 Tue Sep 11 24:36:32 GMT+2 2007 [asksh@cpan.org]

0.0.1 Sun Sep 9 02:22:58 GMT+2 2007 [asksh@cpan.org]

Initial release.