| 1 | package Test_Renaming; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.010; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Lexical::Hints { set_hint => 'install_hint', get_hint => 'retrieve_hint' }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Test::More; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | # Initialize module's hints... | ||||||||||
| 8 | 3 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=2 SCAR=7.1
| |||||||||||
| 9 | 3 | my ($package, $hint_value) = @_; | |||||||||
| 10 | 3 | ▶ | if (defined $hint_value) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 3 | install_hint(cth => $hint_value); | |||||||||
| 12 | } | ||||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | # Test hints are set... | ||||||||||
| 16 | 6 | ▶ | sub verify_hint_is { | ||||||||
|
Subroutine
verify_hint_is: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | 6 | my ($hint_value) = @_; | |||||||||
| 18 | 6 | is retrieve_hint('cth'), $hint_value => "Verifying value is now: $hint_value"; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | # Set hints... | ||||||||||
| 22 | 0 | ▶ | sub install_hint_to { | ||||||||
|
Subroutine
install_hint_to: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 0 | my ($hint_value) = @_; | |||||||||
| 24 | 0 | install_hint('cth' => $hint_value); | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | # Attempt to create a new hint... | ||||||||||
| 28 | 0 | ▶ | sub set_new_hint_to { | ||||||||
|
Subroutine
set_new_hint_to: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 29 | 0 | my ($hint_value) = @_; | |||||||||
| 30 | 0 | is eval{ install_hint('new_cth' => $hint_value); }, undef() => 'Runtime autovivification failed'; | |||||||||
| 31 | 0 | like $@, qr{^Cannot autovivify hint 'new_cth' at runtime for Test_Compiletime_Hints} | |||||||||
| 32 | => 'Correct error message'; | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 1 | 1; # Magic true value required at end of module | |||||||||
| 36 | |||||||||||