| 1 | package MyLibrary::Interface::User; | ||
| 2 | |||
| 3 | use MyLibrary::DB; | ||
| 4 | use base qw(MyLibrary::Interface); | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | MyLibrary::Interface::User | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | use MyLibrary::Interface::User; | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | Modular user interface components for MyLibrary. | ||
| 17 | |||
| 18 | =head1 EXPORT | ||
| 19 | |||
| 20 | Few methods will be exported. | ||
| 21 | |||
| 22 | =head1 METHODS | ||
| 23 | |||
| 24 | Most of the methods employed here are class methods. However, class objects are created with | ||
| 25 | embedded attributes. | ||
| 26 | |||
| 27 | =head1 new_account_interface(\%attr) | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | use strict; | ||
| 32 | |||
| 33 | sub new_account_interface { | ||
| 34 | my ($class, %opts) = @_; | ||
| 35 | my $self = {}; | ||
| 36 | $self->{type} = 'new_account'; | ||
| 37 | if (%opts) { | ||
| 38 | foreach my $key (sort keys %opts) { | ||
| 39 | $self->{$key} = $opts{$key}; | ||
| 40 | } | ||
| 41 | } | ||
| 42 | return bless $self, $class; | ||
| 43 | } # end sub new_account | ||
| 44 | |||
| 45 | =head1 login_interface(\%attr) | ||
| 46 | |||
| 47 | =cut | ||
| 48 | sub login_interface { | ||
| 49 | my $dbh = MyLibrary::DB->dbh(); | ||
| 50 | my $q = qq(SELECT * FROM interface where name='login'); | ||
| 51 | my $interface = $dbh->selectrow_hashref($q); | ||
| 52 | my $class = shift; | ||
| 53 | my $self = { | ||
| 54 | username => '1', | ||
| 55 | password => '1', | ||
| 56 | html => $interface->{'html'}, | ||
| 57 | @_ | ||
| 58 | }; | ||
| 59 | return bless $self, $class; | ||
| 60 | } # end sub login | ||
| 61 | |||
| 62 | 1; |