PerlPowerTools icon indicating copy to clipboard operation
PerlPowerTools copied to clipboard

fix caller() for PAR::Packer in modulinos packer

Open kal247 opened this issue 1 year ago • 10 comments

kal247 avatar Mar 19 '24 03:03 kal247

Note that this change makes t/factor/factor.t hang.

briandfoy avatar Mar 19 '24 04:03 briandfoy

Long story short : While I was preparing this PR yesterday, Murphy's law hit me. Calling the modulinos indirectly, like bin/perlpowertools echo (for example) didn't work (anymore?). So I added this 'main' test to fix the issue, then noticed that the tests for 'factor' and 'units' hang. At that point I was very confused (doubting of my code, my memory and my two laptops) and decided to start the PR...

kal247 avatar Mar 19 '24 19:03 kal247

I'll raise another PR with all the code, so you can have the full picture.

kal247 avatar Mar 19 '24 19:03 kal247

Somehow a commit "packer v1.32" has been added to this PR. The way of Git is really mysterious to me.

kal247 avatar Mar 19 '24 19:03 kal247

The check for 'main' is a bit weird here and we can't disallow that. That would be surprising to people who write a simple program and want to load one of the modulinos.

Is this something that PAR does that caller(1) won't catch?

If bin/perlpowertools declared (or reused) a package, would it show as caller(0)? Maybe could we even test caller(0) eq 'PerlPowerTools'?

kal247 avatar Mar 19 '24 21:03 kal247

I don't know anything how packer works, so I don't have any advice to give there. Maybe people on /r/perl or Stackoverflow would know.

briandfoy avatar Mar 20 '24 05:03 briandfoy

To fix the issue with 'main' in modulinos : I've set package PerlPowerTools before calling do in helper script, then changed the test in modulinos. For 'factor', I had to add 1; to avoid Failed test 'require 'bin/factor'. 'factor' and 'units' don't hang anymore and make test runs ok.

kal247 avatar Mar 20 '24 19:03 kal247

The latest changes are good. It looks like there's an unrelated files outside of bin/ that snuck in. If we can fix that up I think this request is good to go.

briandfoy avatar Mar 23 '24 16:03 briandfoy

Sorry, but where are the unrelated files? I don't find them.

Another question : I've not yet committed the latest 'perlpowertools.exe' file itself. Should I do it, or will it be rebuilt automatically anyway?

Thanks

kal247 avatar Mar 24 '24 19:03 kal247

When I look at this PR in GitHub, there are 12 files changed. I figure that you merge something and some other files snuck in.

As for rebuilding, I haven't set up anything to do anything with packer. If something needs to be rebuilt we'll have to figure that out. It might happen as part of the release GitHub action.

briandfoy avatar Mar 24 '24 22:03 briandfoy

The 12 files are changed as intended :

2 changes to move and rename packer.pl -> packer
2 new tests
1 helper script
5 tools fixes for modulinos
new Readme file
new binary

kal247 avatar Mar 30 '24 07:03 kal247

For this PR, you should only be fixing the files under bin/. This is the same thing I said before. I'm not going to merge the files outside of bin/ for this change, so the pull request needs to be fixed.

briandfoy avatar Mar 30 '24 21:03 briandfoy

Thanks!

kal247 avatar Apr 03 '24 20:04 kal247