Description: With Perl >= 5.13.6, reallocate PL_linestr in a block
 hook to avoid reallocations; borrowed loosely from Devel::Declare
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Debian: http://bugs.debian.org/636132
Bug-Ubuntu: https://bugs.launchpad.net/bugs/935261
Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=66997

--- signatures-0.05.orig/signatures.xs
+++ signatures-0.05/signatures.xs
@@ -241,6 +241,16 @@
 	return ret;
 }
 
+#if PERL_BCDVERSION >= 0x5013006
+STATIC void
+block_start (pTHX_ int full) {
+	PERL_UNUSED_VAR (full);
+
+	if (SvLEN (PL_linestr) < 16384)
+		lex_grow_linestr (16384);
+}
+#endif
+
 STATIC OP *
 before_eval (pTHX_ OP *op, void *user_data) {
 	dSP;
@@ -293,12 +303,19 @@
 		char *f_class
 	PREINIT:
 		userdata_t *ud;
+#if PERL_BCDVERSION >= 0x5013006
+		static BHK bhk;
+#endif
 	INIT:
 		Newx (ud, 1, userdata_t);
 		ud->class = newSVsv (class);
 		ud->f_class = f_class;
 	CODE:
 		ud->parser_id = hook_parser_setup ();
+#if PERL_BCDVERSION >= 0x5013006
+		BhkENTRY_set (&bhk, bhk_start, block_start);
+		Perl_blockhook_register (aTHX_ &bhk);
+#endif
 		ud->eval_hook = hook_op_check (OP_ENTEREVAL, handle_eval, ud);
 		RETVAL = (UV)hook_op_check (OP_CONST, handle_proto, ud);
 	OUTPUT:
