| 1 | #!/usr/bin/env perl | ||
| 2 | # ABSTRACT: Run Statocles commands | ||
| 3 | package statocles; | ||
| 4 | 3 | our $VERSION = '0.099'; | |
| 5 | |||
| 6 | 3 | ▶ | use Statocles::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use Encode qw( decode ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | ▶ | use Encode::Locale; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 3 | ▶ | use open qw( :std :locale ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 3 | ▶ | use POSIX qw( setlocale LC_ALL ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | # Mojolicious::Commands currently calls GetOptions and clobbers a few of | ||
| 13 | # our command-line options. Since I don't want to rely on the envvars | ||
| 14 | # that get set in that process, we'll do this little dance here. | ||
| 15 | # | ||
| 16 | # This happens because we build a Mojolicious app inside the Statocles::Command | ||
| 17 | # module, which loads Mojolicious, which loads Mojolicious::Commands, which | ||
| 18 | # calls GetOptions on @ARGV | ||
| 19 | 3 | my @argv; | |
| 20 | 3 | ▶ | BEGIN { @argv = map { decode( locale => $_ ) } @ARGV }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 3 | binmode STDIN, ":encoding(locale)"; | |
| 23 | 3 | binmode STDOUT, ":encoding(locale)"; | |
| 24 | 3 | binmode STDERR, ":encoding(locale)"; | |
| 25 | |||
| 26 | 3 | ▶ | use Statocles; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 3 | exit Statocles->run( @argv ); | |
| 28 | |||
| 29 | __END__ | ||