Oskari 'Okko' Ojala wrote:
Anyone had a look in this patch?

On Mon, 4 Jan 2010, Oskari 'Okko' Ojala wrote:

The attached patch is against r1657 of http://html-formfu.googlecode.com/svn/trunk/Catalyst-Controller-HTML-FormFu/lib/Catalyst/Controller/HTML/FormFu.pm

to fix fatal error message

"Modification of a read-only value attempted at ..../perl5/lib/perl5/Catalyst/Controller/HTML/FormFu.pm line 178."


Unfortunately I don't know what is the exact chain that causes a read-only value to arrive there, but I'm using the most recent FormFu inside Catalyst. If you eval

for ("foo") { s/foo/bar/; print }

you can probably see a simplified case of what happens there without the patch. I hope you accept the patch without a list of detailed steps to reproduce the bug. ;-)


The plain_value callback passed to config_callback is /supposed/ to modify $_ in place. Observe that the existing code does not return the modified string from the callback:

  if ( $config->{config_callback} ) {
    $form->config_callback( {
          plain_value => sub {
            return if !defined $_;
            s{__uri_for\((.+?)\)__}
             { $self->{c}->uri_for( split( '\s*,\s*', $1 ) ) }eg;
            s{__path_to\(\s*(.+?)\s*\)__}
             { $self->{c}->path_to( split( '\s*,\s*', $1 ) ) }eg;
            s{__config\((.+?)\)__}
             { $self->{c}->config->{$1}  }eg;
            }
      } );

    weaken( $self->{c} )
      if !isweak( $self->{c} );
  }

So, although your proposed patch would avoid the fatal error you're encountering, unfortunately it would completely break this feature.

I'm afraid you will need to figure out how a read-only value is getting passed into this subroutine. If you can provide any more details, that would be helpful.

Ronald

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to