garu / Data-Printer

colored pretty-print of Perl data structures and objects
100 stars 81 forks source link

spews warnings with recent Object::Pad: Object::Pad::MOP is experimental ... #174

Open jonassmedegaard opened 1 year ago

jonassmedegaard commented 1 year ago

Calls to Object::Pad::MOP spews errors since recently, as documented here.

Here's a fix:

--- a/GenericClass.pm
+++ b/GenericClass.pm
@@ -93,6 +93,7 @@ filter '-class' => sub {
             }
             elsif ($parent eq 'Object::Pad::UNIVERSAL') {
                 Data::Printer::Common::_tryme(sub {
+                    no if ( $] >= 5.018 ), warnings => 'experimental';
                     my $meta = Object::Pad::MOP::Class->for_class( $class_name );
                     %attributes = map {
                         $_->name . $_->value($class_name) => {
garu commented 1 year ago

Hi Jonas! Thanks for the head's up and the patch! Unfortunately I cannot accept it as is because "no if" only made it to core in perl 5.22.0 and Object::Pad's minimal version is 5.18.0 - and I don't want to add an extra dependency just to cover Object::Pad.

Could you update the patch so it works with older perls without adding an extra dependency? I know it's a bit of a pain but a lot of developers need to work on pretty wild codebases and I want DDP to be a tool for everyone. If you can't, just let me know and I'll try and come up with something when I have enough time.

Thanks!

jonassmedegaard commented 1 year ago

Quoting Breno G. de Oliveira (2023-01-10 04:38:12)

Hi Jonas! Thanks for the head's up and the patch! Unfortunately I cannot accept it as is because "no if" only made it to core in perl 5.22.0 and Object::Pad's minimal version is 5.18.0 - and I don't want to add an extra dependency just to cover Object::Pad.

Could you update the patch so it works with older perls without adding an extra dependency? I know it's a bit of a pain but a lot of developers need to work on pretty wild codebases and I want DDP to be a tool for everyone. If you can't, just let me know and I'll try and come up with something when I have enough time.

Ohh, thanks for clueing me in on why App::Licensecheck 3.3.2 really fails, and why my fix for 3.3.3 won't do any good.

I will try look for a better fix.

--

jonassmedegaard commented 1 year ago

I think you are mistaken: perl 5.18 documents the syntax proposed here, and tests for App::Licensecheck v3.3.4 using that syntax seems to succeed for perl 5.18.

jonassmedegaard commented 1 year ago

@garu Can you elaborate on why you believe this won't work for older perls?

eserte commented 4 months ago

because "no if" only made it to core in perl 5.22.0

The "no if" syntax exists forever (well, almost):

$ corelist if   
...
if was first released with perl v5.6.2

So I think there are no obstacles for applying the patch?