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

Greetings peeps,

Lately I've been doing lots of work with h2xs and its children to write Perl/C extensions and h2xs has an annoying trait the source of which I can't locate.   h2xs -A -n target creates a skeleton Makefile.PL in the target dirctory and that .PL file contains a basic definition of WriteMakefile(). It initializes the AUTHOR key to:

    AUTHOR => 'my_full_name <perlboy_emeritus@sd.apple.com>') : ()),

Name redacted to protect the guilty :-)

I'm using Perl (v5.18.2) built for darwin-thread-multi-2level running in macOS 10.13.3

My question is: Where does h2xs get that domain, sd.apple.com? That is not my email address and I have configured it nowhere. I've even tried sending email to that address, thinking that somehow Apple configured such an address for me, without informing me. They didn't; the mail bounced. It is annoying to have to change that line every time I create and then edit Makefile.PL.

Any ideas? Thanks in advance.

Replies are listed 'Best First'.
Re: AUTHOR default setting in h2xs
by Anonymous Monk on Feb 26, 2018 at 22:00 UTC
    Um... Anyway you ice it ... anything you use there Will be editing youll have to do... module-starter ,dzil...

    my ($email,$author,$licence); eval { my $username; ($username,$author) = (getpwuid($>))[0,6]; if (defined $username && defined $author) { $author =~ s/,.*$//; # in case of sub fields my $domain = $Config{'mydomain'}; $domain =~ s/^\.//; $email = "$username\@$domain"; } }; $author =~ s/'/\\'/g if defined $author; $author ||= "A. U. Thor"; $email ||= 'a.u.thor@a.galaxy.far.far.away';

      Thanks for the insight. So, that domain was compiled into Config.pm, presumably by some Apple developer? And the only way I can change it, other than editing each instance of Makefile.PL, is to recompile Perl? Is that right? sd.apple.com could be some internal Apple domain that the developers use, sd for software development. Just a guess. It would be so cool if Config.pm used something like .configrc or .config_profile to specify configuration variables, particularly those that are of interest to Perl users rather that Perl builders.

        And the only way I can change it, other than editing each instance of Makefile.PL, is to recompile Perl? Is that right?

        No - if it's set in Config.pm, amending that setting to whatever you want should be all that's needed.
        In Windows, it's specified only in lib/Config_heavy.pl. I don't know which file(s) specify it in MacOS but I expect it would be lib/Config.pm and/or lib/Config_heavy.pl (if the latter even exists on MacOS).

        For a quick check to see what it's set to you can just run perl -V:Author

        Cheers,
        Rob

        So, that domain was compiled into Config.pm, presumably by some Apple developer? And the only way I can change it, other than editing each instance of Makefile.PL, is to recompile Perl? Is that right?

        Not important. No, that isn't right.

        It would be so cool if Config.pm used something like .configrc or .config_profile to specify configuration variables, particularly those that are of interest to Perl users rather that Perl builders.

        No.

        Maybe you can take a minute and read the documentation for Config to figure out its purpose.

        If you're making modules you're gonna have to edit Makefile.PL no matter the tools you use, as as you're going to have to edit any .xs files, or .pm files.

        h2xs is just a template/stubber.

        h2xs is not an IDE (integrated development environment).

        That h2xs pluck host out of %Config tells you how old it is and who wrote it (its the guy who wrote perl itself).