#80 method methods #246

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

exodist commented Mar 22, 2013

Just putting this out here for review and to allow other people to poke it. I know it needs a lot of work still. This is for #80.

Contributor

schwern commented on lib/perl5i/2/CODE.pm in 50d2a3d Mar 22, 2013

Load this on demand inside the methods as needed. Otherwise it adds 5-10% to our load time.

Contributor

schwern commented on t/codref.t in 50d2a3d Mar 22, 2013

The behavior of end_line for subroutines not declared using our own signature methods concerns me. I'm afraid its an error trap.

I would say lacking an end line should be an exception. One needs to write error handling code for that case anyway, might as well make it a real error so if you forget to write the error handling code you know.

Contributor

schwern commented on lib/perl5i/2/CODE.pm in 50d2a3d Mar 22, 2013

"original" is a bit ambiguous. Its really what they were "declared" as.

Contributor

schwern commented on t/codref.t in 50d2a3d Mar 22, 2013

You can affix the line numbers with # line 9. Then no matter what the line number really is, Perl will count from 9 after that. Good trick for testing.

Contributor

exodist replied Mar 22, 2013

Yes, but then EVERY line is offset, unless I wrap it in a string eval. That makes debugging broken tests hard.

Contributor

schwern replied Mar 23, 2013

Just thought of something... use __LINE__ to record the line numbers and reference them in the test.

my %lines;

$lines{a_method}{start} = __LINE__ + 1;
method a_method {
    ...
}
$lines{a_method}{end} = __LINE__ - 1;

...

my $code = __PACKAGE__->can("a_method");
is( $code->start_line, $lines{a_method}{start} );
Contributor

schwern commented Mar 22, 2013

The documentation should go into lib/perl5i.pm in the "Code autoboxing" section.

Contributor

schwern commented on 5f73dc3 Mar 22, 2013

That doesn't look like the result of our project .perltidyrc.

Contributor

exodist replied Mar 22, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment