Firefox-Marionette

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

        }
        use warnings;
        if ( defined $value ) {
            $value =~ s/\0$//smx;
        }
    }
    return $value;
}

if ( ( $OSNAME eq 'MSWin32' ) || ( $OSNAME eq 'cygwin' ) ) {
}
elsif ( $EFFECTIVE_USER_ID == 0 ) {    # see RT#131304
    my $current = $ENV{HOME};
    my $correct = ( getpwuid $EFFECTIVE_USER_ID )[7];
    if ( $current eq $correct ) {
    }
    else {
        $ENV{HOME} = $correct;
        warn
"Running as root.  Resetting HOME environment variable from $current to $ENV{HOME}\n";
    }
    foreach my $env_name (
				'XAUTHORITY',           # see GH#1
				'XDG_RUNTIME_DIR',      # see GH#33
                         ) {
        if ( exists $ENV{$env_name} ) {
            delete $ENV{$env_name};
            warn "Running as root.  Deleting the $env_name environment variable\n";
        }
    }
}

my @possibles = qw(firefox waterfox basilisk);
my $dev_null  = File::Spec->devnull();

sub last_desperate_search {
    if ( ( $OSNAME eq 'MSWin32' ) ) {
        foreach my $possible (@possibles) {
            my $output = `"$possible.exe" -version`;
            if ($output) {
                warn
                  "Version of $possible in Path environment variable:$output";
            }
            else {
                warn "No $possible in Path environment variable";
            }
        }
    }
    elsif ( ( $OSNAME eq 'darwin' ) or ( $OSNAME eq 'cygwin' ) ) {
        foreach my $possible (@possibles) {
            my $output = `$possible -version`;
            if ($output) {
                warn
                  "Version of $possible in PATH environment variable:$output";
            }
            else {
                warn "No $possible in PATH environment variable";
            }
        }
    }
    my $glob_path = '/usr/share/applications/firefox*.desktop';
    foreach my $path ( glob $glob_path ) {
        warn
`$EXECUTABLE_NAME -nle 'print "\$ARGV:\$_" if (/(Exec|^\\[)/);' $path`;
    }
    return;
}

my $binary;    #                      = 'firefox';
my $suffix =
  ( ( $OSNAME eq 'MSWin32' ) || ( $OSNAME eq 'cygwin' ) ) ? '.exe' : q[];
my %known_win32_preferred_names = (
    'Mozilla Firefox'           => 1,
    'Mozilla Firefox ESR'       => 2,
    'Firefox Developer Edition' => 3,
    Nightly                     => 4,
    'Waterfox'                  => 5,
    'Waterfox Current'          => 6,
    'Waterfox Classic'          => 7,
    Basilisk                    => 8,
    'Pale Moon'                 => 9,
);
my %_known_win32_organisations = (
    'Mozilla Firefox'           => 'Mozilla',
    'Mozilla Firefox ESR'       => 'Mozilla',
    'Firefox Developer Edition' => 'Mozilla',
    Nightly                     => 'Mozilla',
    'Waterfox'                  => 'Waterfox',
    'Waterfox Current'          => 'Waterfox',
    'Waterfox Classic'          => 'Waterfox',
    Basilisk                    => 'Mozilla',
    'Pale Moon'                 => 'Mozilla',
);
my $version_regex = qr/(\d+)[.](\d+(?:\w\d+)?)(?:[.](\d+))?/smx;
my $version_string;
if ( $OSNAME eq 'MSWin32' ) {
  NAME: foreach my $name (
        sort {
            $known_win32_preferred_names{$a}
              <=> $known_win32_preferred_names{$b}
        } keys %known_win32_preferred_names
      )
    {
      ROOT_SUBKEY:
        foreach my $root_subkey ( ['SOFTWARE'], [ 'SOFTWARE', 'WOW6432Node' ] )
        {
            my $organisation = $_known_win32_organisations{$name};
            my ($version) = _win32_registry_query_key(
                subkey => [ 'HKLM', @{$root_subkey}, $organisation, $name ],
                name   => 'CurrentVersion'
            );
            if ( !defined $version ) {
                next ROOT_SUBKEY;
            }
            my ($initial_version) = _win32_registry_query_key(
                subkey => [ 'HKLM', @{$root_subkey}, $organisation, $name ],
                name   => q[]    # (Default) value
            );
            my $name_for_path_to_exe = $name;
            $name_for_path_to_exe =~ s/[ ]ESR//smx;
            my ($path) = _win32_registry_query_key(



( run in 0.627 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )