Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Web Logs Using DBI

by btrott (Parson)
on Apr 14, 2000 at 10:38 UTC ( #7598=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        PerlLogHandler Foo::DBILogger
    
  2. or download this
        create table log (
        stamp datetime not null,
    ...
        status smallint(3),
        bytes int(8)
        );
    
  3. or download this
        package Foo::DBILogger;
    
    ...
        use DBI;
        use POSIX 'strftime';
        use Apache::Constants qw/OK/;
    
  4. or download this
        sub handler {
            my $r = shift;
    
  5. or download this
            my $dbh = DBI->connect('dsn', 'user', 'password', 'mysql',
                { RaiseError => 1 })
    ...
    (stamp, host, method, url, user, browser, referer, status, bytes)
    values (?, ?, ?, ?, ?, ?, ?, ?, ?)
    SQL
    
  6. or download this
            $sth->execute(
                strftime("%Y-%m-%d %H:%M:%S", localtime),
    ...
                $r->bytes_sent
            );
            $sth->finish;
    
  7. or download this
            return OK;
        }
     
        1;
    
  8. or download this
        package Foo::DBILogger;
    
    ...
        }
     
        1;
    
  9. or download this
        select host, url
        from log
        where to_days(now()) - to_days(stamp) <= 1;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://7598]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-08-31 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls