in reply to [SOLVED] Configuring Apache VirtualHosts using mod_perl 2

The behavior of those two functions at startup certainly sounds "buggy" to me. Let's not call this problem truly "solved" until we establish that it's proper for it to be behaving that way.
  • Comment on Re: [SOLVED] Configuring Apache VirtualHosts using mod_perl 2

Replies are listed 'Best First'.
Re^2: [SOLVED] Configuring Apache VirtualHosts using mod_perl 2
by FloydATC (Deacon) on Dec 02, 2014 at 16:35 UTC

    I agree in principle, although it's not really related to configuring VirtualHosts so it would probably deserve to be discussed in a node of its own.

    ...By someone considerably more skilled than myself :-/

    I worked around the problem by scanning the passwd/group files manually. Not at all portable ofcourse, but that's no particular concern of mine.

    my %users = (); my %groups = (); my $pfname = '/etc/passwd'; open(my $pfh, $pfname) || warn "Error reading $pfname: $!"; while (my $line = <$pfh>) { my ($name) = split(/:/, $line); $users{$name} = 1; } close $pfh; my $gfname = '/etc/group'; open(my $gfh, $gfname) || warn "Error reading $gfname: $!"; while (my $line = <$gfh>) { my ($name) = split(/:/, $line); $groups{$name} = 1; } close $gfh;
    -- FloydATC

    Time flies when you don't know what you're doing

      When getpwent returns undef, what is output of sub Fudge?

        Let's see, I inserted the following into my Apache conf perl section:

        while ( my $user = getpwent() ) { $users{$user} = 1; } while ( my $group = getgrent() ) { $groups{$group} = 1; } open (my $fh, '>>', '/var/log/httpd/fudge.log'); print $fh Fudge(); close $fh; sub Fudge { use Errno(); join qq/\n/, "Error @_", map { " $_" } int( $! ) . q/ / . $!, int( $^E ) . q/ / . $^E, grep( { $!{$_} } keys %! ), q/ /; }

        Here's what I got after restarting httpd:

        Error 25 Inappropriate ioctl for device 25 Inappropriate ioctl for device ENOTTY Error 25 Inappropriate ioctl for device 25 Inappropriate ioctl for device ENOTTY

        All I can tell from this is that the config is indeed executed twice (as mentioned in the OP) but the actual messages don't mean much to me.

        If I had a gun pointed at me and had to guess, I'd say it has something to do with the environment presented to httpd by systemd.

        -- FloydATC

        Time flies when you don't know what you're doing