This is an automated email from the git hooks/post-receive script. gregoa pushed a commit to annotated tag release-0.007 in repository libclass-tiny-perl.
commit 202906fe7bcb7a0a4e90feeefee2013a1ee9deaf Author: David Golden <dagol...@cpan.org> Date: Sat Sep 7 16:43:21 2013 -0400 update dist.ini and support files --- META.json | 99 ----------------- README.mkdn | 1 + README.pod | 357 ------------------------------------------------------------ cpanfile | 33 ++++++ dist.ini | 4 +- 5 files changed, 35 insertions(+), 459 deletions(-) diff --git a/META.json b/META.json deleted file mode 100644 index 501d577..0000000 --- a/META.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "abstract" : "Minimalist class construction", - "author" : [ - "David Golden <dagol...@cpan.org>" - ], - "dynamic_config" : 1, - "generated_by" : "Dist::Zilla version 4.300037, CPAN::Meta::Converter version 2.132140", - "license" : [ - "apache_2_0" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Class-Tiny", - "no_index" : { - "directory" : [ - "t", - "xt", - "examples", - "corpus" - ], - "package" : [ - "DB" - ] - }, - "prereqs" : { - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "6.30" - } - }, - "develop" : { - "requires" : { - "Pod::Coverage::TrustPod" : "0", - "Test::CPAN::Meta" : "0", - "Test::Pod" : "1.41", - "Test::Pod::Coverage" : "1.08" - } - }, - "runtime" : { - "requires" : { - "Carp" : "0", - "perl" : "5.008001", - "strict" : "0", - "warnings" : "0" - } - }, - "test" : { - "recommends" : { - "Test::FailWarnings" : "0" - }, - "requires" : { - "Exporter" : "0", - "ExtUtils::MakeMaker" : "0", - "File::Spec::Functions" : "0", - "File::Temp" : "0", - "IO::Handle" : "0", - "IPC::Open3" : "0", - "List::Util" : "0", - "Test::More" : "0.96", - "base" : "0", - "lib" : "0", - "subs" : "0" - } - } - }, - "provides" : { - "Class::Tiny" : { - "file" : "lib/Class/Tiny.pm", - "version" : "0.006" - }, - "Class::Tiny::Object" : { - "file" : "lib/Class/Tiny.pm", - "version" : "0.006" - } - }, - "release_status" : "stable", - "resources" : { - "bugtracker" : { - "web" : "https://github.com/dagolden/class-tiny/issues" - }, - "homepage" : "https://metacpan.org/release/Class-Tiny", - "repository" : { - "type" : "git", - "url" : "git://github.com/dagolden/class-tiny.git", - "web" : "https://github.com/dagolden/class-tiny" - } - }, - "version" : "0.006", - "x_authority" : "cpan:DAGOLDEN", - "x_contributors" : [ - "Karen Etheridge <et...@cpan.org>", - "Matt S Trout <mstr...@cpan.org>", - "Olivier Mengu\u00e9 <dol...@cpan.org>", - "Toby Inkster <toby...@cpan.org>" - ] -} - diff --git a/README.mkdn b/README.mkdn new file mode 120000 index 0000000..73dfc33 --- /dev/null +++ b/README.mkdn @@ -0,0 +1 @@ +CONTRIBUTING \ No newline at end of file diff --git a/README.pod b/README.pod deleted file mode 100644 index ef7ec6a..0000000 --- a/README.pod +++ /dev/null @@ -1,357 +0,0 @@ -=pod - -=encoding utf-8 - -=head1 NAME - -Class::Tiny - Minimalist class construction - -=head1 VERSION - -version 0.006 - -=head1 SYNOPSIS - -In F<Person.pm>: - - package Person; - - use Class::Tiny qw( name ); - - 1; - -In F<Employee.pm>: - - package Employee; - use parent 'Person'; - - use Class::Tiny qw( ssn ), { - timestamp => sub { time } # attribute with default - }; - - 1; - -In F<example.pl>: - - use Employee; - - my $obj = Employee->new( name => "Larry", ssn => "111-22-3333" ); - - # unknown attributes are fatal: - eval { Employee->new( name => "Larry", OS => "Linux" ) }; - die "Error creating Employee: $@" if $@; - -=head1 DESCRIPTION - -This module offers a minimalist class construction kit in around 100 lines of -code. Here is a list of features: - -=over 4 - -=item * - -defines attributes via import arguments - -=item * - -generates read-write accessors - -=item * - -supports lazy attribute defaults - -=item * - -supports custom accessors - -=item * - -superclass provides a standard C<new> constructor - -=item * - -C<new> takes a hash reference or list of key/value pairs - -=item * - -C<new> has heuristics to catch constructor attribute typos - -=item * - -C<new> calls C<BUILD> for each class from parent to child - -=item * - -superclass provides a C<DESTROY> method - -=item * - -C<DESTROY> calls C<DEMOLISH> for each class from child to parent - -=back - -It uses no non-core modules for any recent Perl. On Perls older than v5.10 it -requires L<MRO::Compat>. On Perls older than v5.14, it requires -L<Devel::GlobalDestruction>. - -=for Pod::Coverage new get_all_attributes_for get_all_attribute_defaults_for -prepare_class create_attributes - -=head1 USAGE - -=head2 Defining attributes - -Define attributes as a list of import arguments: - - package Foo::Bar; - - use Class::Tiny qw( - name - id - height - weight - ); - -For each attribute, a read-write accessor is created unless a subroutine of that -name already exists: - - $obj->name; # getter - $obj->name( "John Doe" ); # setter - -Attribute names must be valid subroutine identifiers or an exception will -be thrown. - -You can specify lazy defaults by defining attributes with a hash reference. -Keys define attribute names and values are constants or code references that -will be evaluated when the attribute is first accessed if no value has been -set. The object is passed as an argument to a code reference. - - package Foo::WithDefaults; - - use Class::Tiny qw/name id/, { - title => 'Peon', - skills => sub { [] }, - hire_date => sub { $_[0]->_build_hire_date }, - }; - -To make your own custom accessors, just pre-declare the method name before -loading Class::Tiny: - - package Foo::Bar; - - use subs 'id'; - - use Class::Tiny qw( name id ); - - sub id { ... } - -By declaring C<id> also with Class::Tiny, you include it in the list of known -attributes for introspection. Default values will not be set for custom -accessors unless you handle that yourself. - -=head2 Class::Tiny::Object is your base class - -If your class B<does not> already inherit from some class, then -Class::Tiny::Object will be added to your C<@ISA> to provide C<new> and -C<DESTROY>. - -If your class B<does> inherit from something, then no additional inheritance is -set up. If the parent subclasses Class::Tiny::Object, then all is well. If -not, then you'll get accessors set up but no constructor or destructor. Don't -do that unless you really have a special need for it. - -Define subclasses as normal. It's best to define them with L<base>, L<parent> -or L<superclass> before defining attributes with Class::Tiny so the C<@ISA> -array is already populated at compile-time: - - package Foo::Bar::More; - - use parent 'Foo::Bar'; - - use Class::Tiny qw( shoe_size ); - -=head2 Object construction - -If your class inherits from Class::Tiny::Object (as it should if you followed -the advice above), it provides the C<new> constructor for you. - -Objects can be created with attributes given as a hash reference or as a list -of key/value pairs: - - $obj = Foo::Bar->new( name => "David" ); - - $obj = Foo::Bar->new( { name => "David" } ); - -If a reference is passed as a single argument, it must be able to be -dereferenced as a hash or an exception is thrown. A shallow copy is made of -the reference provided. - -In order to help catch typos in constructor arguments, any argument that it is -not also a valid method (e.g. an accessor or other method) will result in a -fatal exception. This is not perfect, but should catch typical transposition -typos. Also see L</BUILD> for how to explicitly hide non-attribute, non-method -arguments if desired. - -=head2 BUILD - -If your class or any superclass defines a C<BUILD> method, it will be called -by the constructor from the furthest parent class down to the child class after -the object has been created. - -It is passed the constructor arguments as a hash reference. The return value -is ignored. Use C<BUILD> for validation or setting default values. - - sub BUILD { - my ($self, $args) = @_; - $self->foo(42) unless defined $self->foo; - croak "Foo must be non-negative" if $self->foo < 0; - } - -If you want to hide a non-attribute constructor argument from validation, -delete it from the passed-in argument hash reference. - - sub BUILD { - my ($self, $args) = @_; - - if ( delete $args->{do_something_special} ) { - ... - } - } - -The argument reference is a copy, so deleting elements won't affect data in the -object. You have to delete it from both if that's what you want. - - sub BUILD { - my ($self, $args) = @_; - - if ( delete $args->{do_something_special} ) { - delete $self->{do_something_special}; - ... - } - } - -=head2 DEMOLISH - -Class::Tiny provides a C<DESTROY> method. If your class or any superclass -defines a C<DEMOLISH> method, they will be called from the child class to the -furthest parent class during object destruction. It is provided a single -boolean argument indicating whether Perl is in global destruction. Return -values and errors are ignored. - - sub DEMOLISH { - my ($self, $global_destruct) = @_; - $self->cleanup(); - } - -=head2 Introspection and internals - -You can retrieve an unsorted list of valid attributes known to Class::Tiny -for a class and its superclasses with the C<get_all_attributes_for> class -method. - - my @attrs = Class::Tiny->get_all_attributes_for("Employee"); - # returns qw/name ssn timestamp/ - -Likewise, a hash reference of all valid attributes and default values (or code -references) may be retrieved with the C<get_all_attribute_defaults_for> class -method. Any attributes without a default will be C<undef>. - - my $def = Class::Tiny->get_all_attribute_defaults_for("Employee"); - # returns { - # name => undef, - # ssn => undef - # timestamp => $coderef - # } - -The C<import> method uses two class methods, C<prepare_class> and -C<create_attributes> to set up the C<@ISA> array and attributes. Anyone -attempting to extend Class::Tiny itself should use these instead of mocking up -a call to C<import>. - -=head1 RATIONALE - -=head2 Why this instead of Object::Tiny or Class::Accessor or something else? - -I wanted something so simple that it could potentially be used by core Perl -modules I help maintain (or hope to write), most of which either use -L<Class::Struct> or roll-their-own OO framework each time. - -L<Object::Tiny> and L<Object::Tiny::RW> were close to what I wanted, but -lacking some features I deemed necessary, and their maintainers have an even -more strict philosophy against feature creep than I have. - -I looked for something like it on CPAN, but after checking a dozen class -creators I realized I could implement it exactly how I wanted faster than I -could search CPAN for something merely sufficient. Compared to everything -else, this is smaller in implementation and simpler in API. - -=head2 Why this instead of Moose or Moo? - -L<Moose> and L<Moo> are both excellent OO frameworks. Moose offers a powerful -meta-object protocol (MOP), but is slow to start up and has about 30 non-core -dependencies including XS modules. Moo is faster to start up and has about 10 -pure Perl dependencies but provides no true MOP, relying instead on its ability -to transparently upgrade Moo to Moose when Moose's full feature set is -required. - -By contrast, Class::Tiny has no MOP and has B<zero> non-core dependencies for -Perls in the L<support window|perlpolicy>. It has far less code, less -complexity and no learning curve. If you don't need or can't afford what Moo or -Moose offer, this is a intended to be a reasonable fallback. - -That said, Class::Tiny offers Moose-like conventions for things like C<BUILD> -and C<DEMOLISH> for some minimal interoperability and an easier upgrade path. - -=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan - -=head1 SUPPORT - -=head2 Bugs / Feature Requests - -Please report any bugs or feature requests through the issue tracker -at L<https://github.com/dagolden/class-tiny/issues>. -You will be notified automatically of any progress on your issue. - -=head2 Source Code - -This is open source software. The code repository is available for -public review and contribution under the terms of the license. - -L<https://github.com/dagolden/class-tiny> - - git clone git://github.com/dagolden/class-tiny.git - -=head1 AUTHOR - -David Golden <dagol...@cpan.org> - -=head1 CONTRIBUTORS - -=over 4 - -=item * - -Karen Etheridge <et...@cpan.org> - -=item * - -Matt S Trout <mstr...@cpan.org> - -=item * - -Olivier Mengu� <dol...@cpan.org> - -=item * - -Toby Inkster <toby...@cpan.org> - -=back - -=head1 COPYRIGHT AND LICENSE - -This software is Copyright (c) 2013 by David Golden. - -This is free software, licensed under: - - The Apache License, Version 2.0, January 2004 - diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..6ec9381 --- /dev/null +++ b/cpanfile @@ -0,0 +1,33 @@ +requires "Carp" => "0"; +requires "perl" => "5.008001"; +requires "strict" => "0"; +requires "warnings" => "0"; + +on 'test' => sub { + requires "Exporter" => "0"; + requires "ExtUtils::MakeMaker" => "0"; + requires "File::Spec::Functions" => "0"; + requires "File::Temp" => "0"; + requires "IO::Handle" => "0"; + requires "IPC::Open3" => "0"; + requires "List::Util" => "0"; + requires "Test::More" => "0.96"; + requires "base" => "0"; + requires "lib" => "0"; + requires "subs" => "0"; +}; + +on 'test' => sub { + recommends "Test::FailWarnings" => "0"; +}; + +on 'configure' => sub { + requires "ExtUtils::MakeMaker" => "6.30"; +}; + +on 'develop' => sub { + requires "Pod::Coverage::TrustPod" => "0"; + requires "Test::CPAN::Meta" => "0"; + requires "Test::Pod" => "1.41"; + requires "Test::Pod::Coverage" => "1.08"; +}; diff --git a/dist.ini b/dist.ini index 87fad5b..74ab3cc 100644 --- a/dist.ini +++ b/dist.ini @@ -5,9 +5,7 @@ copyright_holder = David Golden copyright_year = 2013 [@DAGOLDEN] -:version = 0.048 -AutoMetaResources.bugtracker.rt = 0 -AutoMetaResources.bugtracker.github = user:dagolden +:version = 0.050 stopwords = destructor stopwords = fatpacking stopwords = interoperability -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libclass-tiny-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits