Hi!,
i' getting a Segmentation fault, with a very simple program.
when i run it
perl script_ma.pl ### DESTROY - start ### _write_configuration - store start Segmentation fault
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.)
#!/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; }
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;
Any ideas?
many thanks

In reply to perl Segmentation fault (with Storable?) by glide

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.