#80 method methods #246

Open
wants to merge 2 commits into
from

Projects

None yet

2 participants

@exodist
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.

@schwern
Contributor

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

@schwern
Contributor

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.

@schwern
Contributor

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

@schwern
Contributor

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

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

Contributor

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} );
@schwern
Contributor
schwern commented Mar 22, 2013

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

@schwern
Contributor

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

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