Brent B. Powers > Sybase-Login > Sybase::Login

Download:
Sybase-Login-1.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.4   Source  

NAME ^

Sybase::Login - A highly configurable Login widget for Sybperl and Perl/Tk

Change History ^

DESCRIPTION ^

Login is a Widget that presents a dialog box to the user so that the user may enter his or her login name and password, as well as select the appropriate database and server.

USAGE ^

One uses Login by creating a new Login widget, adding at least one Database via the addDatabase method, configuring via the configure method, and then getting a valid login via the getVerification method.

Sample Program

Operation

The user is presented with a dialog box. The focus is on the username entry if no user name has been configured; otherwise, it is on the password entry. If multiple databases have been configured, the user may select the appropriate database from the menu button. If multiple servers have been configured for the selected database, the user may select the appropriate server from the menu button.

When the user has finished entering information, she may press the OK button to attempt to login, or the cancel button to abort the process. If the user presses the OK button, and the login succeeds, control returns to the caller. If the login fails, an error dialog box is displayed, and the user may press retry, or may press cancel, in which case control returns to the caller exactly as if the user had pressed cancel at the main login screen.

When control returns to the caller, the return value will be 1 if the login was successful, or 0 if not.

Notes

A caller may define a message or error handler either before or after calling any of the methods of this object. getCurrentVerification will restore the handlers extant when invoked.

Methods ^

getCurrentVerification

$Login->getCurrentVerification;

(No parameters)

return 1 if the current configuration will result in a valid login, 0 otherwise. No GUI is ever displayed.

getVerification

$Login->getVerification(-Force = ?);>

If the current configuration is NOT valid, activate the login frame. This will return 1 with a valid configuration, or 0 if the user hit cancel. If the -Force parameter is passed as 't', 'y', or 1, the login frame will be activated even if the current configuration is valid.

addDatabase

$Login->addDatabase(Database, Server List);

adds a database/server set. The first parameter is the name of the database, the second is a list of Associated Servers. See the code above for examples.

Note that the first server in the list is the default server for that database. Further note that adding a database a second time simply alters the servers.

clearDatabase

$Login->clearDatabase([Database[, Database,...]]);

Clears the given Database entries, or all databases if if none are specified.

Version

$Login->Version

(No parameters)

Returns the current version of Login

Configuration Items ^

Any of the following configuration items may be set via the configure method, or retrieved via the cget method.

-User

Set or get the username. The default is blank.

-Password

Set or get the password. The default is blank.

-Title

Set or get the Title of the Login Widget. The default is 'Database Login'

-Database

Set or get the default Database. The default is blank. The call will silently fail if the database is not configured via the AddDatabase method. If the configured server is not a valid server for the given database, the server will be set to the default server for the database.

-Server

Set or get the default Server. The default is blank. The call will silently fail if the server is not a valid server for the currently configured database.

-OKText

Set or get the text for the OK button. The default is OK.

-CancelText

Set or get the text for the Cancel button. The default is Cancel.

-ULabel

Set or get the label for the User name entry. The default is 'User:'.

-PLabel

Set or get the label for the Password entry. The default is 'Password:'.

-DLabel

Set or get the label for the Database Menu Button. The default is 'Database:'.

-SLabel

Set or get the label for the Server Menu Button. The default is 'Server:'.

-Labelfont

Set or get the font used for the labels. The default is '-Adobe-Courier-Bold-R-Normal--*-120-*'.

-EDlgTitle

Set or get the Title for the Error Dialog. The default is 'Database Login Error!'.

-EDlgText

Set or get the text displayed in the Error Dialog. The default is 'Unable to login to $db at $srv'. $db will be interpreted as the Database name, $srv will be interpreted as the Server name, $usr will be interpreted as the User name, and $pwd will be interpreted as the password.

-EDlgRetry

Set or get the text for the Retry button in the Error Dialog. The default is 'Retry'.

-EDlgCancel

Set or get the text for the Cancel button in the Error Dialog. The default is 'Cancel'.

-presentDBMenu

If set False, do not display the database menu. The database will be as configured, or default. Default is True.

-presentSrvMenu

If set False, do not display the server menu. The Server will be as configured, or default for the database. Default is True.

Author ^

Brent B. Powers, B2Pi

Currently on-site at Merrill Lynch, powers@ml.com

This code may be distributed under the same conditions as perl itself.

syntax highlighting: