X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLMaker%2FOracle.pm;h=b4c1584f74c1538156e3c0d33b583fa4adffe1e0;hb=7dc14bc09910cb750e5fe503dfa18a97eed490d1;hp=7548c2a8abc41470cbaf6f72f82b85f236812506;hpb=8b31f62e2b395fba451c32e0bbfecbd3e0f673f8;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLMaker/Oracle.pm b/lib/DBIx/Class/SQLMaker/Oracle.pm index 7548c2a..b4c1584 100644 --- a/lib/DBIx/Class/SQLMaker/Oracle.pm +++ b/lib/DBIx/Class/SQLMaker/Oracle.pm @@ -4,14 +4,16 @@ package # Hide from PAUSE use warnings; use strict; -use base qw( DBIx::Class::SQLMaker ); - BEGIN { - use DBIx::Class::Optional::Dependencies; - die('The following extra modules are required for Oracle-based Storages ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') . "\n" ) - unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener'); + require DBIx::Class::Optional::Dependencies; + if (my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') ) { + die "The following extra modules are required for Oracle-based Storages: $missing\n"; + } + require Digest::MD5; } +use base 'DBIx::Class::SQLMaker'; + sub new { my $self = shift; my %opts = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_; @@ -92,7 +94,7 @@ sub _order_siblings_by { return wantarray ? ( $sql, @bind ) : $sql; } -# we need to add a '=' only when PRIOR is used against a column diretly +# we need to add a '=' only when PRIOR is used against a column directly # i.e. when it is invoked by a special_op callback sub _where_field_PRIOR { my ($self, $lhs, $op, $rhs) = @_; @@ -144,9 +146,6 @@ sub _shorten_identifier { @keywords = $to_shorten unless @keywords; # get a base36 md5 of the identifier - require Digest::MD5; - require Math::BigInt; - require Math::Base36; my $b36sum = Math::Base36::encode_base36( Math::BigInt->from_hex ( '0x' . Digest::MD5::md5_hex ($to_shorten) @@ -177,7 +176,7 @@ sub _shorten_identifier { } } - # still too long - just start cuting proportionally + # still too long - just start cutting proportionally if ($concat_len > $max_trunc) { my $trim_ratio = $max_trunc / $concat_len;