X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FParser%2FDBIx%2FClass.pm;h=755ac4a6a2cc7ec60957e0c3959d7131911035ef;hb=48775dd11096e6a57bde9532f47412c90d87975c;hp=af8e1171bfe86343823ded726d19a8b51fe4e7a6;hpb=5b9ecfccf4d159b155c80fff6f12b701651f9f09;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index af8e117..755ac4a 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -8,13 +8,14 @@ package SQL::Translator::Parser::DBIx::Class; use strict; use warnings; -use vars qw($DEBUG $VERSION @EXPORT_OK); +our ($DEBUG, $VERSION, @EXPORT_OK); $VERSION = '1.10'; $DEBUG = 0 unless defined $DEBUG; use Exporter; use SQL::Translator::Utils qw(debug normalize_name); -use Carp::Clan qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/; +use DBIx::Class::Carp qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/; +use DBIx::Class::Exception; use Scalar::Util qw/weaken blessed/; use Try::Tiny; use namespace::clean; @@ -33,20 +34,21 @@ use base qw(Exporter); # We're working with DBIx::Class Schemas, not data streams. # ------------------------------------------------------------------- sub parse { - # this is a hack to prevent schema leaks due to a retarded SQLT implementation - # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway) - weaken $_[1] if ref ($_[1]); - my ($tr, $data) = @_; my $args = $tr->parser_args; my $dbicschema = $args->{'DBIx::Class::Schema'} || $args->{"DBIx::Schema"} ||$data; $dbicschema ||= $args->{'package'}; my $limit_sources = $args->{'sources'}; - croak 'No DBIx::Class::Schema' unless ($dbicschema); + # this is a hack to prevent schema leaks due to a retarded SQLT implementation + # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway) + ref $_ and weaken $_ + for $_[1], $dbicschema, @{$args}{qw/DBIx::Schema DBIx::Class::Schema package/}; + + DBIx::Class::Exception->throw('No DBIx::Class::Schema') unless ($dbicschema); if (!ref $dbicschema) { eval "require $dbicschema" - or croak "Can't load $dbicschema: $@"; + or DBIx::Class::Exception->throw("Can't load $dbicschema: $@"); } my $schema = $tr->schema;