X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader.pm;h=4f55c8912393b7489eb4be1293ac19e42baaeaef;hb=a0e0a56a9b622b79fdc4584eabea5d715d309c79;hp=ea670f2f1e44c6bee0c6c8d72a3bf51ee3cbc77e;hpb=b1ad1a8402a5eb0955c6b76310809c2ab29291a9;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index ea670f2..4f55c89 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -10,10 +10,12 @@ use Scalar::Util qw/ weaken /; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -our $VERSION = '0.04999_10'; +our $VERSION = '0.04999_12'; __PACKAGE__->mk_classaccessor('_loader_args' => {}); -__PACKAGE__->mk_classaccessors(qw/dump_to_dir _loader_invoked _loader loader_class/); +__PACKAGE__->mk_classaccessors(qw/ + dump_to_dir _loader_invoked _loader loader_class naming +/); =head1 NAME @@ -150,6 +152,7 @@ sub _invoke_loader { $args->{schema_class} = $class; weaken($args->{schema}) if ref $self; $args->{dump_directory} ||= $self->dump_to_dir; + $args->{naming} = $self->naming if $self->naming; # XXX this only works for relative storage_type, like ::DBI ... my $impl = $self->loader_class @@ -285,16 +288,23 @@ Examples: sub import { my $self = shift; + return if !@_; + + my $cpkg = (caller)[0]; + foreach my $opt (@_) { if($opt =~ m{^dump_to_dir:(.*)$}) { $self->dump_to_dir($1) } elsif($opt eq 'make_schema_at') { no strict 'refs'; - my $cpkg = (caller)[0]; *{"${cpkg}::make_schema_at"} = \&make_schema_at; } + elsif($opt eq 'naming') { + no strict 'refs'; + *{"${cpkg}::naming"} = sub { $self->naming(@_) }; + } } } @@ -370,6 +380,24 @@ Returns a list of the new monikers added. sub rescan { my $self = shift; $self->_loader->rescan($self) } +=head2 naming + +=over 4 + +=item Arguments: \%opts | $ver + +=back + +Controls the naming options for backward compatibility, see +L for details. + +To upgrade a dynamic schema, use: + + __PACKAGE__->naming('current'); + +Can be imported into your dump script and called as a function as well: + + naming('v4'); =head1 KNOWN ISSUES @@ -389,20 +417,45 @@ arrayref of schemas to load. In "normal" L usage, manually-defined source classes and relationships have no problems crossing vendor schemas. -=head1 AUTHOR +=head1 ACKNOWLEDGEMENTS -Brandon Black, C +Matt S Trout, all of the #dbix-class folks, and everyone who's ever sent +in a bug report or suggestion. Based on L by Sebastian Riedel Based upon the work of IKEBE Tomohiro -=head1 THANK YOU +=head1 AUTHOR -Matt S Trout, all of the #dbix-class folks, and everyone who's ever sent -in a bug report or suggestion. +blblack: Brandon Black + +=head1 CONTRIBUTORS + +ilmarii: Dagfinn Ilmari Mannsåker + +arcanez: Justin Hunter + +ash: Ash Berlin + +Caelum: Rafael Kitover + +TSUNODA Kazuya + +Robert Bohne + +ribasushi: Peter Rabbitson + +gugu: Andrey Kostenko + +... and lots of other folks. If we forgot you, please write the current +maintainer or RT. + +=head1 COPYRIGHT & LICENSE -=head1 LICENSE +Copyright (c) 2006 - 2009 by the aforementioned +L and +L. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.