CDBI + :lvalue

I thought it would be neat to make Class::DBI support lvalued accessors. For example.

my $film = File->retrieve(1);
$film->rating = 'PG-13';
$film->update;

So I decided to take a shot. The first step, and so I thought, only step was to make Class::Accessor create lvalue subroutines. I used Want.pm to make this happen. So here is what I did to the make_accessor() method. I did something similar to make_wo_accessor().

Ok, so all tests pass? Yes. New tests added? Yes. So all I have to do is install Class::Accessor and Class::DBI will Just Work? No.

I'm not sure what I did wrong, but here is how it broke down. There were situations that Want.pm apparently thought were lvalue context. Or maybe it was just Perl. Either way, it was confusing. Here are a couple examples.

show_film_name( $film->name );

Right there, I was getting errors about trying to modify a non-lvalue subroutine call. What? I'm not trying to modify anything of the sort, am I? Another example came right from the tests, 02-Film.t test number 10.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.