eff_i_g has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I've a script using almost two dozen modules and as soon as I added Archive::Zip the wondrous "Segmentation Fault (core dumped)" surfaced.

I boiled it down to this simple script (see the comment)...
use warnings; use strict; use Archive::Zip; use Aspect; sub def { print 'def'; } ### Uncommenting the following = core dump. #before { print 'abc'; } call 'main::def'; def();
...which gives the following via the debugger:
Signal SEGV at /usr/local/lib/perl5/site_perl/5.10.0/Aspect/Advice/Bef +ore.pm line 53 Aspect::Advice::Before::_install('Aspect::Advice::Before=HASH( +0x793b38)') called at /usr/local/lib/perl5/site_perl/5.10.0/Aspect/Ad +vice.pm line 13 Aspect::Advice::new('Aspect::Advice::Before', 'code', 'CODE(0x +1592a8)', 'pointcut', 'Aspect::Pointcut::Call=ARRAY(0x75f980)', 'lexi +cal', '') called at /usr/local/lib/perl5/site_perl/5.10.0/Aspect.pm l +ine 64 Aspect::before('CODE(0x1592a8)', 'Aspect::Pointcut::Call=ARRAY +(0x75f980)') called at test.pl line 10 Abort (core dumped)
I'm afraid this is beyond my comprehension. Any insights as to why these two aren't playing well together?

Thanks!

Update: More from the debugger. It doesn't like the empty string(s)?
Watchpoint 0: $key changed: old value: 'COMPRESSION_STORED' new value: 'END_OF_CENTRAL_DIRECTORY_SIGNATURE_STRING' Watchpoint 2: $value changed: old value: 'SCALAR(0x32a2e0)' new value: 'GLOB(0x4ec640)' Aspect::Pointcut::match_all(/usr/local/lib/perl5/site_perl/5.10.0/Aspe +ct/Pointcut.pm:189): 189: next if $key =~ /[^\w:]/; DB<24> Aspect::Pointcut::match_all(/usr/local/lib/perl5/site_perl/5.10.0/Aspe +ct/Pointcut.pm:190): 190: next unless defined $value; DB<24> Aspect::Pointcut::match_all(/usr/local/lib/perl5/site_perl/5.10.0/Aspe +ct/Pointcut.pm:191): 191: $_ = "$package\::$key"; DB<24> Aspect::Pointcut::match_all(/usr/local/lib/perl5/site_perl/5.10.0/Aspe +ct/Pointcut.pm:192): 192: local(*ENTRY) = $value; DB<24> Watchpoint 0: $key changed: old value: 'END_OF_CENTRAL_DIRECTORY_SIGNATURE_STRING' new value: '' Watchpoint 1: $package changed: old value: 'Archive::Zip' new value: '' Watchpoint 2: $value changed: old value: 'GLOB(0x4ec640)' new value: '' Aspect::Pointcut::match_all(/usr/local/lib/perl5/5.10.0/Carp.pm:28): 28: sub longmess { goto &longmess_jmp }

Replies are listed 'Best First'.
Re: Archive::Zip + Aspect's "before" = core dump
by Khen1950fx (Canon) on Aug 11, 2010 at 22:48 UTC
    Try this:
    #!/usr/bin/perl use strict; use warnings; use Archive::Zip; use Aspect; my $pointcut = Aspect::Pointcut::Call->new(def()); before { print STDERR "Called my function " . $_->sub_name . "\n"; } call qr/^ main::def()\w+ $/; sub def { print "abc\n"; }
      Khen,

      This is the output I get:

      abc Segmentation Fault (core dumped)