Attempt to factor our alias handling has mostly failed.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / Stringify.pm
1 package # hide from PAUSE
2     DBIx::Class::CDBICompat::Stringify;
3
4 use strict;
5 use warnings;
6
7 use Scalar::Util;
8
9 use overload
10   '""' => sub { return shift->stringify_self; },
11   fallback => 1;
12
13 sub stringify_self {
14         my $self = shift;
15         my @cols = $self->columns('Stringify');
16         @cols = $self->primary_column unless @cols;
17         my $ret = join "/", map { $self->get_column($_) || '' } @cols;
18         return $ret || ref $self;
19 }
20
21 1;