Source

perl/keyring/kdewallet / lib / Passwd / Keyring / KDEWallet.pm

Diff from to

lib/Passwd/Keyring/KDEWallet.pm

 
 =head2 new(app=>'app name', group=>'passwords folder')
 
-Initializes the processing. Croaks if kwallet does not 
+Initializes the processing. Croaks if kwallet (or d-bus, or anything needed) does not 
 seem to be available.
 
 Handled named parameters: 
     #$self->{bus} = Net::DBus->find()
     $self->{bus} = Net::DBus->session()
       or croak("KWallet not available (can't access DBus)");
-    my $kwallet_svc = $self->{bus}->get_service('org.kde.kwalletd')
-      or croak("KWallet not available (can't access KWallet, likely kwalletd not running)");
+    # get_service also may fail by itself, I got cpantesters reports with message
+    # "org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.kwalletd was not provided by any .service files"
+    # Let's rewrite this slightly
+    my$kwallet_svc;
+    eval {
+        $kwallet_svc = $self->{bus}->get_service('org.kde.kwalletd');
+    };
+    if($@) {
+        croak("KWallet not available (not installed?). Details:\n$@");
+    } elsif (! $kwallet_svc) {
+        croak("KWallet not available (can't access KWallet, likely kwalletd not running)");
+    }
     $self->{kwallet} = $kwallet_svc->get_object('/modules/kwalletd', 'org.kde.KWallet')
       or croak("Kwallet not available (can't find wallet)");
     $self->_open_if_not_open();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.