Skip to content

Fix relative path handling in templates on Perl 5.26+ with 'do'#79

Closed
xsawyerx wants to merge 1 commit into
cpan-authors:masterfrom
xsawyerx:fix/dot-in-inc
Closed

Fix relative path handling in templates on Perl 5.26+ with 'do'#79
xsawyerx wants to merge 1 commit into
cpan-authors:masterfrom
xsawyerx:fix/dot-in-inc

Conversation

@xsawyerx
Copy link
Copy Markdown
Contributor

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.

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.
Copy link
Copy Markdown
Collaborator

@atoomic atoomic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an alternate solution to #80 using do instead of the traditional "delete INC + require"

@toddr
Copy link
Copy Markdown
Member

toddr commented Oct 5, 2018

We're going to reject this PR over #80 as it's a behavior change. See #177 for further discussion

@toddr toddr closed this Oct 5, 2018
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>
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.

4 participants