From: Peter Rabbitson Date: Fri, 17 Jan 2014 01:39:16 +0000 (+0100) Subject: We already dep on Moo - CAG is unnecessary X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FSQL-Abstract.git;a=commitdiff_plain;h=c3e7c660784f8ff8d3007efdb17fb32afe019a46 We already dep on Moo - CAG is unnecessary --- diff --git a/Makefile.PL b/Makefile.PL index c10d78d..3b1ad3b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -17,7 +17,6 @@ dynamic_config 0; requires 'List::Util' => 0; requires 'Scalar::Util' => 0; -requires 'Class::Accessor::Grouped' => 0.10005; requires 'Getopt::Long::Descriptive' => 0.091; requires 'Hash::Merge' => 0.12; requires 'Moo' => '0.009014'; diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index c6faef9..c14ec11 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -1,18 +1,23 @@ package SQL::Abstract::Tree; -use strict; -use warnings; -no warnings 'qw'; use Carp; +use Hash::Merge (); + +use Sub::Quote 'quote_sub'; +use Moo; +no warnings 'qw'; -use Hash::Merge qw//; +has [qw( + newline indent_string indent_amount fill_in_placeholders +)] => ( is => 'rw' ); -use base 'Class::Accessor::Grouped'; +has [qw( + colormap indentmap +)] => ( is => 'rw', default => quote_sub('{}') ); -__PACKAGE__->mk_group_accessors( simple => qw( - newline indent_string indent_amount colormap indentmap fill_in_placeholders - placeholder_surround -)); +has [qw( + placeholder_surround +)] => ( is => 'rw', default => quote_sub('[]') ); my $merger = Hash::Merge->new; @@ -308,17 +313,14 @@ my %profiles = ( }, ); -sub new { - my $class = shift; - my $args = shift || {}; - - my $profile = delete $args->{profile} || 'none'; - - die "No such profile '$profile'!" unless exists $profiles{$profile}; +sub BUILDARGS { + my $class = shift; + my $args = { (ref $_[0] eq 'HASH') ? %{$_[0]} : @_ }; + my $profile = delete $args->{profile} || 'none'; - my $data = $merger->merge( $profiles{$profile}, $args ); + die "No such profile '$profile'!" unless exists $profiles{$profile}; - bless $data, $class + return $merger->merge( $profiles{$profile}, $args ); } sub parse {