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)

 

65 Comments

 

  1. May 14, 2008  6:24 pm by Graham Reply

    Might be worth posting the database.

    Or one you have with sample data.

  2. July 16, 2008  9:04 am by r Reply

    linuxscrew.com/2007/08/14/access-to-sqlite3-database-through-perl-script-example/

  3. April 9, 2009  12:17 am by Kajetan Reply

    Hello my little friends. I just wanted to say how encouraged I am by your attitude and to see your determination to carry on regardless artist i sense a little sarcasm video cold, picture, Thanks

  4. April 9, 2009  1:47 am by Zygmunt Reply

    Nice site! Like you I am a avid motorsport fan, and am also currently very involved in marshalling and race control in our local hillclimbs video so anime metal, film mouth, cartoon, Best Wishes!!

  5. April 9, 2009  3:17 am by Melchior Reply

    Hi all!!! You are the best!!! Congratulations. film Super site ! artist space, quicktime, Thank you for good job!

  6. April 11, 2009  3:09 pm by Edward Reply

    Greetings. well sort of clip Perfect site, i like it! news, Kind regards

  7. April 12, 2009  3:15 pm by Magdalene Reply

    O, super project. What an amazing story! I was aware of the Goodwood incident, of course, but not of the detail pets Brilliant but simple idea. land result, sale call, puppy crowd, dachshund sugar, collar fun, eclectus, Best regards from regular visitor of your site. ;)

  8. April 14, 2009  5:24 pm by John Reply

    All greetings! I can't be bothered with anything these days. dog Keep up the good work!!! terrier
    black, breeder ease, kennel piece, for sale consonant, canine cotton, dog, Good Luck,

  9. April 14, 2009  8:59 pm by Vince Delmonte Reply

    Hey, cool tips. I'll buy a bottle of beer to that person from that forum who told me to go to your site :)

  10. April 15, 2009  8:29 am by Josephine Reply

    O, super project. I speak for all those who wear the uniform of a Marshall when I say that your account made me proud breeder i sense a little sarcasm sale rock, puppies fit, kennel watch, sale, I love it :) Respect !

  11. April 22, 2009  1:00 am by DoundDusanary Reply

    That was formidable when good some wierd looking lady started to warble like an angel! Susan Boyle was a unaffected astonishment for millions!! WOW!

  12. July 11, 2009  1:04 am by EdgegeZon Reply

    He put his eye to the hole. He just managed to spy some people sitting in deckchairs chanting, before a finger came out of nowhere and poked him in the eye. As he staggered back, the people started chanting, "Fourteen, fourteen, fourteen..."

  13. August 15, 2009  10:32 am by Alessandra Ambrosio Reply

    Alessandra Ambrosio is so a nice looking. What do you think about she?

  14. September 11, 2009  2:01 am by margohelp Reply

    had recently herpes virus found in my blood. what I haveto do??? I'm in panic...

  15. December 26, 2009  2:48 pm by valerie.beman Reply

    my monicker is valerie


    found this forum while searching looking for grants.

    anticipation i can assist you guys also.

  16. March 5, 2010  4:28 am by Buffalo Grove Pet Sitter Reply

    There are so many helpful comments on this site. I just wanted to thank everyone for their insightful comments.

  17. March 14, 2010  7:34 pm by Taps Iorio Reply

    Susan Boyle is an incredibly talented lady who's been subjected to considerable ridicule in the media. IMHO she deserves all of the success that she is experiencing.

  18. April 14, 2010  6:06 pm by Reginia Vandre Reply

    Your site has a very nice design. Morever the material here is free and is of high-quality. I am definitely subscribing to your RSS right now.

  19. April 22, 2010  1:43 am by CheapDeanoPills Reply

    - <a>

    - <a>

    - <a>

    - <a>

    - <a>

  20. April 26, 2010  2:19 pm by Steve Reyome Reply

    Well, would you look at that..

  21. May 2, 2010  4:37 pm by Yuonne Adolfson Reply

    Hey very nice Website !! Man .. Beautiful .. Amazing .. I will bookmark your Site and take the feeds also...

  22. 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

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

    Gday,

    How is everyone? I'm most recent here!

    Bye for now.

    Keely

  24. 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.

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

    http://google.com

  26. 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/

  27. 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.

  28. 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

  29. 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

  30. 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

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

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

  32. 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

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

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

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

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

  35. 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

  36. 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

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

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

  38. 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!

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

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

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

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

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

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

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

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

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

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

  44. 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.

  45. 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.

  46. 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

  47. 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!

  48. 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!

  49. May 27, 2011  2:23 am by Allena Celmer Reply

    Merely wish to say your article is as tonishing. The clearness in your put up is just spectacular and i can assume you might be an knowledgeable on this subject. Well together with your permission permit me to seize your rss feed to keep up to date with forthcoming post. Thanks 1,000,000 and please sustain the gratifying work.

  50. June 10, 2011  9:41 pm by ViaMurka Reply

    ?????? ????????? ?????????????????????? ?????? ?????? ??????? ? ???????????????????? ? ?????? ??????????????? ??? ????? ???????? ??? ????????? ? ?????????????? ??????? ??? ??????????????? ????????????.?????? ?.????? ??? ????? ????????? ??????? ??? ???????????? ??? ????????? ?? ???????? ???????????????? ????? ????????????? ??? ???????? ??????????? ? ????????????????????????? ??????????? ?????? ? ???????????? ??? ?????????? ?????????? ???????? ???????? ??? ????? 159 ?? ? ???? 54????? ???????? ????????????????????? ???????? ? ??????????? ?????????????????????? ????? ??? ???????? ?????????????? ????????? ???????? ??? ??? ??????? ????? ?? ?????????

  51. June 11, 2011  7:45 pm by distesutrinna Reply

    hi there amazing post we have going here.

  52. June 12, 2011  7:20 pm by distesutrinna Reply

    Hi nice thread we have going here.

  53. June 14, 2011  12:53 am by distesutrinna Reply

    Hi amazing topic you have going here!

  54. February 10, 2012  6:51 am by Coral Reply

    Coral StoneUSA is an creator and importer of Coral Stone. Our stone is selected from the subdue quarries in the Dominican Republic and we submit gold coral stone as well as milky coral stone. Its color and weave makes it a darned facile concrete as a service to interiors and exteriors.
    Coral Stone - http://www.coralstonepavers.com/
    Coral Stone Pavers, Coral Tiles, Coral Stone Copings, Coral Stone Bullnose Copings, Coral Stone Columns, Coral Stone Slabs. Coral Stone Columns, Coral Stone balustrades, Coral Stone handrails, Coral Stone moldings, Coral Stone corbels, Coral Stone fountains and more.

  55. March 5, 2012  2:20 am by bstflmsdetst Reply

    Hi,
    do you know where i can download this movie : http://download-kino.de/24-twenty-four-400-p-m-500-p-m/
    Links in this site is broken. Need movie in German

    For german members:

    Hallo zusammen,
    weisst du, wo ich diesen Film zum Download(Link oben) oder diese :http://download-kino.de/30-rock-sandwich-day/
    Links auf dieser Seite ist gebrochen. Brauchen Film in deutscher Sprache

  56. March 20, 2012  1:53 am by MackMillions Reply

    Hi Everyone,
    Thank you for providing this great community.
    I've been looking for a community like this for a while now.
    It's great to find a place with like minded users who are entrepreneurs online.
    I hope we can all help each other by providing information and all have great success

    -Mack

  57. April 25, 2012  11:27 pm by itockicons Reply

    Yes... Likely... The easier, the better... All ingenipus is simlpe.

  58. April 26, 2012  1:30 am by metatradex Reply

    I can not participate now in discussion - there is no free time. uBt I will be released - I will necessarily write that I think.

  59. April 26, 2012  5:03 am by macdacmmnn Reply

    What charming idea

  60. April 26, 2012  5:44 am by steveborman Reply

    I will not begin to speak on this theme.

  61. June 6, 2012  12:17 am by Tanusree Reply

    Your Great Mom! Posted on I really msiesd you! Don't do that to me again. You have posted some great stuff and I will continue to check your site at least a couple of times each week.

  62. June 11, 2012  11:57 am by Dontarrious Reply

    best credit cards 1480 free auto insurance quotes webg

  63. August 2, 2012  6:45 am by carpinteyrozkz Reply

    Welcome to NHL Heaven! MLB is a professional baseball league, consisting of teams that play in the American League and the National League. As of the 2012 season, NFL is divided into the American League 14 teams and the National League 16 teams. Currently, each league is further subdivided into three divisions - labeled East, Central, and West.
    The NBA All-Star Game, also known as the "Midsummer Classic", is an annual game between players from the National League and the American League, currently selected by a combination of fans, players, coaches, and managers. From the first All-Star Game, players have worn their regular team uniforms and caps. NHL caps are popular among the fans. The 2011 All-Star Game was played at Chase Field in Phoenix, Arizona, home of the Arizona Diamondbacks; the 2012 All-Star Game will be played at Kauffman Stadium in Kansas City, Missouri, home of the Kansas City Royals. It has been officially announced that the 2013 All-Star Game will be played at Citi Field in Queens, New York, home of the the New York Mets. NFL caps are like hot cakes all over the world.
    Our company are ready to offer you the latest fashion mlb caps. They have been highly speaking of by the fans. With its special design and style, mlb hats has stepped out of sport series,and have widely welcomed by the hip-hop lovers and sports leisure travelers. It has been the fashion forward index and tide symbol. If you like the perfect combination of fashion trends and sports, what are you waiting for? New Era MLB hats are looking forward to your discovery. If you are big fans of the NHL, you are here the right place——the NHL Heaven, buy mlb hats to support your favorite teams.

    http://www.mlbrundown.com/blogs/5/

  64. August 30, 2012  7:31 am by abtechtes Reply

    http://www.abtechtest.com


    test and measurement equipment , spectrum analyzer, oscilloscope, network analyzer

  65. September 11, 2012  2:33 am by royaltyfreeh icons Reply

    You are mistaken. Let's discuss it. Write to me in PM, we will talk.

    P.S. Please review our icons for Windows 8

Leave a reply

 

Your email address will not be published.