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} );
}