You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

13.9. Sample database

Example 13-7. examples/dbi/create_sample.pl

#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my $dbfile = "sample.db";

unlink $dbfile;

my $dbh = DBI->connect("dbi:SQLite:dbname=sample.db");

my $schema;
{
    open my $fh, '<', 'examples/dbi/sample.sql' or die;
    local $/ = undef;
    $schema = <$fh>;
}
foreach my $sql (split /;/, $schema) {
    next if $sql !~ /\S/; # skip empty entries
    $dbh->do($sql);
}
$dbh->disconnect;


Example 13-8. examples/dbi/sample.sql

CREATE TABLE users (
    id    INTEGER PRIMARY KEY,
    fname VARCHAR(100), 
    lname VARCHAR(100), 
    email VARCHAR(100) UNIQUE NOT NULL,
    pw    VARCHAR(20) NOT NULL
);

INSERT INTO users (fname, lname, email, pw)
        VALUES    ('Foo', 'Bar', 'foo@bar.com', 'secret');
INSERT INTO users (fname, lname, email, pw) 
        VALUES    ('Peti', 'Bar', 'peti@bar.com', 'real secret');

If you are interested in on-site trainings by the author, please contact me directly.