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