Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I've often wanted to know when people install one of my modules. Do you have a suggestion of a good way to do it? I was thinking of something like:
    local $SIG{ALARM} = sub { die "alarm" };
    print "[This question will timeout in 5 seconds and default to 'No']\n";
    my $val = eval { prompt("Send message to module author that you installed $module?", "Y") };
    $val = "N" if $@;
    if ($val =~ /^Y/i) {
    Would that be reasonable?
    • It might be reasonable if alarm() was portable!

      On the other hand, tracking users is probably as futile as web hit counters.
      • I thought the non-portability of alarm() was a solved problem? At least for simple cases like reading STDIN.
        • Well, as far as I know, alarm() doesn't work on win32. But I may well be wrong since I haven't tried it for some time.
    • I'd feel a lot more comfortable with that, but there's a better way. If you're using ExtUtil::MakeMaker (and I believe Module::Build offers the same functionality), then you can force a default if not running interactively. From the docs []:

      If prompt() detects that it is not running interactively and there is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable is set to true, the $default will be used without prompting. This prevents automated processes from blocking on user input.

      • Interesting. But I'd almost *rather* the user could choose even under the CPAN shell to not send the info (but still have the default be 'Y'). Hence the alarm() so that it only blocks for 5 seconds.
    • A year or so ago I thrashed out a solution with #perl that sucked as little as possible, and was the least annoying thing we could come up with. []

      Whenever anyone asks about CPAN statistics or phone home implmentations, I point them at that.

      Although I have to say adding the idea of UDP is interesting and probably would add some value to it.
      • Adam, I like the idea. I think it is well thought out and deserves to be pushed. My only suggestion, as a tip o' the hat to the FOAD crowd is that it the setting should default to 'never', not 'ask'.

        The question can be asked the next time the config process is run, but defaulting to 'ask' is wrong, since you're now adding a new hoop to jump through by default, where none existed before.