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. May 31, 2010  1:34 am by Edison Schouweiler Reply

    hey,Awesome blogging dude! i am Fed up with using RSS feeds and do you use twitter?so i can follow you there:D.

    PS:Do you considered putting video to the blog to keep the visitors more interested?I think it works.Best wishes, Edison Schouweiler

  2. July 7, 2010  11:55 am by Sports Updates Reply

    I just wanted to thank you a great deal for this informative webpage. I have already bookmarked your webpage, when can free up some time I am going to have to do some deeper surfing of your site. Well back to searching for sporting event tickets

  3. July 10, 2010  10:25 pm by nflliga Reply

    If you love watching NFL, then you perhaps also proclivity to wager on the gamble, and extraordinarily on your favorite teams?

  4. July 29, 2010  11:33 pm by jeynkossteli Reply

    ??????????? ????????? ?? ?????????? ??? ?????????? ??????? ???? ?????????, ????? ??? - ??????? ??????????, ??????????? ?????????? ? ???????? ???????????.

  5. August 20, 2010  10:06 pm by Pyncpoungunny Reply

    Gday,

    How is everyone? I'm most recent here!

    Bye for now.

    Keely

  6. August 22, 2010  5:07 am by DaSSuka Reply

    i need to prove i have the original version of windows. it only lets me go to the internet "to buy the real windows" and after an hour it logs me out.

    ___________________
    Dentysta

  7. September 11, 2010  3:38 pm by fesAvavy Reply

    just want to say a big hey there to anybody here. i am new here and look forward to creating a bit more posts...

    I'm not sure if this is allows but I am very much interested in free car games, so that I am living a link in my signature that has many usefull info relevant to that topic.

  8. September 11, 2010  9:13 pm by pepStend Reply

    Really love here,i discovered here and will share and learn here ^_^ cool!

    By the way I have a good web-site about microwave ovens and suggest to evrybody to view it.

  9. September 12, 2010  4:16 am by Beenugh Reply

    hello guys, I'm a noob in here, so I hope learn a lot in this forum ;) it seems a very good forum.

    Intended for those who wish it, in my signature there is some interesting information about Symptoms of Diabetes.

  10. September 23, 2010  2:45 am by Girl Puppy Names Reply

    I had a definitely extremely time locate a name for my puppies. I named them Tom and Jerry haha, i was watching the cartoon. Really funny but very names.

  11. October 2, 2010  2:22 am by Waftunula Reply

    http://google.com

  12. October 13, 2010  12:47 pm by abappeack Reply

    Ahoy guys, long time browser first time poster here

    delighted to be a member, and I am looking forward to start getting more active here

    For now take a look at my site http://writingarticlesonline.goingonline.co.za/2010/10/05/how-online-businesses-can-counter-the-economic-downturn/

  13. October 14, 2010  3:10 pm by Unsantsaurl Reply

    Hi each
    Validate outmoded
    a marvelous search engine –
    wczasy nad morzem
    P.S. Yahoo – everything relentlessness be usher in! Google: nothing was categorically adrift…

    Woo you!

  14. November 22, 2010  3:30 pm by Kickbacks Reply

    We offer foreign companies the financial and consulting services:
    opening a representative office in Russia
    Marketing Research,
    tax optimization,
    withdrawals abroad
    kickbacks payer.

  15. November 28, 2010  9:16 am by rickgrill Reply

    Hi,

    I am looking for a VPS solutions. Who is the best provider in your eyes of VPS hosting?

    -Rick

  16. November 29, 2010  10:23 pm by neetutteria Reply

    If you adore football, you most likely possess a preferred group in the nationwide Football League or two and possess a record of avid gamers who like to possess seen. A terrific method to display your loyalty to this team, may be the utilization of NFL jerseys of the group colors, sports, logo and name. in the occasion you are seriously on the specific player, you can produce a replica of his jersey and display that you just believe may be the boss. Wholesale NFL jerseys are fashionable and sporty, and never spend an arm and also a leg to obtain one!

    Who does not want to display your group spirit? These shirts pullover design is all great, regardless of age. From newborns to seniors, may be discovered in all sizes. They are for use throughout the summer time months, perfect due to the fact they breathe nicely and hence pass via the oxygen whenever you can use it for function and leisure, and certainly not as well hot.

    Who desires to spend even if retail store help save by purchasing in big bulk? The costs are so reduced that you just just purchase two shirts and extra for that value you usually spend for any retail store price. There are numerous sorts which are available, several of them are for being borne for all people capable and other people are directed particularly for women.

    The T-shirts which are geared extra toward ladies generally pink or other pastel colours rather in the typical team are real.

    Some wholesale NFL jerseys are bright, with mixed fabric. These shirts aid you display who you seriously root for each and every week.

    The utilization of NFL jerseys are quite popular. It is generally a method to encounter new people, too. All more than the nation are total strangers a smile, a nod, increase your eyeglasses and horns, as they see other people with their preferred jersey. It is generally a terrific method to like minded folks specially when you're gone wrist watch the game, within their favored institution's needs.

    Wholesale NFL Jerseys contrast to all other T-shirt you can purchase using the very same treatment and quality. You can even extra capital in the occasion you purchase in big quantities. in the occasion you undoubtedly are a team of pals or colleagues who have all observed the online game all week, why not 1 for all? You can swimming pool their capital to purchase them or purchase them for everybody being a gift.

    You also can go to the business, marketed T-shirts on the web or locally within the level permitted by law. costs are big you the independence to appoint their personal costs and compensated a reasonable value for that purchase of T-shirts.
    Wholesale NFL jerseys, the events may perhaps be bought for particular games, organize you. be sure that all within the very same web site and its finest in relation to actively playing these shirts are also perfect for use once the opportunity to determine their preferred group up near and in someone to have.

  17. January 4, 2011  3:58 am by tesuwpihkpm Reply

    Hi

    I'm new and I want to just say Hello all

    My site is:about car audio

    I hope to write many of posts in this forum...

    If it's wrong thread to say Hello, please move to correct thread.

  18. January 10, 2011  1:17 am by HibMibeLype Reply

    ?????????? ? ????????. ??????? ?????. ?????? ??? ? ???. 1 ????. ??????? ?.. 1 ????. ?????. ?????? ?????: ????????-??????? / 966-7924-86-6.
    ???????? ?????????? ????? ?????????? ??????? ?????????
    ????????? ?? ??????? «???????»
    ?????: ??????? ??????? ????? ???????: ????????? ?????????????????????, ??????????????????? ????????; ???????????? ????????? ??????????????? ?????, ?????????????? ????????????? ?????????? ??????, ???????? ???????????????, ???????????? ??????????. ? ????????? ????? ????????????? ?????? ??????????? ? ????? ??????. ? ??????? ??????? ????? ??????????? ?????? ????????? ????? ??? (????? 15) ???????????? ???????? ??????? ??????????? ????????? ???????????. ? ??? ????????? ???????, ???????????, ????????, ??????????, ????????, ?????, ????? ? ????????? ?????? ?????????? ???? ?? ???????. ???????? ??????????? ?????? ????????? ?????????????????????, ???????????????????, ???????????????????, ???????????????????????, ?????????????????? ? ??????????? ????????. ????-??????? ?????????? ???????? ? ?????????? ???????? ?????, ?????????? ?????????, ??????? ????????? ? ?????, ?????, ???????????? ???????????? ?????????????? ??? ?????????? ??????????? ???. ????????? ??? ???????? ??????????????? ???????? ??? ?????????? ??????? ??? ?????? ???????????, ??????, ?????????, ??????? ? ?????? ???????????, ????????, ?????????????. ??????? ?????????? "?????????" ? "???????" ?? ???? ?????? ???????????. ????????? ????????? ??????, ???????????? ????????? ?????? ? ??????????????? ? ?????? ???????????, ???????????? ?????????????? ?????? ? ?????? ???????????.
    ???????? ??? ????? ??????? ? ? ??????????

  19. January 17, 2011  11:21 am by ordelppreague Reply

    ???????? «???? ???????????? ?????» ??????????? ???????????? ?????? ??? ? ??????. ????????? ???????? ??????? ??????????, ??? ???????? ? ?????? ? ?? ??????????? «??????» – ??? ??? ????? ??? ???????? ? ???????? ? ?? ??????? ???? ????????. ???????? ????????? ????? «??????» ??????? ? 1863 ???? ? ????? ?????? ???? ???????????? – ?? ???????????? ?? ???????? ???????, ?? ??????????????? ???????????? ?? ?????? ?? ?????????? ??????????? ??????????????, ?? ? ????????????? ?????? ?? ???. ???????? ??????? ?????????? ??????? ?????????, ????? ????????????????? ? ?????????? ?????? ?? ???? ???????????? ????????? – ?? ?????????? «???? ?????????», ????????????? «?????» ? ??????????? «???????» – ?? ???????? «???????? ????».
    8220,????-???????8221, ??????-????????? ?????????? ???? ??? ??????? ?????????? ????? ? ???????? 8220,????????8221, ??????, ??. ??????? ????????????, ?.20., ???. 1 ???.: (499) 192-1936
    ??????? ???? ? ????? ???
    ?????????? ???????? «???? ???????????? ?????» ??????????? ??????? ????????? ?????? ????? ???????? ????? ? ??????? ??????? ??????? ? ????? ????? ???????????? ???????????: ???????? ???? ???????? ????? ??? ????????? ?????? ???!
    ?? ?????? ??????????? ??????????? ??????? (UNWTO), ??????? ??????? ?? ??????? ??????? ???????????? ??????? ?? ????????? ???????????, ??????? 7 ????? ? 2008 ????.
    ??????? ???? ? ?????????

  20. January 17, 2011  3:09 pm by Mardreacype Reply

    ? ? ? ? ? : ??????? ?????? ?? ???????. ????? ??????? ??? ????????? ??? ???? ???????????: ??????? ????????? ?? ????? 2. ??????????? ??? ????????? ????? ?????? ? ????? ???? ???? ??? ??? ??????. ????? ?????????? ???? ?????. ???????? crack ?????? ? ???????. ??????? ?????? ??????? ???????. ????????? ???? keygen
    ???????? ??????: ???????? ???????, ???????????? ?????? ? ???????? ?????, ??????? ??? ???????, ??????? ????????? ? ????????? ?????????, ???????????? ??????? ? ?????????????? ????????, ???????????? ??????? ? ?????????????? ?????, ????????????? ????????????? ????????? ? ??????
    ??? ????????? ??? - ??? ?????????? ????????, ????, ????????, ??????????? ? ?.?. ?????? 4843x3426 ?????? PSD ?????? ?????? 27,4 Mb
    ????????? ?????? ????????? ?????? ????????? ???????? ???????
    SPR.ru - ??? ?????????? ?????????? ? ?????? ???????? ?????? ? ?????????? ???????. ?? ????????? ?? 16.01.2011 00:22 ?????????? ?????????? ???????? 183.607 ??????????? ? ??????????? (?????????? ??????? ? ?????????, ??????? ????). ? ??????: 101990, ?. ??????, ???. +7 (495) 988-72-72.
    ??????? ????????? ??? ?? ????? ????????? ????? ???????? ? 2007 ????. ?? ????? ??????? ???? ? ??????? ?????????? ????????? ? ???????????.
    ???????? ?????? ? ???? ?????? ???????? ?????? ??????????

  21. January 20, 2011  9:10 pm by BomStoodeSofs Reply

    24]?? ????????? ???? ????? ?????? ???????????, ???? ?? ?????? ???????? ????? ?????, ????????? ?? ????????????? ?????????.
    ??????? ??? ??????? ?????? ? ????????????. ??????? ????????? ?????? ???? ??????? ?? ?????? ?????? ? ????????! ????????????? ?????? ????
    ??????? ?????? ? ??????? ?? ??? ???????? ??? ?????????? ?????, ? ?????? ??????? ?????????? ? ???????? ? ????????? ??? ???? ??????????. ????????? ?????? ? ??? ???????? ?????? ??????? ?????????????, ??????? ?????? ? ?????????.
    ? ????? ??????? ??????? ? ??????? ??? ??????? ????? ??? ??????????? ???????. ?????? ????????? ??????? ?????? ?? ???? ?????????? ????? ??????????? ??? ????? ????????, ??????? ?????????? ???????????? ? ????????????, ??? ? ?? ????????, ?????????? ????? ????????? ?????????? ? ?????????????? ?? ???????? ???? ?????? ???????. ?????? ?? ???? ???
    ????? ????? ?????? ?????? ?????? ????? ?????????????, ? ????? ????????? ?????? ???? ??????? ? ????? ????? ?????????????, ?? ??????? ??????????? ???????. ???????????? ?????? ???? ? ???? ???????? ???????? ??? ? ???????? ??? ? ? ????????? ????????.

  22. January 24, 2011  2:11 am by kimeicernix Reply

    ???????? ????????? ?? 8 ????? 155 ????? ? ??? ?? ?? 43 ?????? 500 ???????? ? ????? ??????? ????????? ?????? ??????? ????? ????????.
    ???????? ????? ??????? ? ??????? 23 ????? ????? ???????.
    ????? 243 ?????? ?? ????????.
    ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru zf 210j h ev

  23. January 24, 2011  9:25 pm by sefprochetorp Reply

    ???????? ??? ????? ????? ?????????? ?? 5 ????? 300 ????? ? ??? ?? ?? 42 ?????? 500 ???????? ? ????? ?????? ? ??????? ????? ?? ?????? ??????? ????? ???????????. ???????? ????? ??????? ? ??????? 27 ????? ????? ???????.
    ????? 228 ?????? ?? ????????. ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru gk 287r r lz

  24. January 25, 2011  6:14 pm by idocrilla Reply

    ???????? ??? ????? ?? 8 ????? 155 ????? ?????????? ? ??? ?? ?? 50 ????? ???????? ???????? ? ????? ??????? ? ??????? ????? ?? ?????? ???????? ???????????. ???????? ????? ??????? ? ??????? 25 ????? ????? ??????.
    ????? 229 ?????? ?? ????????. ??? ???. 89266853242 ICQ 568113539 rutop10@mail.ru iz 079u v lb

Leave a reply

 

Your email address will not be published.