From 9b88b0f0b850e8be76b65a5025c324fa6d85c0d2 Mon Sep 17 00:00:00 2001 From: Alexandr Ciornii Date: Sat, 25 Mar 2017 12:42:36 +0200 Subject: [PATCH] Windows has USERNAME environment variable instead of USER --- bin/cfgver | 4 ++-- lib/Config/Versioned.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cfgver b/bin/cfgver index b238085..e55e1b1 100755 --- a/bin/cfgver +++ b/bin/cfgver @@ -156,8 +156,8 @@ $params{dbpath} = $opt_dbpath if $opt_dbpath; $params{version} = $opt_version if $opt_version; $params{commit_time} = DateTime->now; -$params{author_name} = $opt_authorname || $ENV{USER}; -$params{author_mail} = $opt_authormail || $ENV{USER} . '@localhost'; +$params{author_name} = $opt_authorname || $ENV{USER} || $ENV{USERNAME}; +$params{author_mail} = $opt_authormail || ($ENV{USER} || $ENV{USERNAME}). '@localhost'; if ( $command eq 'version' ) { my $cfg = Config::Versioned->new( \%params ); diff --git a/lib/Config/Versioned.pm b/lib/Config/Versioned.pm index e02803e..329f1c5 100644 --- a/lib/Config/Versioned.pm +++ b/lib/Config/Versioned.pm @@ -36,7 +36,7 @@ has 'author_name' => ( is => 'ro', isa => 'Str', default => "process: $@" ); has 'author_mail' => ( is => 'ro', isa => 'Str', - default => $ENV{GIT_AUTHOR_EMAIL} || $ENV{USER} . '@localhost' + default => $ENV{GIT_AUTHOR_EMAIL} || ($ENV{USER} || $ENV{USERNAME}). '@localhost' ); has 'autocreate' => ( is => 'ro', isa => 'Bool', default => 0 ); has 'commit_time' => ( is => 'ro', isa => 'DateTime' );