Fix relative path handling in templates on Perl 5.26+ with 'do'#79
Closed
xsawyerx wants to merge 1 commit into
Closed
Fix relative path handling in templates on Perl 5.26+ with 'do'#79xsawyerx wants to merge 1 commit into
xsawyerx wants to merge 1 commit into
Conversation
Instead of using a messy delete/eval+require construction, its simpler just to use "do" which doesn't check %INC in the first place. do + $@ semantics are the same as requires, and "do" was designed for this sort of thing. Additionally, this leads to be able to potentially check the value of $!, which may be meaningful here. Additionally, "didn't end with true" is no longer a failure condition ... this may or may not be a good thing. NB: It doesn't seem like the value of "$compiled" is very useful in the failure case, as the expectation is with require, that'd have been a falsey value at best, or a literal "undef" at worst, yeilding additional warnings.
Member
toddr-bot
added a commit
to toddr-bot/Template2
that referenced
this pull request
Apr 1, 2026
…thors#177) Replace the delete-$INC-then-require hack with do(), which doesn't consult or modify %INC in the first place. This eliminates the need to manipulate global interpreter state just to reload compiled templates, as originally proposed in GH cpan-authors#79. Closes cpan-authors#177 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toddr-bot
added a commit
to toddr-bot/Template2
that referenced
this pull request
Apr 5, 2026
…thors#177) Replace the delete-$INC-then-require hack with do(), which doesn't consult or modify %INC in the first place. This eliminates the need to manipulate global interpreter state just to reload compiled templates, as originally proposed in GH cpan-authors#79. Closes cpan-authors#177 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of using a messy delete/eval+require construction, its simpler
just to use "do" which doesn't check %INC in the first place.
do + $@ semantics are the same as requires, and "do" was designed for
this sort of thing.
Additionally, this leads to be able to potentially check the value of
$!, which may be meaningful here.
Additionally, "didn't end with true" is no longer a failure condition
... this may or may not be a good thing.
NB: It doesn't seem like the value of "$compiled" is very useful in the
failure case, as the expectation is with require, that'd have been a
falsey value at best, or a literal "undef" at worst, yeilding additional
warnings.