From 189b85e09c80c886e37eab515b25525a45b4a4c2 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Tue, 21 Jul 2015 11:57:55 +0200 Subject: removed you dependency form backends, left in Shared only atm. if localization is changed from default has to be passed to constructor now --- lib/ManaTools/Module/Clock.pm | 3 ++- lib/ManaTools/Module/Services.pm | 2 +- lib/ManaTools/Module/Users.pm | 2 +- lib/ManaTools/Shared.pm | 2 +- lib/ManaTools/Shared/Services.pm | 13 +++---------- lib/ManaTools/Shared/TimeZone.pm | 17 +++++------------ lib/ManaTools/Shared/Users.pm | 14 ++++---------- lib/ManaTools/Shared/urpmi_backend/tools.pm | 19 ++++++------------- 8 files changed, 23 insertions(+), 49 deletions(-) (limited to 'lib') diff --git a/lib/ManaTools/Module/Clock.pm b/lib/ManaTools/Module/Clock.pm index 35dd603..615eb62 100644 --- a/lib/ManaTools/Module/Clock.pm +++ b/lib/ManaTools/Module/Clock.pm @@ -91,7 +91,8 @@ has 'sh_tz' => ( sub _SharedTimeZoneInitialize { my $self = shift; - $self->sh_tz(ManaTools::Shared::TimeZone->new() ); + $DB::single = 1; + $self->sh_tz(ManaTools::Shared::TimeZone->new(loc => $self->loc) ); } diff --git a/lib/ManaTools/Module/Services.pm b/lib/ManaTools/Module/Services.pm index b54bfba..72e342a 100644 --- a/lib/ManaTools/Module/Services.pm +++ b/lib/ManaTools/Module/Services.pm @@ -145,7 +145,7 @@ has 'sh_services' => ( sub _SharedServicesInitialize { my $self = shift(); - $self->sh_services(ManaTools::Shared::Services->new() ); + $self->sh_services(ManaTools::Shared::Services->new(loc => $self->loc) ); } diff --git a/lib/ManaTools/Module/Users.pm b/lib/ManaTools/Module/Users.pm index 0c4b1b0..4339202 100644 --- a/lib/ManaTools/Module/Users.pm +++ b/lib/ManaTools/Module/Users.pm @@ -156,7 +156,7 @@ has 'sh_users' => ( sub _SharedUsersInitialize { my $self = shift(); - $self->sh_users(ManaTools::Shared::Users->new() ); + $self->sh_users(ManaTools::Shared::Users->new(loc => $self->loc) ); } has 'sh_gui' => ( diff --git a/lib/ManaTools/Shared.pm b/lib/ManaTools/Shared.pm index 2059789..ddd2021 100644 --- a/lib/ManaTools/Shared.pm +++ b/lib/ManaTools/Shared.pm @@ -87,7 +87,6 @@ use feature 'state'; use Digest::MD5; -use yui; use base qw(Exporter); our @EXPORT_OK = qw( @@ -397,6 +396,7 @@ sub isProcessRunning { #============================================================= sub command_line() { + require yui; state $cmdline = new yui::YCommandLine; return $cmdline; diff --git a/lib/ManaTools/Shared/Services.pm b/lib/ManaTools/Shared/Services.pm index b2dc5db..7db8393 100644 --- a/lib/ManaTools/Shared/Services.pm +++ b/lib/ManaTools/Shared/Services.pm @@ -72,25 +72,18 @@ use ManaTools::Shared::RunProgram qw(rooted); has 'loc' => ( is => 'rw', - init_arg => undef, - builder => '_localeInitialize' + isa => 'ManaTools::Shared::Locales', + lazy => 1, + builder => '_localeInitialize', ); sub _localeInitialize { my $self = shift; - my $cmdline = new yui::YCommandLine; - my $locale_dir = undef; - my $pos = $cmdline->find("--locales-dir"); - if ($pos > 0) - { - $locale_dir = $cmdline->arg($pos+1); - } $self->loc( ManaTools::Shared::Locales->new( domain_name => 'manatools', - dir_name => $locale_dir, ) ); } diff --git a/lib/ManaTools/Shared/TimeZone.pm b/lib/ManaTools/Shared/TimeZone.pm index a380a69..744e7f9 100644 --- a/lib/ManaTools/Shared/TimeZone.pm +++ b/lib/ManaTools/Shared/TimeZone.pm @@ -336,26 +336,19 @@ sub _servername_config_suffix_init { } has 'loc' => ( - is => 'rw', - lazy => 1, - init_arg => undef, - builder => '_localeInitialize' + is => 'rw', + isa => 'ManaTools::Shared::Locales', + lazy => 1, + builder => '_localeInitialize', ); + sub _localeInitialize { my $self = shift; - my $cmdline = new yui::YCommandLine; - my $locale_dir = undef; - my $pos = $cmdline->find("--locales-dir"); - if ($pos > 0) - { - $locale_dir = $cmdline->arg($pos+1); - } $self->loc( ManaTools::Shared::Locales->new( domain_name => 'manatools', - dir_name => $locale_dir, ) ); } diff --git a/lib/ManaTools/Shared/Users.pm b/lib/ManaTools/Shared/Users.pm index d9091fb..900819e 100644 --- a/lib/ManaTools/Shared/Users.pm +++ b/lib/ManaTools/Shared/Users.pm @@ -110,29 +110,23 @@ has 'user_face_dir' => ( has 'loc' => ( is => 'rw', - init_arg => undef, - builder => '_localeInitialize' + isa => 'ManaTools::Shared::Locales', + lazy => 1, + builder => '_localeInitialize', ); sub _localeInitialize { my $self = shift; - my $cmdline = new yui::YCommandLine; - my $locale_dir = undef; - my $pos = $cmdline->find("--locales-dir"); - if ($pos > 0) - { - $locale_dir = $cmdline->arg($pos+1); - } $self->loc( ManaTools::Shared::Locales->new( domain_name => 'manatools', - dir_name => $locale_dir, ) ); } + ## Used by USER (for getting values? TODO need explanations, where?) has 'USER_GetValue' => ( default => -65533, diff --git a/lib/ManaTools/Shared/urpmi_backend/tools.pm b/lib/ManaTools/Shared/urpmi_backend/tools.pm index 05768c9..4997f58 100644 --- a/lib/ManaTools/Shared/urpmi_backend/tools.pm +++ b/lib/ManaTools/Shared/urpmi_backend/tools.pm @@ -95,26 +95,19 @@ sub _urpmi_db_backend_init { has 'loc' => ( - is => 'rw', - lazy => 1, - init_arg => undef, - builder => '_localeInitialize' + is => 'rw', + isa => 'ManaTools::Shared::Locales', + lazy => 1, + builder => '_localeInitialize', ); + sub _localeInitialize { my $self = shift; - my $cmdline = new yui::YCommandLine; - my $locale_dir = undef; - my $pos = $cmdline->find("--locales-dir"); - if ($pos > 0) - { - $locale_dir = $cmdline->arg($pos+1); - } $self->loc( ManaTools::Shared::Locales->new( domain_name => 'manatools', - dir_name => $locale_dir, ) ); } @@ -351,7 +344,7 @@ sub get_package_id { #============================================================= -=head2 get_package_id +=head2 pkg2medium =head3 INPUT -- cgit v1.2.1