i have tested the script with perl versions: v5.8.5, v5.8.7, v5.8.8 in a ubuntu and fedora linux. (but if i remove the "skip" subroutine, the program run without any problem.)perl script_ma.pl ### DESTROY - start ### _write_configuration - store start Segmentation fault
#!/usr/bin/perl use strict; use warnings; use lib "$ENV{PWD}"; use myConfig; # create the objecto for write the db my $c_config = myConfig->new(); # add default to the configuration db $c_config->add_default(default=>'aa'); sub skip { my (%args)=@_; $c_config->add_default(default=>'bb'); return 0; }
Any ideas?package myConfig; use strict; use warnings; use Storable qw(store); use Class::Std::Utils; use Smart::Comments; { my %db_data; sub new { my ($class, %args) = @_; my $new_object = bless anon_scalar( ), $class; return $new_object; } sub _write_configuration { my ($self,%args) = @_; ### _write_configuration - store start store( $db_data{ident $self}, $ENV{PWD}."test") or die($!); ### _write_configuration - return return; } sub add_default { my ($self,%args) = @_; $db_data{ident $self}{default} = $args{default}; return; } sub DESTROY { my ($self) = @_; ### DESTROY - start $self->_write_configuration(); ### DESTROY - finish return; } } 1;
In reply to perl Segmentation fault (with Storable?) by glide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |