#!/usr/bin/perl

=for Copyright
 .
 Copyright (c) 2008-2015 Bruce Ravel (L<http://bruceravel.github.io/home>).
 All rights reserved.
 .
 This file is free software; you can redistribute it and/or
 modify it under the same terms as Perl itself. See The Perl
 Artistic License.
 .
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

=cut

BEGIN {
  ## munge the PATH env. var. under Windows, also add useful debugging
  ## info to the log file
  if (($^O eq 'MSWin32') or ($^O eq 'cygwin')) {
    # print  STDOUT "PATH was:$/\t$ENV{PATH}$/$/";
    my $newpath = q{C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;C:\strawberry\c\bin\gnuplot\bin;};
    $ENV{PATH} = $newpath;
    # print  STDOUT "PATH reset to:$/$newpath$/$/";

    # if ($ENV{PATH} =~ m{mingw}i) {
    #   my @list = split(/;/, $ENV{PATH});
    #   my (@mingw, @not);
    #   foreach my $p (@list) {
    # 	if ($p =~ m{mingw}i) {push @mingw, $p} else {push @not, $p};
    #   };
    #   $ENV{PATH} = join(';', @not, @mingw);
    # };
  };
};

use Getopt::Long;
my $wx = 0;
my $result = GetOptions ("wx" => \$wx,);

use Demeter qw(:none);
use PDL;
use PDL::Stats;
print Demeter->new->module_environment;
print Demeter->new->wx_environment if ($wx);


=head1 NAME

denv - Display Demeter's operating environment

=head1 VERSION

This documentation refers to Demeter version 0.9.22.

=head1 DESCRIPTION

This simple tool calls the C<module_environment> method and prints
it's output to the screen.  It's sole purpose in life is as a
diagnostic tool for understanding the environment in which Demeter is
running.

=head1 OPTIONS

=over 4

=item C<--wx>

Append information about Wx and WxPerl to the report.

=back

=head1 AUTHOR

Bruce Ravel (L<http://bruceravel.github.io/home>)

http://bruceravel.github.io/demeter/


=head1 LICENCE AND COPYRIGHT

Copyright (c) 2008-2009 Bruce Ravel (L<http://bruceravel.github.io/home>). All rights reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlgpl>.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

=cut
