Marcin Kasperski > Passwd-Keyring-Gnome-0.2502 > Passwd::Keyring::Gnome



Annotate this POD


View/Report Bugs
Module Version: 0.2502   Source   Latest Release: Passwd-Keyring-Gnome-0.3003


Passwd::Keyring::Gnome - Password storage implementation based on GNOME Keyring.


Version 0.2502


Gnome Keyring based implementation of Keyring. Provide secure storage for passwords and similar sensitive data.

    use Passwd::Keyring::Gnome;

    my $keyring = Passwd::Keyring::Gnome->new(
         app=>"blahblah scraper",
         group=>"Johnny web scrapers",

    my $username = "John";  # or get from .ini, or from .argv...

    my $password = $keyring->get_password($username, "");
    unless( $password ) {
        $password = <somehow interactively prompt for password>;

        # securely save password for future use
        $keyring->set_password($username, "");

    login_somewhere_using($username, $password);
    if( password_was_wrong ) {
        $keyring->clear_password($username, "");

Note: see Passwd::Keyring::Auto::KeyringAPI for detailed comments on keyring method semantics (this document is installed with Passwd::Keyring::Auto package).


new(app=>'app name', group=>'passwords folder')

Initializes the processing. Croaks if gnome keyring does not seem to be available.

Handled named parameters:

- app - symbolic application name (not used at the moment, but can be used in future as comment and in prompts, so set sensibly)

- group - name for the password group (will be visible in seahorse so can be used by end user to manage passwords, different group means different password set, a few apps may share the same group if they need to use the same passwords set)

set_password(username, password, domain)

Sets (stores) password identified by given domain for given user

get_password($user_name, $domain)

Reads previously stored password for given user in given app. If such password can not be found, returns undef.

clear_password($user_name, $domain)

Removes given password (if present)

Returns how many passwords actually were removed


Returns info, whether this keyring actually saves passwords persistently.

(true in this case)


Marcin Kasperski


Please report any bugs or feature requests to issue tracker at


You can find documentation for this module with the perldoc command.

    perldoc Passwd::Keyring::Gnome

You can also look for information at:

Source code is tracked at:


Copyright 2012 Marcin Kasperski.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: