- or download this
#This is file: Users.pm
...
Users->columns(All => qw/id username password created/);
1;
- or download this
#This is file: my_prog.pl
...
);
say $user1->username; #Joe
- or download this
my $id = 1;
my $user = Users->retrieve($id);
say $user->username; #Joe
- or download this
my $user2 = Users->insert(
{
...
}
);
- or download this
my @users = Users->retrieve_all;
...
Jim
456
2013-02-02 00:12:00
- or download this
for my $user (@users) {
printf "%s %s %s \n",
...
--output:--
Joe 123 2013-02-02 00:12:00
Jim 456 2013-02-02 00:12:00
- or download this
$user2->username("Kathy");
$user2->update;
- or download this
$user1->delete;
- or download this
#This is file: MyDBIDatabase.pm
...
#Format is: (dbi:<database_type>:<db_name>, <username>, <password>)
1; #Don't forget this!
- or download this
#This is file: Users.pm
...
Users->columns(All => qw/id username password created/);
1;
- or download this
#This is file: MyApp/MyDBIDatabase.pm
...
#Format is: (dbi:<database_type>:<db_name>, <username>, <password>)
1; #Don't forget this!
- or download this
#This is file: MyApp/Users.pm
...
MyApp::Users->columns(All => qw/id username password created/);
1;
- or download this
#This is file: my_prog.pl
...
#Same as my_prog.pl above with 'Users' replaced by 'MyApp::Users'
#everywhere in the code.
#