diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-19 18:38:45 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-01-19 18:38:45 +0000 |
commit | 36e4dcac8ecdefa80f313a8484d072d2deab22c9 (patch) | |
tree | e5a72eadcb2a0396f9016f58959aa25a0ed26cf6 /gurpmi.pm | |
parent | c0dfc0a91dbfa65abf0ff0080ac73362fc942ac7 (diff) | |
download | urpmi-36e4dcac8ecdefa80f313a8484d072d2deab22c9.tar urpmi-36e4dcac8ecdefa80f313a8484d072d2deab22c9.tar.gz urpmi-36e4dcac8ecdefa80f313a8484d072d2deab22c9.tar.bz2 urpmi-36e4dcac8ecdefa80f313a8484d072d2deab22c9.tar.xz urpmi-36e4dcac8ecdefa80f313a8484d072d2deab22c9.zip |
Factorize some code in a new module
Diffstat (limited to 'gurpmi.pm')
-rw-r--r-- | gurpmi.pm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gurpmi.pm b/gurpmi.pm new file mode 100644 index 00000000..404282c5 --- /dev/null +++ b/gurpmi.pm @@ -0,0 +1,34 @@ +package gurpmi; + +#- This is needed because text printed by Gtk2 will always be encoded +#- in UTF-8; we first check if LC_ALL is defined, because if it is, +#- changing only LC_COLLATE will have no effect. +use POSIX qw(setlocale LC_ALL LC_COLLATE); +use locale; +BEGIN { + my $collation_locale = $ENV{LC_ALL}; + if ($collation_locale) { + $collation_locale =~ /UTF-8/ or setlocale(LC_ALL, "$collation_locale.UTF-8"); + } else { + $collation_locale = setlocale(LC_COLLATE); + $collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8"); + } +} + +use urpm; + +sub usage () { + print STDERR <<USAGE; +gurpmi version $urpm::VERSION +Usage : + gurpmi <rpm> [ <rpm>... ] +USAGE + exit 0; +} + +#- fatal gurpmi initialisation error (*not* fatal urpmi errors) +sub fatal { print STDERR "$_[0]\n"; exit 1 } + +sub but ($) { " $_[0] " } + +1; |