acanfora has asked for the wisdom of the Perl Monks concerning the following question:
when I call it from a traditional CGI, all works without a glitch:package EXAMPLE; use strict; use warnings; sub import{ my $context = caller; my $symbol = "$context\:\:my_dirt_sneaky_object_reference"; warn $context; warn $symbol; { no strict 'refs'; *$symbol = \EXAMPLE->new; } } sub new{ my $class = shift; my $self = {}; return bless $self, $class; } sub my_example_method{ print "hi, I am here!"; }
When I call the same code from mod_perl (Registry), I get a segmentation fault after the first invocation. Am I doing any big mistake with mod_perl? Is it the bad way to play with namespaces in mod_perl? To tell the truth, what I am trying to achieve is a bit more convoluted, but I tried to reduce it to what I believe is the kernel of the problem. Any idea? Thanks in advance for tips and advices.#!/usr/bin/perl use lib '/path/to/whateveryoulike'; use EXAMPLE; $my_dirt_sneaky_object_reference->my_example_method;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: symbols, scope, and mod_perl
by acanfora (Novice) on Oct 01, 2012 at 10:42 UTC | |
by Anonymous Monk on Oct 01, 2012 at 10:52 UTC | |
by Anonymous Monk on Oct 01, 2012 at 10:58 UTC | |
by acanfora (Novice) on Oct 01, 2012 at 12:03 UTC | |
by Anonymous Monk on Oct 01, 2012 at 12:11 UTC | |
| |
by Anonymous Monk on Oct 01, 2012 at 12:09 UTC | |
|