Skip to content

Conversation

@kiwiroy
Copy link

@kiwiroy kiwiroy commented Oct 22, 2025

This is a git rebase and caught up dist.ini of #6 by @haarg which is a few years old now.

I added some additional checks in the test file including around for an XS sub.

haarg and others added 4 commits October 22, 2025 16:08
While Class::Method::Modifiers is primarily meant to wrap methods, it
can also be used to wrap functions.  Functions may have prototypes, so
it would be better if they could maintained in the wrapper.

This works similarly to the lvalue attribute.  If a before or after is
applied, the wrapper takes its prototype from the sub being wrapped.  If
an around is applied, the modifier sub's prototype is used.  This is
rather strange for arounds, as the parameters it is passed will still
include the wrapped sub as the first parameter, so the parameters won't
match the prototype exactly.  Even with that oddness, it still seems to
be the best option.  This also means an around could change the
prototype, which will throw warnings.
@haarg
Copy link
Member

haarg commented Oct 22, 2025

Since I created my PR, Test::Fatal and Test::Warnings were intentionally dropped as prereqs, so we don't want to reintroduce them.

I've rebased my PR #6, updating it to avoid Test::Fatal and Test::Warnings, and integrating the additional testing you wrote here (but also updated to avoid Test::Warnings). Thanks.

@kiwiroy
Copy link
Author

kiwiroy commented Oct 22, 2025

Makes sense, closing as a result

@kiwiroy kiwiroy closed this Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants