Skip to content

::Style::Stream should localize $_ [rt.cpan.org #101129] #72

@toddr

Description

@toddr

Migrated from rt.cpan.org#101129 (status was 'open')

Requestors:

Attachments:

From [email protected] on 2014-12-25 16:59:50
:

From XML::Parser::Style::Stream:

  sub doText {
    no strict 'refs';
    my $expat = shift;
    $_ = $expat->{Text};

If $_ is read only when this function is called, the function will die with 'Modification of a read-only value attempted'. The fix is to localize $_ here (and everywhere else it is used like this).

I can write a failing test case if it helps. I could also try to write a patch if needed.

From [email protected] on 2015-01-12 06:54:30
:



> I can write a failing test case if it helps. I could also try to write
> a patch if needed.


That would help speed things along.

https://github.com/toddr/XML-Parser

From [email protected] on 2015-01-12 07:53:41
:

"Todd Rinaldo via RT" <[email protected]> writes:

>> I can write a failing test case if it helps. I could also try to write
>> a patch if needed.
>
> That would help speed things along.

Here are two patches.

The first adds a test case that fails with the current code.
The second fixes the bug by localizing $_ in the subs that use it.



Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions