By publishing this post I try to help people who want to get access to popular and simple database engine sqlite through perl script. I use sqlite to store e-mails statistics at small mail server in order to retrieve information about users’ mail activity like average response time, sent and received messages and etc. There is perl script that is used to get this data per every user or get summary statistics. This script is to be run by web server (I use Apache) and has name index.cgi in my case.

Here is part of it:

#!/usr/bin/perl
use DBI;
print “Content-type: text/html\n\n”;
print “<html><head><title>perl and sqlite example script</title></head><body>”;
$dbh = DBI->connect( “dbi:SQLite:dbname=/tmp/mail_data.db”,”", “”, { RaiseError => 1, AutoCommit => 0 });

my $fst = $dbh->selectall_arrayref(“SELECT min(time_1),max(time_1) FROM mail_data”);
foreach my $row (@$fst) {
my ($fst_pr,$lst_pr) = @$row;
print “oldest entry in database: “.gmtime($fst_pr).” gmt<br>newest entry in database: “.gmtime($lst_pr);
}

print “</body>”;
print “</html>”;
$dbh->disconnect;

After you load this example through any web browser (please read your web server’s manual on how to allow cgi/perl script exec, for example here), script will read sqlite database that is located at /tmp/mail_data.db and display minimal and maximal values of field time_1 from mail_data table.

In order to run this script it’s necessary to install perl, sqlite3 and perl-DBI-SQLite cpan module.

You may also be interested in:
CGI Perl scripts debugging (solve 500 Internal Server Error)

 

103 Comments

 

  1. January 26, 2011  1:04 pm by optiocult Reply

    ???????? ???????? ?????????? ?? 7 ????? 300 ????? ?????????? ? ??? ?? ?? 45 ?????? 500 ???????? ? ????? ??????? ????? ?? ?????? ??????? ????? ????????. ???????? ????? ??????? ? ??????? 18 ????? ????? ??????.
    ????? 248 ?????? ?? ????????. ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru bu 300f d dl

  2. January 26, 2011  1:45 pm by Sabirrern Reply

    ???????? ????????? ?? 8 ?????? 999 ????? ? ??? ??? ?? 43 ?????? ???????? ???????? ? ????? ?????? ? ??????? ????? ?? ?????? ???????? ????????????? ????????.
    ???????? ????? ??????? ? ??????? 30 ????? ????? ??????.
    ????? 235 ?????? ?? ????????.
    ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru st 675l n ng

  3. January 27, 2011  6:26 pm by fleliacleplay Reply

    ?? ???????? ???????? ?? 5 ????? 300 ????? ?????????? ? ??? ?? ?? 44 ?????? ???????? ???????? ? ????? ???????????? ????? ?? ?????? ??????? ????? ????????????? ????????.
    ???????? ????? ??????? ? ??????? 28 ????? ????? ??????.
    ????? 213 ?????? ?? ????????.
    ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru yq 907v m jz

  4. January 28, 2011  8:52 pm by Naphequathe Reply

    ???????? ???????? ?????????? ?? 8 ?????? 800 ????? ? ??? ?? ?? 43 ?????? 500 ???????? ? ????? ???????????? ??????? ?????? ?????? ???????????.
    ???????? ????? ??????? ? ???????? 17 ????? ????? ??????.
    ????? 222 ?????? ?? ????????.
    ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru dq 779f z nf

  5. February 5, 2011  2:14 pm by agreellOweple Reply

    fw 707r r mo ?? ???????? ???????? ?? 8 ????? 340 ????? ?????????? ? ??? ?? ?? 45 ?????? 500 ???????? ? ????? ??????? ????????? ?????? ???????? ???????????.

    ???????? ????? ??????? ? ??????? 24 ????? ????? ??????.

    ????? 218 ?????? ?? ????????.

    ??? ???. 89266853242 ICQ 568113539 ?????: rutop10@mail.ru xt 930k h ma

  6. February 7, 2011  7:32 pm by mohaltlab Reply

    ?????????? ??????? ?????? ?????? ? ??????? 33 ????? ????? ?????? ??????? ? ????????????? ???????????? ? ???????????? ????? ?????.????? ??????????.???? ?? ?????? ????? ??????.??? ????: http://www.gorodservis.ru ?????? ????????????? ???????

  7. February 7, 2011  10:19 pm by Gamerswow Reply

    ??????, ??? ??????????? ??? ?????? World of WarCraft http://gamerswow.com
    ??? ????????? ?????????? ?????? WoW
    ????? ?????????? ? ???!

  8. March 3, 2011  6:09 am by litRaRrytaivy Reply

    13]Warum unsere Klinik besser als die ublichen Kinder-Klinik?
    Neben Zahnkliniken und asthetische Medizin Klinik offnete seine Pforten fur Hausarztmedizin und Krankenhaus. medical center helfen In der klinischen Praxis der gemeinsamen Praxis von Hausarzten mit Spezialisten: ein HNO-Arzt, Augenarzt, einen Neurologen, Endokrinologen, Urologen, Gynakologen. medical treatment center
    Innerhalb von vier Jahren wurde die Klinik auf sechs Sitze erweitert, und im Marz des Jahres in der Nahe. hospital 57 vom moskau Wer anders als der Hausarzt wei?, dass es regelma?ige Vorsorgeuntersuchungen konnen schwere Krankheiten zu verhindern.
    Nach der Behandlung geben wir immer Empfehlungen zur Korrektur der Hygiene und Mundpflege.
    Er kennt alle Ihre Familie, materiellen und sozialen Bedingungen ihres Lebens, chronische und Erbkrankheiten.

  9. March 3, 2011  4:32 pm by Tyson Knorr Reply

    In looking for websites related to internet hosting and specifically comparison hosting linux strategy web,
    your internet site came up.
    You really are a very smart individual!

  10. March 8, 2011  3:55 pm by crimeainvest Reply

    ????????? ??????? ? ?????. ????????? ????????? ??????? 12 ????? ?
    ???????????, 200? ?? ????, ?????? ?????. ??????????? ?????? ????? ?
    ????????. ????, ????, ???. ???. ??? ??? ?????????????? ?????????????.
    60 000 usd
    ?????? ????????? ????????: ?????????? ? ????

  11. March 9, 2011  9:41 pm by http://www.evmkomplex.ru Reply

    ????????????? ???????? ????????????? ????????? ????????????? ????????????? ???????? POS-????????? POS-??????? ??????? ????? ??????? ????? ?????????????? ?????????? ??????????? ??????? ??????????????? ??? ????????????? ???????????????? ??????. ???????? ??????? ??????????? ???? ??????????? ??????????? ??? ????????

  12. March 10, 2011  1:56 am by http://www.evmkomplex.ru Reply

    ????????????? ???????? ????????????? ????????? ????????????? ????????????? ???????? POS-????????? POS-??????? ??????? ????? ??????? ????? ?????????????? ?????????? ??????????? ??????? ??????????????? ??? ????????????? ???????????????? ??????. http://evmkomplex.ru ???????? ??????? ??????????? ???? ??????????? ??????????? ??? ????????

  13. March 10, 2011  5:03 pm by wood-company.ru Reply

    ????????? ???????? ??????????: ?????????? ????, ?????????? ????????, ?????? ?? ???????????? ??????, ?????? ?? ????, ????? ?? ???????,???? ?? ???????????, ??????? ?? ??????, ????????? ?? ??????, ??????? ?????, ????? ?? ???????, ??????? ??????..

  14. March 18, 2011  1:09 pm by http://v-taxi.su Reply

    http://v-taxi.su ????? ????? ?????? ???????? ?????? ????? ?????? ???????? ????? ?????? ???????? ???????????? ????????? ?????? ???????? ???????????? ???????????? ?????? ???????? ????????????? ????????? ?????? ???????? ????? ??????????? ?????? ???????? ?????????? ?? ??????? ?????? ???????? ?????? ?? ??????? ?????? ???????? ????? ????? ????? ????????????? ???????? ????????????? ???????? ?????? ????? ???????????? ????????? ????????????? ????????? ????? ??????????? ?????????? ?? ??????? ?????? ?? ???????

  15. April 2, 2011  10:03 pm by crimeahome Reply

    ???????????? ?????. ??? ?? ?????? ???? ? ?????. ????????? 3-? ??????? ??? ????? ?????????,
    ????? ??????? ???? 280 ??.?. ???.??????????, ?????, ???????.
    ????, ????, ???. ??????? 10 ?????. ???. ???.
    170 000 usd
    ?????? ???????????? ?????: ??? ? ?????, ???????????? ? ?????, ????, ????????

  16. April 11, 2011  11:53 pm by wowcataclysm Reply

    ??????, ??? ??????????? ??? ?????? World of WarCraft cataclysm http://wow-cataclysm-zona.com/
    ??? ????????? ?????????? ?????? WoW cataclysm
    ????? ?????????? ? ???!

  17. April 18, 2011  12:11 pm by crimealand Reply

    ????????? ??????? ? ?????. ????????? ????????? ??????? 12 ????? ?
    ???????????, 300? ?? ????, ?????? ?????. ??????????? ?????? ????? ?
    ????????. ????, ????, ???. ???. ??? ??? ?????????????? ?????????????.
    50 000 usd
    ?????? ????????? ??????? ? ?????: ????????? ??????? ? ?????, ???????????? ? ?????

    ----------------------------------------------------------------------
    crimeaubk.ru
    =======================================

  18. April 20, 2011  2:11 am by http://v-taxi.su Reply

    ????? ????? ?? ??????? ????????? - ???? ????? ???. (831)242-00-00 ????? ????? ?? ??????? ????????? - ???? ????? ???. (831)242-00-00 | ????? ??????????? ?????, ????? ?????? ????????, ???? ?????, ?????? ?????, ????? ?????, ????? ???????????, ??????? ????? http://v-taxi.su ????? ????? ?????? ???????? ?????? ????? ?????? ???????? ????? ?????? ???????? ???????????? ????????? ?????? ???????? ???????????? ???????????? ?????? ???????? ????????????? ????????? ?????? ???????? ????? ??????????? ?????? ???????? ?????????? ?? ??????? ?????? ???????? ?????? ?? ??????? ?????? ???????? ????? ????? ????? ????????????? ???????? ????????????? ???????? ?????? ????? ???????????? ????????? ????????????? ????????? ????? ??????????? ?????????? ?? ??????? ?????? ?? ??????? ??? ??? ??????????? ?????? ? ????????? ???????? (????????? ??????), ??????????? ???????

  19. April 21, 2011  3:46 am by business opportunities Reply

    Hiya, I am really glad I've found this info. Today bloggers publish only about gossip and web stuff and this is actually annoying. A good blog with interesting content, that is what I need. Thank you for making this site, and I'll be visiting again. Do you do newsletters? I Cant find it.

  20. April 21, 2011  8:26 pm by ipod touch 4g Reply

    I have recently started a site, and the information you offer on this site has helped me a lot. Thank you for all of your time & work.

  21. April 27, 2011  12:32 am by bird houses for sale Reply

    well written article, you did a good job of describing the article in a simple manner

  22. May 3, 2011  10:37 pm by Lilliam Bryngelson Reply

    Hello People! Just wanted to tell you that I found tickets to the Jersey Boys concert on Nov 24th. In this site you can find tickets for other dates too. It's astonishing their performance on stage, this is my fourth time and I'm still so excited about listening them live! On this page you can see the section where you're buying the ticket, so it's very recommended!

  23. May 6, 2011  7:04 pm by Dewitt Escalero Reply

    Hello People! Just wanted to tell you that I found tickets to the Usher concert on May 18th. In this site you can find tickets for other dates too. It's wonderful Usher and his crew performance, this is my third time and I'm still so excited about listening him live! On this page you can see the section where you're buying the ticket, so it's very recommended!

Leave a reply

 

Your email address will not be published.