On Fri, 13 Oct 2006, Toby Corkindale wrote:
> Seems to be an error in the Manual::Cookbook.
> Under "Stringification" it says:
> Employ the standard stringification technique by using the "overload"
> module. Replace "foo" with the column/method of your choice.
>
> use overload '""' => 'foo', fallback => 1;
>
> However, this results in an error of:
> Can't resolve method "???" overloading """" in package "overload"
>
> Changing the overload line to this (thanks Castaway!) works:
> use overload '""' => sub { return $_[0]->foo; }, fallback => 1;
>
>
>This is on Perl 5.8.8 (overload.pm $VERSION=1.04).
For what it's worth I'm seeing something similar-but-different (on perl
v5.8.5 with overload.pm 1.01). I added stringification in the
use overload '""' => 'foo', fallback => 1;
style to the target class of a has_one relationship and it stopped
working, with (as far as I can tell) the accessor returning undef.
Switching the stringification to
use overload '""' => sub { shift->foo }, fallback => 1;
fixed the problem. I have neither the clue nor frankly the time at the
moment to work out what's happening, but offer this as a data point.
Jon.
--
Jon Warbrick
Web/News Development, Computing Service, University of Cambridge
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/