| 1 | |||
| 2 | =head1 NAME | ||
| 3 | |||
| 4 | WebService::UMLSKS::GetUserData - Get username and password from the user. | ||
| 5 | |||
| 6 | =head1 SYNOPSIS | ||
| 7 | |||
| 8 | =head2 Basic Usage | ||
| 9 | |||
| 10 | use WebService::UMLSKS::GetUserData; | ||
| 11 | |||
| 12 | my $getinfo = new GetUserData; | ||
| 13 | my $verbose = 1; | ||
| 14 | $service = $getinfo -> getUserDetails($verbose); | ||
| 15 | |||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This module has package GetUserData which has two subroutines 'new' and 'getUserDetails'. | ||
| 20 | This module takes the username and password from user and passes them to authenticate module for authentication. | ||
| 21 | It gets back a valid proxy ticket if the user is valid or an invalid $service object from the authenticate module. | ||
| 22 | Then it returns the $service object to the calling program (getUMLSInfo.pl). | ||
| 23 | |||
| 24 | =head1 SUBROUTINES | ||
| 25 | |||
| 26 | The subroutines are as follows: | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | ############################################################################### | ||
| 31 | ########## CODE STARTS HERE ################################################# | ||
| 32 | |||
| 33 | |||
| 34 | #use lib "/home/mugdha/UMLS-HSO/UMLS-HSO/WebService-UMLSKS-Similarity/lib"; | ||
| 35 | |||
| 36 | use WebService::UMLSKS::ConnectUMLS; | ||
| 37 | #use authenticate_user; | ||
| 38 | use warnings; | ||
| 39 | use strict; | ||
| 40 | no warnings qw/redefine/; | ||
| 41 | |||
| 42 | #use lib "/home/mugdha/workspace/getInfo"; | ||
| 43 | |||
| 44 | package WebService::UMLSKS::GetUserData; | ||
| 45 | |||
| 46 | =head2 new | ||
| 47 | |||
| 48 | This sub creates a new object of GetUserData. | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | sub new { | ||
| 53 | my $class = shift; | ||
| 54 | my $self = {}; | ||
| 55 | bless( $self, $class ); | ||
| 56 | return $self; | ||
| 57 | } | ||
| 58 | |||
| 59 | use Term::ReadKey; | ||
| 60 | |||
| 61 | =head2 getUserDetails | ||
| 62 | |||
| 63 | This sub takes username and password from user through command prompt. | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | sub getUserDetails { | ||
| 68 | my $self = shift; | ||
| 69 | my $verbose = shift; | ||
| 70 | my $username = ""; | ||
| 71 | my $pwd = ""; | ||
| 72 | |||
| 73 | # Get username and password to authenticate. | ||
| 74 | print "Enter username to connect to UMLSKS:"; | ||
| 75 | $username = <>; | ||
| 76 | chomp $username; | ||
| 77 | |||
| 78 | print "Enter password:"; | ||
| 79 | ReadMode 'noecho'; | ||
| 80 | $pwd = ReadLine 0; | ||
| 81 | ReadMode 'normal'; | ||
| 82 | chomp $pwd; | ||
| 83 | $self->getService($verbose,$username,$pwd); | ||
| 84 | |||
| 85 | } | ||
| 86 | |||
| 87 | =head2 getService | ||
| 88 | |||
| 89 | This sub returns a service object after it authenticates the user with the help | ||
| 90 | of authenticate module. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | sub getService | ||
| 95 | { | ||
| 96 | my $self = shift; | ||
| 97 | my $verbose = shift; | ||
| 98 | my $username = shift; | ||
| 99 | my $pwd = shift; | ||
| 100 | my $c = WebService::UMLSKS::ConnectUMLS->new; | ||
| 101 | my $service = $c->connect_umls( $username, $pwd, $verbose ); | ||
| 102 | return $service; | ||
| 103 | |||
| 104 | } | ||
| 105 | |||
| 106 | 1; | ||
| 107 | |||
| 108 | #-------------------------------PERLDOC STARTS HERE------------------------------------------------------------- | ||
| 109 | |||
| 110 | |||
| 111 | =head1 SEE ALSO | ||
| 112 | |||
| 113 | ValidateTerm.pm ConnectUMLS.pm Query.pm ws-getUMLSInfo.pl | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | =head1 AUTHORS | ||
| 118 | |||
| 119 | Mugdha Choudhari, University of Minnesota Duluth | ||
| 120 | E<lt>chou0130 at d.umn.eduE<gt> | ||
| 121 | |||
| 122 | Ted Pedersen, University of Minnesota Duluth | ||
| 123 | E<lt>tpederse at d.umn.eduE<gt> | ||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | =head1 COPYRIGHT | ||
| 129 | |||
| 130 | Copyright (C) 2011, Mugdha Choudhari, Ted Pedersen | ||
| 131 | |||
| 132 | This program is free software; you can redistribute it and/or modify | ||
| 133 | it under the terms of the GNU General Public License as published by | ||
| 134 | the Free Software Foundation; either version 2 of the License, or (at | ||
| 135 | your option) any later version. | ||
| 136 | |||
| 137 | This program is distributed in the hope that it will be useful, but | ||
| 138 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 139 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 140 | General Public License for more details. | ||
| 141 | |||
| 142 | You should have received a copy of the GNU General Public License | ||
| 143 | along with this program; if not, write to | ||
| 144 | The Free Software Foundation, Inc., | ||
| 145 | 59 Temple Place - Suite 330, | ||
| 146 | Boston, MA 02111-1307, USA. | ||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | #---------------------------------PERLDOC ENDS HERE--------------------------------------------------------------- |