Skip Menu |

This queue is for tickets about the B-Hooks-EndOfScope CPAN distribution.

Report information
The Basics
Id: 106248
Status: resolved
Priority: 0/
Queue: B-Hooks-EndOfScope

People
Owner: Nobody in particular
Requestors: cpan [...] iijo.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Its not working for me
This module isn't working for me. Is there something I'm not understanding. I'm on Ubuntu and using perlbrew with perl v5.16.3 and B::Hooks::EndOfScope v0.15. I've also tried using B::Hooks::EndOfScope::PP and B::Hooks::EndOfScope::XS but that doesn't help. $ cat a #!/usr/bin/env perl use strict; use warnings; use B::Hooks::EndOfScope; my $a = yo(); print "$a\n"; sub yo { print "1\n"; on_scope_end { what() }; print "2\n"; return '4'; } sub what { print "3\n"; } $ perl a 1 2 4 Thanks! - Kablamo
Subject: Re: [rt.cpan.org #106248] Its not working for me
Date: Tue, 04 Aug 2015 10:44:21 -0400
To: bug-B-Hooks-EndOfScope [...] rt.cpan.org
From: Jesse Luehrs <doy [...] tozt.net>
Yes - B::Hooks::EndOfScope is for running things at the end of compile time scope, not runtime. If you wrap the on_scope_end call in a BEGIN block, it will fire the next time the compiler reaches a }. I think the module you're actually looking for is Scope::Guard. -doy
Thanks!