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

Monks,

I have just noticed the following bug (in either forks or DBI):

This works:
perl -Mforks -MDBI -e ''

This doesn't work:
perl -MDBI -Mforks -e ''
(Causes segfault).

Apparently, loading DBI before loading forks causes the problem, while loading forks before loading DBI runs normally.

I have confirmed this with perl 5.10.0 on Ubuntu 8.04, forks v0.27, DBI v1.607, as well as perl 5.8.8 on Fedora 7 with forks v0.27 and DBI v1.607.

What gives?

Replies are listed 'Best First'.
Re: Segfault: forks and DBI
by gwadej (Chaplain) on Nov 25, 2008 at 17:53 UTC

    From the fork docs:

    Since forks overrides core Perl functions, you are *strongly* encouraged to load the forks module before any other Perl modules. This will insure the most consistent and stable system behavior.

    I'd say a segfault might be related to *strongly* encouraged to load forks first.

    G. Wade
      Thanks for pointing that out :)