Ok, I believe I've found the issue.
The _current_url
method I've pasted above got overridden by Moose's generated read-only accessor of the same name, so when I tried to call $self->_current_url
with a value, it throws the above error to indicate that the read-only accessor cannot set values.
I guess the error message should ideally be Cannot assign a value **through** a read-only accessor of _current_url
, not **to** a read-only accessor
.
Changing the name of the sub to _set_current_url
solved the problem. I guess another way to achieve the same would be to tell Moose that _current_url
is => 'rw'
and then create an around '_current_url'
. I haven't tried this approach.