From: Peter Rabbitson Date: Wed, 18 Jan 2012 08:39:51 +0000 (+0100) Subject: Deprecate SQL::Translator::Schema::Graph, undocument as_graph() X-Git-Tag: v0.11011~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1abbbee1a26bb9e1b35b662a79723a0128860fea;p=dbsrgits%2FSQL-Translator.git Deprecate SQL::Translator::Schema::Graph, undocument as_graph() According to 10f369208 Producer::Turnkey was retired back in 2004. It seems that the ::Graph::* family exists solely for Turnkey infrastructure support and as such can be deprecated. This frees us from a very old dependency Class::MakeMethods (an early MOP attempt, not updated since 2003). Fwiw Turnkey itself appears to be also dead: http://sourceforge.net/mailarchive/forum.php?forum_name=turnkey-users --- diff --git a/Changes b/Changes index e869539..c26fd16 100644 --- a/Changes +++ b/Changes @@ -32,6 +32,7 @@ * Fix ignored option to script/sqlt-diagram (RT#5992) * Fix t/17sqlfxml-producer.t failures due to whitespace differences introduced by environment config snippets (RT#70786) +* Deprecate SQL::Translator::Schema::Graph and the as_graph() schema method # ---------------------------------------------------------- # 0.11010 2011-10-05 diff --git a/Makefile.PL b/Makefile.PL index 90a3d41..9aeb10f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,7 +9,6 @@ my $deps = { requires => { 'Class::Base' => 0, 'Class::Data::Inheritable' => 0.02, - 'Class::MakeMethods' => 0, 'Digest::SHA' => 0, 'Carp::Clan' => 0, 'IO::Dir' => 0, diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index 032ff16..2c725ba 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -35,6 +35,7 @@ use SQL::Translator::Schema::Trigger; use SQL::Translator::Schema::View; use SQL::Translator::Utils 'parse_list_arg'; +use Carp; use base 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; @@ -56,15 +57,14 @@ sub new { return $self; } +# FIXME - to be removed, together with the SQL::Translator::Schema::Graph* stuff +# looks like a remnant of the Turnkey project integration back in 2003-4 +# Appears to be quite dead sub as_graph { -=pod - -=head2 as_graph + eval { require Class::MakeMethods } + or croak 'You need to install the CPAN dependency Class::MakeMethods to use as_graph()'; -Returns the schema as an L object. - -=cut require SQL::Translator::Schema::Graph; my $self = shift; diff --git a/lib/SQL/Translator/Schema/Graph.pm b/lib/SQL/Translator/Schema/Graph.pm index 2b8107f..b9ac14d 100644 --- a/lib/SQL/Translator/Schema/Graph.pm +++ b/lib/SQL/Translator/Schema/Graph.pm @@ -1,8 +1,16 @@ package SQL::Translator::Schema::Graph; - use strict; use warnings; +use Carp; +carp( + 'SQL::Translator::Schema::Graph appears to be dead unmaintained and untested ' +. 'code. It will remain a part of the SQL::Translator distribution for some ' +. 'time, but eventually will be cleaned away. Please file a bug or contact the ' +. 'maintainers and let them know you are still using this functionality' +); + + use base 'Class::Base'; use Data::Dumper; diff --git a/lib/SQL/Translator/Schema/Object.pm b/lib/SQL/Translator/Schema/Object.pm index f38ee41..a5439ff 100644 --- a/lib/SQL/Translator/Schema/Object.pm +++ b/lib/SQL/Translator/Schema/Object.pm @@ -17,14 +17,12 @@ extra functionality. use strict; use warnings; -use Class::Base; use base 'Class::Data::Inheritable'; use base 'Class::Base'; -use Class::MakeMethods::Utility::Ref qw( ref_compare ); +use Data::Dumper (); our $VERSION = '1.59'; - =head1 Construction Derived classes should declare their attributes using the C<_attributes> @@ -179,10 +177,13 @@ Determines if this object is the same as another. } sub _compare_objects { - my $self = shift; - my $obj1 = shift; - my $obj2 = shift; - my $result = (ref_compare($obj1, $obj2) == 0); +# my ($self, $obj1, $obj2) = @_; + + my $result = ( + Data::Dumper->new([$_[1]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump + eq + Data::Dumper->new([$_[2]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump + ); # if ( !$result ) { # use Carp qw(cluck); # cluck("How did I get here?"); diff --git a/t/37-translator-graph.t b/t/37-translator-graph.t index 46a2c05..acc8684 100644 --- a/t/37-translator-graph.t +++ b/t/37-translator-graph.t @@ -17,6 +17,10 @@ BEGIN { parser => "PostgreSQL", ); + local $SIG{__WARN__} = sub { + warn @_ unless $_[0] =~ /SQL::Translator::Schema::Graph appears to be dead unmaintained and untested code/ + }; + ok( $tr->translate('t/data/pgsql/turnkey.sql'), 'Translate PG' ); ok( my $schema = $tr->schema, 'Got Schema' ); ok( my $graph = $schema->as_graph, 'Graph made');