Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/TAP/Harness/Runtime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;

use base q (Exporter);

use constant HAS_TIME_HIRES => !! eval { use Time::HiRes qw (time); 1 };
use constant HAS_TIME_HIRES => !! eval q { use Time::HiRes qw (time); 1 };
Copy link
Member

Choose a reason for hiding this comment

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

This changes the eval from a block style evaluation to a string, which is not a good change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Block eval would not be able to test a use statement, but this can easily be done with a block eval: eval { require Time::HiRes; Time::HiRes->import('time'); 1 }

Copy link
Author

Choose a reason for hiding this comment

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

@karenetheridge original code had string evaluation.

I'm using form q { } for string containing code (hence { as paired delimiter).

commit introducing this change is fixup! of original commit. I'm using such approach to show reaction to code review comment, referring fixup commit(s) dealing with given issue raised in given comment.
(when I was taught this approach I hesitated but at the end, in many PR-review cycles, I found out that review by commit and reacting with fixups saved lot of time especially on reviewer's side)

@Grinnz my aim was only to extract existing runtime detection into dedicated library, but your suggestion is too good to be omitted ... 033f677

use constant IS_VMS => $^O eq q (VMS);
use constant IS_WIN32 => ($^O =~ qr (^ (MS) Win32 $)x);
use constant IS_UNIXY => ! (IS_VMS || IS_WIN32);
Expand Down