Commit | Line | Data |
---|---|---|
75d07914 | 1 | package # hide from PAUSE |
c0e7b4e5 | 2 | DBIx::Class::CDBICompat::Stringify; |
a3018bd3 | 3 | |
4 | use strict; | |
5 | use warnings; | |
6 | ||
5d283305 | 7 | use Scalar::Util; |
8 | ||
a3018bd3 | 9 | use overload |
37df4bfe | 10 | '""' => sub { return shift->stringify_self; }, |
5d283305 | 11 | fallback => 1; |
a3018bd3 | 12 | |
13 | sub stringify_self { | |
14 | my $self = shift; | |
a3018bd3 | 15 | my @cols = $self->columns('Stringify'); |
5d283305 | 16 | @cols = $self->primary_column unless @cols; |
2441e56f | 17 | my $ret = join "/", map { $self->get_column($_) || '' } @cols; |
5d283305 | 18 | return $ret || ref $self; |
a3018bd3 | 19 | } |
20 | ||
21 | 1; |