Skip Menu |

This queue is for tickets about the HTML-FormFu CPAN distribution.

Report information
The Basics
Id: 51795
Status: open
Priority: 0/
Queue: HTML-FormFu

People
Owner: Nobody in particular
Requestors: rod.taylor [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.05001
Fixed in: (no value)



Subject: Modification of read only variable
Recently installed the YAML::XS for config file parsing. It complains in some cases (not sure exactly what yet) that FormFu is modifying a read only variable at line 184 of FormFu.pm The following coding seems to work okay though. It copies $_ to another variable then does the work on this. if ( $config->{config_callback} ) { $form->config_callback( { plain_value => sub { return if !defined $_; my $foo = $_; $foo =~ s{__uri_for\((.+?)\)__} { $self->{c}->uri_for( split( '\s*,\s*', $1 ) ) }eg; $foo =~ s{__path_to\(\s*(.+?)\s*\)__} { $self->{c}->path_to( split( '\s*,\s*', $1 ) ) }eg; $foo =~ s{__config\((.+?)\)__} { $self->{c}->config->{$1} }eg; return $foo; } } ); weaken( $self->{c} ) if !isweak( $self->{c} ); }
I've added a test for setting __uri_for(x)__ in a config file, and it runs ok with YAML::XS. I'd like to try and get some more info about what's causing this before making any changes.
From: rod.taylor [...] gmail.com
On Thu Dec 10 08:56:31 2009, CFRANKS wrote: Show quoted text
> I've added a test for setting __uri_for(x)__ in a config file, and it > runs ok with YAML::XS. > > I'd like to try and get some more info about what's causing this before > making any changes.
Got this again today except on a different system. My previous report was on FreeBSD and today it was on Linux Ubuntu with YAML::XS 0.34. Copying $_ to $foo, and operating on that fixes the issue. Any suggestions? I not hopeful that I can find out what set the variable to readonly.
Hi, I tried applying your suggested change, but it causes Catalyst-Controller-HTML-FormFu to fail its tests, because HTML-FormFu creates the Data::Visitor::Callback object with ( ignore_return_values => 1 ). So the transformation is being thrown away, and the original $_ is still being used. That setting has been there since the first release of HTML-FormFu, so I'm hesitant to change it, as it will likely break the code of anyone who is using a callback. Can you tell me which versions of perl, HTML-FormFu, Catalyst-Controller-HTML-FormFu and Data::Visitor you're using?