Jose Luis Martinez wrote:
> Hi,
>
> Is there any way to mark a relationship as "deprecated"?
>
> I have some code with relationships that are not named to well, and
> want to gradually rename them (while writing new code with the new
> relations). Search and replace is not an acceptable strategy, as there
> are lots of strings in the code with the same name that sould not be
> replaced.
>
> The goal is to mark relationships as "deprecated" (output something
> via STDERR so I can notice that they are being called while testing, for
> example), but I want them to keep on working as usually.
>
> Do the DBIx::Class-masters have any suggestions for doing this cleanly?
>
All you need to do is override related_resultset() in a base/component class
like so:
use Carp::Clan qw/^DBIx::Class/;
sub related_resultset {
my $self = shift;
if ($_[0] eq 'misnamed relname') {
carp 'you are using such and such - rename';
}
$self->next::method (@_);
}
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]