-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid warnings on lazy load #6
Merged
Merged
Conversation
This file contains 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
1 similar comment
Thank you for the pull request! For example, I would like to do the following: diff --git a/lib/Function/Return.pm b/lib/Function/Return.pm
index a24d453..79cbc17 100644
--- a/lib/Function/Return.pm
+++ b/lib/Function/Return.pm
@@ -170,7 +170,27 @@ sub _register_return_info {
$metadata{$key} = $info;
}
-sub CHECK {
+sub explain_check {
+ # TODO: more polite
+ my $dec = join ',', map {
+ my $sub = $_->{sub};
+ my $subname = Sub::Util::subname($_->{sub});
+ $subname;
+ } @DECLARATIONS;
+
+ warn "Call Function::Return#CHECK. DECLARATIONS: $dec";
+}
+
+BEGIN {
+ no warnings 'void';
+
+ CHECK {
+ explain_check() if $ENV{FUNCTION_RETURN_EXPLAIN};
+ check_sub();
+ }
+}
+
+sub check_sub {
for my $decl (@DECLARATIONS) {
my ($pkg, $sub, $types) = @$decl{qw(pkg sub types)}; |
I noticed that I could use B::Hooks::EndOfScope. I will merge this p-r and then try to fix it. |
Ref: #7 |
kfly8
added a commit
that referenced
this pull request
Jun 16, 2019
Changelog diff is: diff --git a/Changes b/Changes index 6561978..56a6edc 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,12 @@ Revision history for Perl extension Function-Return {{$NEXT}} +0.06 2019-06-16T22:11:25Z + - Support lazy load #7 #6 + - [BUGFIX] Fix no_check option #8 + - [IMCOMPATIBLE CHANGE] remove name option #9 + - add attributes tests #10 + 0.05 2019-02-18T01:06:31Z - Add import option `pkg` (bayashi) #5 - Fix document
kfly8
added a commit
that referenced
this pull request
Jun 19, 2019
Changelog diff is: diff --git a/Changes b/Changes index 56a6edc..771f921 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,10 @@ Revision history for Perl extension Function-Return {{$NEXT}} +0.07 2019-06-19T13:15:07Z + - [BUGFIX] Fix check_sub #11 + - Support `no_check` option globally #12 + 0.06 2019-06-16T22:11:25Z - Support lazy load #7 #6 - [BUGFIX] Fix no_check option #8
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.
Generaly, CHECK phase executes on last of compiling module. But I want to use this module as lazy-loaded. So a procs of CHECK should be able to being called from outside. And I've got rid of warnings 'Too late to run CHECK block'.
If we would have a way to avoid warnings from outside, we don't need
no warnings
in it. I think that it'd be better to have warnings.