Skip Menu |

This queue is for tickets about the Object-Util CPAN distribution.

Report information
The Basics
Id: 125750
Status: resolved
Priority: 0/
Queue: Object-Util

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

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



Subject: invoking Object::Util->import() causes B::Hooks::Parser to misbehave
Howdy. This may fall under the "if it hurts, stop doing that" class of behaviors. This code: BEGIN { require Object::Util; Object::Util->import; } Causes this error on Perl versions 5.22.1, 5.24.2, 5.26.1, and 5.28.0, w/ B::Hooks::Parser version 0.19 forced to realloc PL_linestr for line } , bailing out before we crash harder at [...]/B/Hooks/Parser.pm line 26. The backstory is that I'm using Import::Base to import Object::Util, and it effectively executes the above code. Thanks, Diab
Do things work if you use: Object::Util->import( magic => 0 ); ???
On Thu Jul 05 04:36:52 2018, TOBYINK wrote: Show quoted text
> Do things work if you use: > > Object::Util->import( magic => 0 ); > > ???
Yes.
With magic, the import works a bit like this: Internals::SvREADONLY( my $_new = \&Object::Util::_new ); Without magic, it works more like this: our $_new = \&Object::Util::_new; Your wrapper could theoretically still apply Internals::SvREADONLY to the variables after import if you wanted to. Are you satisfied with that as a solution? Otherwise, I'd need to delve into the guts of B::Hooks::Parser to attempt a fix, and there's no guarantee I'd be successful.
Subject: Re: [rt.cpan.org #125750] invoking Object::Util->import() causes B::Hooks::Parser to misbehave
Date: Fri, 6 Jul 2018 12:03:48 -0400
To: bug-Object-Util [...] rt.cpan.org
From: Diab Jerius <djerius [...] cpan.org>
I'm satisfied. The main reason for the report was to alert you to the behavior. The error message is sufficiently obscure and dire that I thought I'd triggered a bug in Perl, so down the rabbit hole I went. Might I suggest a tweak to the docs to recommend turning off magic if Object::Util isn't loaded with "use", with an example of the error message? I should note that if the example code is run outside of a BEGIN block, the error isn't fatal, just a complaint about an undefined variable in B::Hooks::Parser. Thanks, Diab On Fri, Jul 6, 2018 at 11:19 AM, Toby Inkster via RT <bug-Object-Util@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=125750 > > > With magic, the import works a bit like this: > > Internals::SvREADONLY( my $_new = \&Object::Util::_new ); > > > Without magic, it works more like this: > > our $_new = \&Object::Util::_new; > > > Your wrapper could theoretically still apply Internals::SvREADONLY to the variables after import if you wanted to. > > > Are you satisfied with that as a solution? Otherwise, I'd need to delve into the guts of B::Hooks::Parser to attempt a fix, and there's no guarantee I'd be successful.
Okay, documented in the repo. I won't release a new version just for this documentation change, but it'll get included whenever the next version happens.
On Fri Jul 06 15:15:03 2018, TOBYINK wrote: Show quoted text
> Okay, documented in the repo. I won't release a new version just for > this documentation change, but it'll get included whenever the next > version happens.
Thanks!