Well, I dove into the internals of TT to find out what my compiled [% 
PERL %] block that was causing perl to seg fault looks like. It turns 
out that the following construct (boiled down from what's created by TT 
compiling a PERL block) causes perl 5.6.1 to crash:

my $code = eval q{
     sub {
         local $x;
         eval 'print $$';
     };
};
$code->();

I've pulled out all TT-related code, so I guess this is a bug in perl. 
Also notable is that I don't get seg faults with this code under perl 
5.6.0; just 5.6.1.

Unless someone else has a good idea, I'll be submitting it with perlbug 
shortly.

  - Kevin


On Monday, June 3, 2002, at 09:30  AM, Kevin Eye wrote:

> Thanks for confirming that it's not just my machines being flaky.
>
> I saw the same trace information from the debugger when mine crashed. 
> It seemed like the "print $$" code was not what was crashing, but 
> rather some initialization code in the Template (Template::Document, 
> maybe) module itself. I'm quite unfamiliar with the guts of TT, but I 
> guess that's about to change...
>
>  - Kevin
>
> On Sunday, June 2, 2002, at 10:15  PM, Clifton Wood wrote:
>
>> On Friday 31 May 2002 10:54, you wrote:
>>> The following code causes a seg fault for me:
>>>
>>> use Template;
>>> my $tt = Template->new({ EVAL_PERL => 1});
>>> my $script = '[% PERL %] print $$ [% END %]';
>>> $tt->process(\$script) or die $tt->error;
>>>
>>
>> On a lark I converted this to a one-liner and ran it thru the perl 
>> debugger
>> on my end. Even stepping thru with 'n', I still SEGV'd, but this time I
>> received information that might help in locating the problem:
>>
>> perl -d -MTemplate -le '$tt=Template->new({EVAL_PERL=>1}); my $s="[% 
>> PERL
>> %]print \$\$[% END %]"; $tt->process(\$s) or die $tt->error'
>>
>> <type n 3 or so times>
>>
>> And I get this:
>>
>> "Signal SEGV at (eval 
>> 4)[/usr/local/lib/perl/5.6.1/Template/Document.pm:68]
>> line 7
>>         Template::Document::__ANON__[(eval
>> 4)[/usr/local/lib/perl/5.6.1/Template/Document.pm:68]:38]('Template::Context=
>> HASH(0x846c0f0)')
>> called at /usr/local/lib/perl/5.6.1/Template/Document.pm line 142
>>         eval {...} called at 
>> /usr/local/lib/perl/5.6.1/Template/Document.pm
>> line 140
>>         
>> Template::Document::process('Template::Document=HASH(0x8674d9c)',
>> 'Template::Context=HASH(0x846c0f0)') called at
>> /usr/local/lib/perl/5.6.1/Template/Context.pm line 283
>>         Template::Context::process('Template::Context=HASH(0x846c0f0)',
>> 'Template::Document=HASH(0x8674d9c)') called at
>> /usr/local/lib/perl/5.6.1/Template/Service.pm line 90
>>         eval {...} called at 
>> /usr/local/lib/perl/5.6.1/Template/Service.pm
>> line 88
>>         Template::Service::process('Template::Service=HASH(0x83d326c)',
>> 'SCALAR(0x80ffb9c)', undef) called at 
>> /usr/local/lib/perl/5.6.1/Template.pm
>> line 59
>>         Template::process('Template=HASH(0x83d54c8)', 
>> 'SCALAR(0x80ffb9c)')
>> called at -e line 1
>>
>> Aborted"
>>
>> Hope this helps.
>>
>> - Cliff Wood
>> - Programmer/Analyst/Editor, OSDN
>>
>>
>> _______________________________________________
>> templates mailing list
>> [EMAIL PROTECTED]
>> http://www.template-toolkit.org/mailman/listinfo/templates
>>
>>
>>


--
Kevin Eye
Web Applications Developer
Creative Services and Marketing
University at Buffalo
330 Crofts Hall
Buffalo, NY 14260
[EMAIL PROTECTED]
phone (716) 645-5000 x1435
fax (716) 645-3765
>
>
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://www.template-toolkit.org/mailman/listinfo/templates
>
>



Reply via email to