Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deprecation in favour of DBIx::Class::MooseColumns.

  • Loading branch information...
commit 159bf592dadf7f8b8c8af76949348f0e75e50a1d 1 parent 0833f7e
@mendel authored
View
3  Changes
@@ -1,5 +1,8 @@
Revision history for MooseX-DBIC-AddColumn
+0.05 2010-06-16 14:40:00+0200
+ Deprecation in favour of DBIx-Class-MooseColumns.
+
0.04 2010-06-07 13:09:00+0200
Fixed a silly Makefile.PL bug (M:I::Share was missing).
View
21 Makefile.PL
@@ -10,27 +10,12 @@ use Module::Install::ReadmeFromPod 0.06;
use Module::Install::Repository 0.06;
use Module::Install::ExtraTests 0.006;
-name 'MooseX-DBIC-AddColumn';
-all_from 'lib/MooseX/DBIC/AddColumn.pm';
+name 'MooseX-DBIC-AddColumn';
+all_from 'lib/MooseX/DBIC/AddColumn.pm';
readme_from 'lib/MooseX/DBIC/AddColumn.pm' => 'clean';
auto_set_repository;
-requires 'Moose' => '0.92';
-
-test_requires 'Test::Most' => '0.21';
-test_requires 'Test::More' => '0.92';
-test_requires 'Test::Differences' => '0.4801';
-test_requires 'Test::Deep' => '0.103';
-test_requires 'Test::DBIx::Class' => '0.10';
-test_requires 'FindBin' => 0;
-test_requires 'Path::Class' => '0.16';
-
-author_requires 'Test::Pod' => '1.22';
-author_requires 'Test::Pod::Coverage' => '1.08';
-author_requires 'Pod::Coverage' => '0.18';
-author_requires 'Test::Perl::Critic' => '1.01';
-author_requires 'Test::Benchmark' => '0.004';
-author_requires 'String::Random' => '0.22';
+requires 'DBIx::Class::MooseColumns';
extra_tests;
View
41 lib/MooseX/DBIC/AddColumn.pm
@@ -1,40 +1,30 @@
package MooseX::DBIC::AddColumn;
-use Moose ();
-use Moose::Exporter;
-use Moose::Util::MetaRole;
+warn "The MooseX::DBIC::AddColumn module is being deprecated in favour of "
+ . "DBIx::Class::MooseColumns. Please don't use it.";
-use MooseX::DBIC::AddColumn::Meta::Attribute;
+use DBIx::Class::MooseColumns ();
-Moose::Exporter->setup_import_methods( also => 'Moose' );
-
-sub init_meta {
- my ($class, %args) = (shift, @_);
-
- Moose->init_meta(%args);
-
- Moose::Util::MetaRole::apply_metaroles(
- for => $args{for_class},
- class_metaroles => {
- attribute => ['MooseX::DBIC::AddColumn::Meta::Attribute'],
- },
- );
-
- return $args{for_class}->meta;
+sub import
+{
+ my $class = shift;
+ unshift @_, 'DBIx::Class::MooseColumns';
+ goto \&DBIx::Class::MooseColumns::import;
}
-
=head1 NAME
-MooseX::DBIC::AddColumn - Lets you write DBIC add_column() definitions as attribute options
+MooseX::DBIC::AddColumn - Lets you write DBIC add_column() definitions as attribute options (DEPRECATED)
+
+THIS MODULE IS BEING DEPRECATED IN FAVOUR OF L<DBIx::Class::MooseColumns>.
=head1 VERSION
-Version 0.01
+Version 0.05
=cut
-our $VERSION = '0.04';
+our $VERSION = '0.05';
=head1 SYNOPSIS
@@ -83,9 +73,8 @@ our $VERSION = '0.04';
This is ALPHA SOFTWARE. Use at your own risk. Features may change.
-Needless to say I'm not going to steal the namespace from the upcoming
-L<MooseX::DBIC> module - I'm happy to rename this module to anything that fits
-(just it happened that this was the first module name that came to my mind;-).
+This module is being deprecated in favour of L<DBIx::Class::MooseColumns>.
+Please don't use it.
=head1 DESCRIPTION
View
47 lib/MooseX/DBIC/AddColumn/Meta/Attribute.pm
@@ -1,47 +0,0 @@
-package MooseX::DBIC::AddColumn::Meta::Attribute;
-
-use Moose::Role;
-
-=head1 NAME
-
-MooseX::DBIC::AddColumn::Meta::Attribute - Attribute metaclass trait for MooseX::DBIC::AddColumn
-
-=cut
-
-use MooseX::DBIC::AddColumn::Meta::Method::Accessor;
-
-has _moosex_dbic_addcolumn_column_info => (
- isa => 'Maybe[HashRef]',
- is => 'rw',
- predicate => 'has__moosex_dbic_addcolumn_column_info',
-);
-
-around accessor_metaclass => sub {
- return 'MooseX::DBIC::AddColumn::Meta::Method::Accessor';
-};
-
-around new => sub {
- my ($orig, $class, $name, %options) = @_;
-
- my $column_info = delete $options{add_column};
- $column_info->{accessor} = $options{accessor} if $options{accessor};
-
- if ($column_info) {
- my $target_pkg = $options{definition_context}->{package};
-
- $target_pkg->add_column($name => $column_info);
-
- # removing the accessor method that CAG installed (otherwise Moose complains)
- $target_pkg->meta->remove_method($column_info->{accessor} || $name);
- }
-
- my $self = $class->$orig($name, %options);
-
- if ($column_info) {
- $self->_moosex_dbic_addcolumn_column_info($column_info);
- }
-
- return $self;
-};
-
-1;
View
83 lib/MooseX/DBIC/AddColumn/Meta/Method/Accessor.pm
@@ -1,83 +0,0 @@
-package MooseX::DBIC::AddColumn::Meta::Method::Accessor;
-
-use Moose;
-use namespace::autoclean;
-
-=head1 NAME
-
-MooseX::DBIC::AddColumn::Meta::Method::Accessor - Accessor metaclass for MooseX::DBIC::AddColumn
-
-=cut
-
-extends 'Moose::Meta::Method::Accessor';
-
-#FIXME Moose::Meta::Method::Accessor does not use this currently, write _generate_inline_predicate instead
-around _inline_has => sub {
- my ($orig, $self, $instance) = (shift, shift, @_);
-
- my $attr = $self->associated_attribute;
- if ($attr->has__moosex_dbic_addcolumn_column_info) {
- my ($slot_name) = $attr->slots;
-
- return sprintf q[%s->has_column_loaded("%s")], $instance, quotemeta($slot_name);
- }
- else {
- return $self->$orig(@_);
- }
-};
-
-around _inline_get => sub {
- my ($orig, $self, $instance) = (shift, shift, @_);
-
- my $attr = $self->associated_attribute;
- if ($attr->has__moosex_dbic_addcolumn_column_info) {
- my ($slot_name) = $attr->slots;
-
- return sprintf q[%s->get_column("%s")], $instance, quotemeta($slot_name);
- }
- else {
- return $self->$orig(@_);
- }
-};
-
-around _inline_store => sub {
- my ($orig, $self, $instance, $value) = (shift, shift, @_);
-
- my $attr = $self->associated_attribute;
- if ($attr->has__moosex_dbic_addcolumn_column_info) {
- my ($slot_name) = $attr->slots;
-
- return sprintf q[%s->set_column("%s", "%s")], $instance, quotemeta($slot_name), $value;
- }
- else {
- return $self->$orig(@_);
- }
-};
-
-around _inline_access => sub {
- my ($orig, $self, $instance) = (shift, shift, @_);
-
- $self->throw_error(__PACKAGE__ . " cannot implement _inline_access()");
-};
-
-around _inline_get_old_value_for_trigger => sub {
- my ($orig, $self, $instance) = (shift, shift, @_);
-
- my $attr = $self->associated_attribute;
- if ($attr->has__moosex_dbic_addcolumn_column_info) {
- return '' unless $attr->has_trigger;
-
- return
- 'my @old = '
- . $self->_inline_has($instance) . q{ ? }
- . $self->_inline_get($instance) . q{ : ()} . ";\n";
- }
- else {
- return $self->$orig(@_);
- }
-};
-
-#FIXME other methods (predicate, clearer, initializer, ...?)
-#FIXME non-inline methods? (Moose always inlines all of them currently)
-
-1;
Please sign in to comment.
Something went wrong with that request. Please try again.