Subject: | DBIx::Class::Storage::DBI dereference error |
Date: | Sat, 17 Jan 2009 21:40:12 -0600 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | Dave Wolfe <Dave [...] WolfeWorks.net> |
Ubuntu 8.04 (all updates current)
Perl 5.8.8
Catalyst-Engine-5.7099_03
Catalyst-Model-DBIC-0.16
DBIx-Class-0.08010 (also DBIx-Class-0.08099_05)
I get:
"DBIx::Class::ResultSet::search(): Modification of a read-only value
attempted at /usr/local/cat/share/perl/5.8.8//DBIx/Class/Storage/DBI.pm
line 1103."
1098 sub _select {
1099 my ($self, $ident, $select, $condition, $attrs) = @_;
1100 my $order = $attrs->{order_by};
1101
1102 if (ref $condition eq 'SCALAR') {
==>1103 $order = $1 if $$condition =~ s/ORDER BY (.*)$//i;
1104 }
1105
1106 my $for = delete $attrs->{for};
1107 my $sql_maker = $self->sql_maker;
1108 local $sql_maker->{for} = $for;
My code that provokes this error is:
my $rs = $c->model('DB::Content')->search(
{ path => $path,
type => $type,
'pageacl.userid' => $c->session->{userid},
'pageacl.access' => {'>=' => $access} },
{ where => \'NOW() BETWEEN startdt AND stopdt',
join => 'pageacl',
order_by => \'startdt DESC, stopdt ASC' });
Apparently the string referenced by $condition is a literal and thus
can't be modified by the s///. I didn't track down where it gets set
that way since it's not in my code, but obviously the fix applied to
other areas need to be done here as well. Thanks.
--
Dave Wolfe