Re: failure using Socket in PerlSection

Mark Heiges <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Nov 10, 2012, at 10:22 AM, Torsten Förtsch wrote:

> On 11/10/2012 03:43 PM, Mark Heiges wrote:
>> 
>> On Nov 9, 2012, at 10:36 PM, Mark Heiges wrote:
>> 
>>> I have a name-based virtual host and want to use Socket.pm in a PerlSection:
>>> 
>>> <Perl>
>>> use Socket;
>>> </Perl>
>>> 
>>> but when starting httpd I get the error,
>>> 
>>> $parms->add_config() has failed: Invalid command 'INADDR_ANY', perhaps misspelled or defined by a module not included in the server configuration at /usr/lib64/perl5/Apache2/PerlSections.pm line 215.\n
>> 
>> Nevermind. I can selectively export only the symbols I need.
>> 
>> <Perl>
>> use Socket qw(inet_ntoa);
>> </Perl>
>> 
> You should also be able to
> 
> <Perl>
> {
>  package Something::That::Does::Not::Start::With::Apache2::ReadConfig;
>  use Socket;
> }
> </Perl>
> 
> The point is, everything in %Apache2::ReadConfig:: is passed to the
> httpd as configuration.
> 
> The default package for <Perl> sections is
> Apache2::ReadConfig::path::to::config::file_conf::line_NNN given the
> file containing the <Perl> section is /path/to/config/file.conf and the
> line following the opening <Perl> directive is NNN.
> 
> Torsten


Yes, that works and declaring a package is semantically cleaner in my real-world usage. Thank you!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.