From madcityzen at gmail.com Thu Mar 5 21:07:55 2015 From: madcityzen at gmail.com (Doug Bell) Date: Thu, 5 Mar 2015 23:07:55 -0600 Subject: [Chicago-talk] March Meetings - Introduction to Moo Message-ID: <09B72DFB-A046-42C2-8535-B9AB7D49B6BF@gmail.com> For this month's technical meeting on March 26, Eric Johnson[1] is giving an introduction to the Moo[2] object system, and how to do object-oriented programming with Moo. The topics include: * Why Moo * Moo vs Moose[3] * Object construction * Object destruction * Attributes * Method modifiers * Roles * Best practices For a preview, slides for the Moo presentation are available: http://kablamo.org/slides-2014-ddg-intro-to-moo/#/ RSVP for the presentation on the Chicago.PM Meetup: http://www.meetup.com/ChicagoPM/events/220963375/ Office Hours will be March 12. This is where you can bring questions or code and get assistance from other Perl programmers. RSVP for Office Hours on the Chicago.PM Meetup: http://www.meetup.com/ChicagoPM/events/220897775/ [1]: https://github.com/kablamo [2]: https://metacpan.org/pod/Moo [3]: https://metacpan.org/pod/Moose Doug Bell madcityzen at gmail.com From chicago.pm at iijo.org Tue Mar 17 18:23:15 2015 From: chicago.pm at iijo.org (Eric Johnson (kablamo)) Date: Tue, 17 Mar 2015 20:23:15 -0500 Subject: [Chicago-talk] VGA cable Message-ID: Hi, Does anyone have a vga monitor cable they would like to get rid of? or sell for a couple of bucks? I'll be at the meetup March 26th. Thanks, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From gatorreina at gmail.com Thu Mar 26 06:59:29 2015 From: gatorreina at gmail.com (Richard Reina) Date: Thu, 26 Mar 2015 08:59:29 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Richard Reina Date: 2015-03-26 8:15 GMT-05:00 Subject: Perl MySQL question To: chicago-talk at pm.org Hello All, What would be the easiest way to display query results from a MySQL database -- running on a Debian machine -- onto a webpage. What I would like is to allow a user to log in and be able to do a few simple queries. I know enough perl and SQL to write the queries via perl->DBI but I have never done any web programing. What I mean is that I have written a lot of perl programs that query databases and display the results on a console screen via curses but never displayed results onto the www. I'm guessing that I might need to install Apache but really have no clue beyond that. PS It does not have to be anything fancy. Any help would be greatly appreciated. Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From imranjj at gmail.com Thu Mar 26 07:28:21 2015 From: imranjj at gmail.com (imran javaid) Date: Thu, 26 Mar 2015 09:28:21 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: Message-ID: Take a look at Perl Catalyst. There are a few more mvc frameworks for Perl you can look into too. The old way to do it would be to just take the data structure you get back from the database and using CGI and/or an HTML template toolkit to create the webpage. -imran On Mar 26, 2015 8:59 AM, "Richard Reina" wrote: > > ---------- Forwarded message ---------- > From: Richard Reina > Date: 2015-03-26 8:15 GMT-05:00 > Subject: Perl MySQL question > To: chicago-talk at pm.org > > > Hello All, > > What would be the easiest way to display query results from a MySQL > database -- running on a Debian machine -- onto a webpage. What I would > like is to allow a user to log in and be able to do a few simple queries. I > know enough perl and SQL to write the queries via perl->DBI but I have > never done any web programing. What I mean is that I have written a lot of > perl programs that query databases and display the results on a console > screen via curses but never displayed results onto the www. I'm guessing > that I might need to install Apache but really have no clue beyond that. > > > PS It does not have to be anything fancy. > > Any help would be greatly appreciated. > > Richard > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amead2 at alanmead.org Thu Mar 26 07:30:39 2015 From: amead2 at alanmead.org (Alan Mead) Date: Thu, 26 Mar 2015 09:30:39 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: Message-ID: <5514180F.5070204@alanmead.org> Richard, I think that most people will tell you to use a web-based framework and some of them are optimized for this. But it's pretty simple to create a single-page CGI that displays some data and there are many examples available online. I find HTML::Template to have a fairly easy interface for creating HTML tables from DBI queries. Probably a key issue is how much other infrastrcture you need. For example, if people need to login, that's going to make a simple CGI a bad idea. -Alan On 3/26/2015 8:59 AM, Richard Reina wrote: > > ---------- Forwarded message ---------- > From: *Richard Reina* > > Date: 2015-03-26 8:15 GMT-05:00 > Subject: Perl MySQL question > To: chicago-talk at pm.org > > > Hello All, > > What would be the easiest way to display query results from a MySQL > database -- running on a Debian machine -- onto a webpage. What I > would like is to allow a user to log in and be able to do a few simple > queries. I know enough perl and SQL to write the queries via perl->DBI > but I have never done any web programing. What I mean is that I have > written a lot of perl programs that query databases and display the > results on a console screen via curses but never displayed results > onto the www. I'm guessing that I might need to install Apache but > really have no clue beyond that. > > > PS It does not have to be anything fancy. > > Any help would be greatly appreciated. > > Richard > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -- Alan D. Mead, Ph.D. President, Talent Algorithms Inc. science + technology = better workers +815.588.3846 (Office) +267.334.4143 (Mobile) http://www.alanmead.org Announcing the Journal of Computerized Adaptive Testing (JCAT), a peer-reviewed electronic journal designed to advance the science and practice of computerized adaptive testing: http://www.iacat.org/jcat -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim at jimandkoka.com Thu Mar 26 08:53:30 2015 From: jim at jimandkoka.com (Jim Thomason) Date: Thu, 26 Mar 2015 10:53:30 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: <5514180F.5070204@alanmead.org> References: <5514180F.5070204@alanmead.org> Message-ID: I'd say that using Catalyst or any other MVC framework (my camp in this religious debate would be Mojolicious) is way overkill, especially for an initial simple pass. If you just want to get something braindead simple up and running lightning fast... 1) Get some sort of web server installed and configured. apache/nginx/one of the myriad perl servers, whatever. Ask your friendly local sysadmin for help and/or suggestions, if necessary. And as always, be concerned about security if this is public facing. 2) Enable CGI in some manner - this is usually either enabling scripts in a certain directory, or things with a .cgi extension to be executable. 3) your cgi script is more or less the same as a command line script. If you're going to output just plain text (as you would have if you were sending to the screen or piping it to a file), just add this to the top: print "Content-type: text/plain\n\n"; And you're done. That'll spit it out to the web and it'll look exactly the same as if you were sending it to a file. HTTP communication is really easy if you skirt a few of the rules - it really just needs a Content-type header so the browser knows the type of data it's receiving. There's more that you -should- do, and I don't suggest you do the above as a production run, but to get your feet wet and up and going, this'll have you spitting out text to the browser in under an hour. ...and now that the simple start up pleasantries are out of the way... First of all, you need to worry about security - make sure that the user can't send in arbitrary SQL queries to your server, ESPECIALLY if it's not firewalled off for only authorized users. The last thing you'd need is an open arbitrary SQL gateway that allows any black hat to come in and run an insert/update/drop table/alter table statement. This task is potentially non-trivial, but at a minimum, don't write it to accept arbitrary SQL from the browser. The CGI module is pretty popular for the IO requirements here. There are myriad other derivatives - CGI::Lite, CGI::Minimal, etc. Use whatever's handy. That'll give you better header handling, and simpler processing for reading in options passed by the user. Next, to pretty it up, templating libraries like Text::Template or HTML::Template can help layout an interface for you. You may need login/user capabilities. You can do that with CGI and templating yourself, but it's a lot of infrastructure you need to set up. One of the frameworks may be more useful for you at this point. Nowadays, it's also very trendy to have your web front ends be javascript apps that handle all the layout and interface, and your communication back and forth to the server is all done by handing JSON objects or XML. So you might want to look into that as well. On the one hand, it makes the web front end more complicated and brings in different languages, but on the other it can keep the server side a lot simpler if you're only handing data structures back and forth to the client and letting the client side handle all the interaction. -Jim... On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead wrote: > Richard, > > I think that most people will tell you to use a web-based framework and > some of them are optimized for this. > > But it's pretty simple to create a single-page CGI that displays some data > and there are many examples available online. I find HTML::Template to > have a fairly easy interface for creating HTML tables from DBI queries. > Probably a key issue is how much other infrastrcture you need. For > example, if people need to login, that's going to make a simple CGI a bad > idea. > > -Alan > > > > On 3/26/2015 8:59 AM, Richard Reina wrote: > > > ---------- Forwarded message ---------- > From: Richard Reina > Date: 2015-03-26 8:15 GMT-05:00 > Subject: Perl MySQL question > To: chicago-talk at pm.org > > > Hello All, > > What would be the easiest way to display query results from a MySQL > database -- running on a Debian machine -- onto a webpage. What I would > like is to allow a user to log in and be able to do a few simple queries. I > know enough perl and SQL to write the queries via perl->DBI but I have > never done any web programing. What I mean is that I have written a lot of > perl programs that query databases and display the results on a console > screen via curses but never displayed results onto the www. I'm guessing > that I might need to install Apache but really have no clue beyond that. > > > PS It does not have to be anything fancy. > > Any help would be greatly appreciated. > > Richard > > > > _______________________________________________ > Chicago-talk mailing listChicago-talk at pm.orghttp://mail.pm.org/mailman/listinfo/chicago-talk > > > -- > > Alan D. Mead, Ph.D. > President, Talent Algorithms Inc. > > science + technology = better workers > > +815.588.3846 (Office) > +267.334.4143 (Mobile) > http://www.alanmead.org > > Announcing the Journal of Computerized Adaptive Testing (JCAT), a > peer-reviewed electronic journal designed to advance the science and > practice of computerized adaptive testing: http://www.iacat.org/jcat > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at blanton.com Thu Mar 26 09:48:40 2015 From: sean at blanton.com (Sean Blanton) Date: Thu, 26 Mar 2015 11:48:40 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: <5514180F.5070204@alanmead.org> Message-ID: If you want a nice table format, simple to get started, check out datatables.net JQurry plugin. I used Dancer, Template Toolkit, JQuery and the Datatables plugin. Backend was Moose and Bread::Board. Run on Linux with DBD::Sybase to connect to SQLServer. The flavor of DB matters least of all, I believe. I chose Dancer because it was the quickest way to get started for me at least. As it grew, the templating of the JavaScript got a little hairy, but not too bad. On Thursday, March 26, 2015, Jim Thomason wrote: > I'd say that using Catalyst or any other MVC framework (my camp in this > religious debate would be Mojolicious) is way overkill, especially for an > initial simple pass. If you just want to get something braindead simple up > and running lightning fast... > > 1) Get some sort of web server installed and configured. apache/nginx/one > of the myriad perl servers, whatever. Ask your friendly local sysadmin for > help and/or suggestions, if necessary. And as always, be concerned about > security if this is public facing. > > 2) Enable CGI in some manner - this is usually either enabling scripts in > a certain directory, or things with a .cgi extension to be executable. > > 3) your cgi script is more or less the same as a command line script. If > you're going to output just plain text (as you would have if you were > sending to the screen or piping it to a file), just add this to the top: > > print "Content-type: text/plain\n\n"; > > And you're done. That'll spit it out to the web and it'll look exactly the > same as if you were sending it to a file. HTTP communication is really easy > if you skirt a few of the rules - it really just needs a Content-type > header so the browser knows the type of data it's receiving. There's more > that you -should- do, and I don't suggest you do the above as a production > run, but to get your feet wet and up and going, this'll have you spitting > out text to the browser in under an hour. > > ...and now that the simple start up pleasantries are out of the way... > > First of all, you need to worry about security - make sure that the user > can't send in arbitrary SQL queries to your server, ESPECIALLY if it's not > firewalled off for only authorized users. The last thing you'd need is an > open arbitrary SQL gateway that allows any black hat to come in and run an > insert/update/drop table/alter table statement. This task is potentially > non-trivial, but at a minimum, don't write it to accept arbitrary SQL from > the browser. > > The CGI module is pretty popular for the IO requirements here. There are > myriad other derivatives - CGI::Lite, CGI::Minimal, etc. Use whatever's > handy. That'll give you better header handling, and simpler processing for > reading in options passed by the user. > > Next, to pretty it up, templating libraries like Text::Template or > HTML::Template can help layout an interface for you. > > You may need login/user capabilities. You can do that with CGI and > templating yourself, but it's a lot of infrastructure you need to set up. > One of the frameworks may be more useful for you at this point. > > Nowadays, it's also very trendy to have your web front ends be javascript > apps that handle all the layout and interface, and your communication back > and forth to the server is all done by handing JSON objects or XML. So you > might want to look into that as well. On the one hand, it makes the web > front end more complicated and brings in different languages, but on the > other it can keep the server side a lot simpler if you're only handing data > structures back and forth to the client and letting the client side handle > all the interaction. > > -Jim... > > > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead > wrote: > >> Richard, >> >> I think that most people will tell you to use a web-based framework and >> some of them are optimized for this. >> >> But it's pretty simple to create a single-page CGI that displays some >> data and there are many examples available online. I find HTML::Template >> to have a fairly easy interface for creating HTML tables from DBI queries. >> Probably a key issue is how much other infrastrcture you need. For >> example, if people need to login, that's going to make a simple CGI a bad >> idea. >> >> -Alan >> >> >> >> On 3/26/2015 8:59 AM, Richard Reina wrote: >> >> >> ---------- Forwarded message ---------- >> From: Richard Reina > > >> Date: 2015-03-26 8:15 GMT-05:00 >> Subject: Perl MySQL question >> To: chicago-talk at pm.org >> >> >> >> Hello All, >> >> What would be the easiest way to display query results from a MySQL >> database -- running on a Debian machine -- onto a webpage. What I would >> like is to allow a user to log in and be able to do a few simple queries. I >> know enough perl and SQL to write the queries via perl->DBI but I have >> never done any web programing. What I mean is that I have written a lot of >> perl programs that query databases and display the results on a console >> screen via curses but never displayed results onto the www. I'm guessing >> that I might need to install Apache but really have no clue beyond that. >> >> >> PS It does not have to be anything fancy. >> >> Any help would be greatly appreciated. >> >> Richard >> >> >> >> _______________________________________________ >> Chicago-talk mailing listChicago-talk at pm.org http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> -- >> >> Alan D. Mead, Ph.D. >> President, Talent Algorithms Inc. >> >> science + technology = better workers >> >> +815.588.3846 (Office) >> +267.334.4143 (Mobile) >> http://www.alanmead.org >> >> Announcing the Journal of Computerized Adaptive Testing (JCAT), a >> peer-reviewed electronic journal designed to advance the science and >> practice of computerized adaptive testing: http://www.iacat.org/jcat >> >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk >> > > -- Regards, Sean Sean Blanton sean at blanton.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From hal.wigoda at gmail.com Thu Mar 26 09:57:15 2015 From: hal.wigoda at gmail.com (Hal Wigoda) Date: Thu, 26 Mar 2015 11:57:15 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: Message-ID: <0F5FBD63-E6D1-44A9-9743-8A549C501BA1@gmail.com> Use PHP. (Sent from iPhone, so please accept my apologies in advance for any spelling or grammatical errors.) > On Mar 26, 2015, at 8:59 AM, Richard Reina wrote: > > > ---------- Forwarded message ---------- > From: Richard Reina > Date: 2015-03-26 8:15 GMT-05:00 > Subject: Perl MySQL question > To: chicago-talk at pm.org > > > Hello All, > > What would be the easiest way to display query results from a MySQL database -- running on a Debian machine -- onto a webpage. What I would like is to allow a user to log in and be able to do a few simple queries. I know enough perl and SQL to write the queries via perl->DBI but I have never done any web programing. What I mean is that I have written a lot of perl programs that query databases and display the results on a console screen via curses but never displayed results onto the www. I'm guessing that I might need to install Apache but really have no clue beyond that. > > > PS It does not have to be anything fancy. > > Any help would be greatly appreciated. > > Richard > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From joel.a.berger at gmail.com Thu Mar 26 13:38:26 2015 From: joel.a.berger at gmail.com (Joel Berger) Date: Thu, 26 Mar 2015 15:38:26 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: <5514180F.5070204@alanmead.org> Message-ID: On Mar 26, 2015 10:53 AM, "Jim Thomason" wrote: > > I'd say that using Catalyst or any other MVC framework (my camp in this religious debate would be Mojolicious) is way overkill, especially for an initial simple pass. If you just want to get something braindead simple up and running lightning fast... > I have to strongly disagree. > 1) Get some sort of web server installed and configured. apache/nginx/one of the myriad perl servers, whatever. Ask your friendly local sysadmin for help and/or suggestions, if necessary. And as always, be concerned about security if this is public facing. Mojolicious or the PSGI compliant frameworks don't need any special servers, just modules which either come bundled or are installable from cpan. > > 2) Enable CGI in some manner - this is usually either enabling scripts in a certain directory, or things with a .cgi extension to be executable. Configuring CGI is painful, the above servers should "just work". > > 3) your cgi script is more or less the same as a command line script. If you're going to output just plain text (as you would have if you were sending to the screen or piping it to a file), just add this to the top: > > print "Content-type: text/plain\n\n"; > Whaaaa? Why print your own headers? That's what frameworks are for! > And you're done. That'll spit it out to the web and it'll look exactly the same as if you were sending it to a file. HTTP communication is really easy if you skirt a few of the rules - it really just needs a Content-type header so the browser knows the type of data it's receiving. There's more that you -should- do, and I don't suggest you do the above as a production run, but to get your feet wet and up and going, this'll have you spitting out text to the browser in under an hour. A mojolicious "hello world" is right on the main site and work need to be modified very little to make work in the manner you suggest. If it takes you an hour you might be doing it wrong. > > ...and now that the simple start up pleasantries are out of the way... > > First of all, you need to worry about security - make sure that the user can't send in arbitrary SQL queries to your server, ESPECIALLY if it's not firewalled off for only authorized users. The last thing you'd need is an open arbitrary SQL gateway that allows any black hat to come in and run an insert/update/drop table/alter table statement. This task is potentially non-trivial, but at a minimum, don't write it to accept arbitrary SQL from the browser. > > The CGI module is pretty popular for the IO requirements here. There are myriad other derivatives - CGI::Lite, CGI::Minimal, etc. Use whatever's handy. That'll give you better header handling, and simpler processing for reading in options passed by the user. > > Next, to pretty it up, templating libraries like Text::Template or HTML::Template can help layout an interface for you. > > You may need login/user capabilities. You can do that with CGI and templating yourself, but it's a lot of infrastructure you need to set up. One of the frameworks may be more useful for you at this point. > > Nowadays, it's also very trendy to have your web front ends be javascript apps that handle all the layout and interface, and your communication back and forth to the server is all done by handing JSON objects or XML. So you might want to look into that as well. On the one hand, it makes the web front end more complicated and brings in different languages, but on the other it can keep the server side a lot simpler if you're only handing data structures back and forth to the client and letting the client side handle all the interaction. > > -Jim... Nothing personal, but cgi is really passe. Joel > > > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead wrote: >> >> Richard, >> >> I think that most people will tell you to use a web-based framework and some of them are optimized for this. >> >> But it's pretty simple to create a single-page CGI that displays some data and there are many examples available online. I find HTML::Template to have a fairly easy interface for creating HTML tables from DBI queries. Probably a key issue is how much other infrastrcture you need. For example, if people need to login, that's going to make a simple CGI a bad idea. >> >> -Alan >> >> >> >> On 3/26/2015 8:59 AM, Richard Reina wrote: >>> >>> >>> ---------- Forwarded message ---------- >>> From: Richard Reina >>> Date: 2015-03-26 8:15 GMT-05:00 >>> Subject: Perl MySQL question >>> To: chicago-talk at pm.org >>> >>> >>> Hello All, >>> >>> What would be the easiest way to display query results from a MySQL database -- running on a Debian machine -- onto a webpage. What I would like is to allow a user to log in and be able to do a few simple queries. I know enough perl and SQL to write the queries via perl->DBI but I have never done any web programing. What I mean is that I have written a lot of perl programs that query databases and display the results on a console screen via curses but never displayed results onto the www. I'm guessing that I might need to install Apache but really have no clue beyond that. >>> >>> >>> PS It does not have to be anything fancy. >>> >>> Any help would be greatly appreciated. >>> >>> Richard >>> >>> >>> >>> _______________________________________________ >>> Chicago-talk mailing list >>> Chicago-talk at pm.org >>> http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> -- >> >> Alan D. Mead, Ph.D. >> President, Talent Algorithms Inc. >> >> science + technology = better workers >> >> +815.588.3846 (Office) >> +267.334.4143 (Mobile) >> >> http://www.alanmead.org >> >> Announcing the Journal of Computerized Adaptive Testing (JCAT), a >> peer-reviewed electronic journal designed to advance the science and >> practice of computerized adaptive testing: http://www.iacat.org/jcat >> >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkeen at verizon.net Thu Mar 26 15:35:42 2015 From: jkeen at verizon.net (James E Keenan) Date: Thu, 26 Mar 2015 18:35:42 -0400 Subject: [Chicago-talk] New York City Perl Hackathon 2015 Message-ID: <551489BE.6060806@verizon.net> Chicago Perlmongers, Thanks to a generous offer of venue accommodations by Bloomberg, L.P., we are pleased to announce the second New York City Perl Hackathon, to be held Saturday, May 02 2015 at Bloomberg offices in Manhattan. This is a one-day event and is open to Perl hackers of all levels. Should you be interested in attending the hackathon, you can find details on our wiki: https://github.com/nyperlmongers/nyperlhackathon2015/wiki But, of course, on the day of the event, you can always follow along in irc.perl.org #hackathon. If you have an open-source project such as a CPAN library which could use some focused attention from hackathon participants, you can create a hackathon project even if you cannot attend in person. Find details on the Projects page on the wiki. https://github.com/nyperlmongers/nyperlhackathon2015/wiki/Projects In particular, if you have any projects that emerge from your monthly "Office Hours" meetings that would be suitable for the hackathon, create an entry on the projects page for that. Thank you very much. Jim Keenan From gatorreina at gmail.com Mon Mar 30 05:56:19 2015 From: gatorreina at gmail.com (Richard Reina) Date: Mon, 30 Mar 2015 07:56:19 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: <5514180F.5070204@alanmead.org> Message-ID: Hey Everybody, Thanks for all the replies. Looks a little overwhelming but I will get to studying and see if I can find my way. I'm sure I'll be back with more questions but thanks again for all the ideas. Richard 2015-03-26 15:38 GMT-05:00 Joel Berger : > > On Mar 26, 2015 10:53 AM, "Jim Thomason" wrote: > > > > I'd say that using Catalyst or any other MVC framework (my camp in this > religious debate would be Mojolicious) is way overkill, especially for an > initial simple pass. If you just want to get something braindead simple up > and running lightning fast... > > > > I have to strongly disagree. > > > 1) Get some sort of web server installed and configured. > apache/nginx/one of the myriad perl servers, whatever. Ask your friendly > local sysadmin for help and/or suggestions, if necessary. And as always, be > concerned about security if this is public facing. > > Mojolicious or the PSGI compliant frameworks don't need any special > servers, just modules which either come bundled or are installable from > cpan. > > > > > 2) Enable CGI in some manner - this is usually either enabling scripts > in a certain directory, or things with a .cgi extension to be executable. > > Configuring CGI is painful, the above servers should "just work". > > > > > 3) your cgi script is more or less the same as a command line script. If > you're going to output just plain text (as you would have if you were > sending to the screen or piping it to a file), just add this to the top: > > > > print "Content-type: text/plain\n\n"; > > > > Whaaaa? Why print your own headers? That's what frameworks are for! > > > And you're done. That'll spit it out to the web and it'll look exactly > the same as if you were sending it to a file. HTTP communication is really > easy if you skirt a few of the rules - it really just needs a Content-type > header so the browser knows the type of data it's receiving. There's more > that you -should- do, and I don't suggest you do the above as a production > run, but to get your feet wet and up and going, this'll have you spitting > out text to the browser in under an hour. > > A mojolicious "hello world" is right on the main site and work need to be > modified very little to make work in the manner you suggest. If it takes > you an hour you might be doing it wrong. > > > > > ...and now that the simple start up pleasantries are out of the way... > > > > First of all, you need to worry about security - make sure that the user > can't send in arbitrary SQL queries to your server, ESPECIALLY if it's not > firewalled off for only authorized users. The last thing you'd need is an > open arbitrary SQL gateway that allows any black hat to come in and run an > insert/update/drop table/alter table statement. This task is potentially > non-trivial, but at a minimum, don't write it to accept arbitrary SQL from > the browser. > > > > The CGI module is pretty popular for the IO requirements here. There are > myriad other derivatives - CGI::Lite, CGI::Minimal, etc. Use whatever's > handy. That'll give you better header handling, and simpler processing for > reading in options passed by the user. > > > > Next, to pretty it up, templating libraries like Text::Template or > HTML::Template can help layout an interface for you. > > > > You may need login/user capabilities. You can do that with CGI and > templating yourself, but it's a lot of infrastructure you need to set up. > One of the frameworks may be more useful for you at this point. > > > > Nowadays, it's also very trendy to have your web front ends be > javascript apps that handle all the layout and interface, and your > communication back and forth to the server is all done by handing JSON > objects or XML. So you might want to look into that as well. On the one > hand, it makes the web front end more complicated and brings in different > languages, but on the other it can keep the server side a lot simpler if > you're only handing data structures back and forth to the client and > letting the client side handle all the interaction. > > > > -Jim... > > Nothing personal, but cgi is really passe. Joel > > > > > > > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead wrote: > >> > >> Richard, > >> > >> I think that most people will tell you to use a web-based framework and > some of them are optimized for this. > >> > >> But it's pretty simple to create a single-page CGI that displays some > data and there are many examples available online. I find HTML::Template > to have a fairly easy interface for creating HTML tables from DBI queries. > Probably a key issue is how much other infrastrcture you need. For > example, if people need to login, that's going to make a simple CGI a bad > idea. > >> > >> -Alan > >> > >> > >> > >> On 3/26/2015 8:59 AM, Richard Reina wrote: > >>> > >>> > >>> ---------- Forwarded message ---------- > >>> From: Richard Reina > >>> Date: 2015-03-26 8:15 GMT-05:00 > >>> Subject: Perl MySQL question > >>> To: chicago-talk at pm.org > >>> > >>> > >>> Hello All, > >>> > >>> What would be the easiest way to display query results from a MySQL > database -- running on a Debian machine -- onto a webpage. What I would > like is to allow a user to log in and be able to do a few simple queries. I > know enough perl and SQL to write the queries via perl->DBI but I have > never done any web programing. What I mean is that I have written a lot of > perl programs that query databases and display the results on a console > screen via curses but never displayed results onto the www. I'm guessing > that I might need to install Apache but really have no clue beyond that. > >>> > >>> > >>> PS It does not have to be anything fancy. > >>> > >>> Any help would be greatly appreciated. > >>> > >>> Richard > >>> > >>> > >>> > >>> _______________________________________________ > >>> Chicago-talk mailing list > >>> Chicago-talk at pm.org > >>> http://mail.pm.org/mailman/listinfo/chicago-talk > >> > >> > >> -- > >> > >> Alan D. Mead, Ph.D. > >> President, Talent Algorithms Inc. > >> > >> science + technology = better workers > >> > >> +815.588.3846 (Office) > >> +267.334.4143 (Mobile) > >> > >> http://www.alanmead.org > >> > >> Announcing the Journal of Computerized Adaptive Testing (JCAT), a > >> peer-reviewed electronic journal designed to advance the science and > >> practice of computerized adaptive testing: http://www.iacat.org/jcat > >> > >> > >> _______________________________________________ > >> Chicago-talk mailing list > >> Chicago-talk at pm.org > >> http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk at pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amead2 at alanmead.org Mon Mar 30 06:24:51 2015 From: amead2 at alanmead.org (Alan Mead) Date: Mon, 30 Mar 2015 08:24:51 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: <5514180F.5070204@alanmead.org> Message-ID: <55194EA3.9030604@alanmead.org> Richard, In my earlier reply, I should have emphasized a point: if you decide to write a CGI, you'll be using Perl (and you'll need to learn a bit about how Apache works). If you choose a framework, then you will probably be working with that framework or with smaller amounts of Perl to manipulate the objects of that framework. In other words, Perl isn't the most important area of expertise for a framework; in order to get advice about a framework, you'd do better to ask folks who use that framework. And if you are using a framework, then I recommend you start by installing the framework on the server or a comparable server; there is no point in studying a framework unless you have it to play with and you may find differences in how easily you can install these frameworks. Once you have one installed, then I'd see if there's a book available for it (even if it's somewhat out-of-date). The kind of thing you're doing, is pretty common. If you decide to go the CGI route, you could start with this old book: http://www.oreilly.com/openbook/cgi/ch09_03.html , but I would fill in the table using HTML::Temlplate: http://search.cpan.org/~wonko/HTML-Template-2.95/lib/HTML/Template.pm#TMPL_LOOP . Or, you could find many examples online: http://www.google.com/search?q=perl+CGI+present+SQL+data+table+example, like this one: http://www.easysoft.com/developer/languages/perl/tutorial_data_web.html -Alan On 3/30/2015 7:56 AM, Richard Reina wrote: > Hey Everybody, > > Thanks for all the replies. Looks a little overwhelming but I will > get to studying and see if I can find my way. I'm sure I'll be back > with more questions but thanks again for all the ideas. > > Richard > > 2015-03-26 15:38 GMT-05:00 Joel Berger >: > > > On Mar 26, 2015 10:53 AM, "Jim Thomason" > wrote: > > > > I'd say that using Catalyst or any other MVC framework (my camp > in this religious debate would be Mojolicious) is way overkill, > especially for an initial simple pass. If you just want to get > something braindead simple up and running lightning fast... > > > > I have to strongly disagree. > > > 1) Get some sort of web server installed and configured. apache/nginx/one of the myriad perl servers, > whatever. Ask your friendly local sysadmin for help and/or > suggestions, if necessary. And as always, be concerned about > security if this is public facing. > > Mojolicious or the PSGI compliant frameworks don't need any > special servers, just modules which either come bundled or are > installable from cpan. > > > > > 2) Enable CGI in some manner - this is usually either enabling > scripts in a certain directory, or things with a .cgi extension to > be executable. > > Configuring CGI is painful, the above servers should "just work". > > > > > 3) your cgi script is more or less the same as a command line > script. If you're going to output just plain text (as you would > have if you were sending to the screen or piping it to a file), > just add this to the top: > > > > print "Content-type: text/plain\n\n"; > > > > Whaaaa? Why print your own headers? That's what frameworks are for! > > > And you're done. That'll spit it out to the web and it'll look exactly the same as if you were sending it > to a file. HTTP communication is really easy if you skirt a few of > the rules - it really just needs a Content-type header so the > browser knows the type of data it's receiving. There's more that > you -should- do, and I don't suggest you do the above as a > production run, but to get your feet wet and up and going, this'll > have you spitting out text to the browser in under an hour. > > A mojolicious "hello world" is right on the main site and work > need to be modified very little to make work in the manner you > suggest. If it takes you an hour you might be doing it wrong. > > > > > ...and now that the simple start up pleasantries are out of the > way... > > > > First of all, you need to worry about security - make sure that > the user can't send in arbitrary SQL queries to your server, > ESPECIALLY if it's not firewalled off for only authorized users. > The last thing you'd need is an open arbitrary SQL gateway that > allows any black hat to come in and run an insert/update/drop > table/alter table statement. This task is potentially non-trivial, > but at a minimum, don't write it to accept arbitrary SQL from the > browser. > > > > The CGI module is pretty popular for the IO requirements here. > There are myriad other derivatives - CGI::Lite, CGI::Minimal, etc. > Use whatever's handy. That'll give you better header handling, and > simpler processing for reading in options passed by the user. > > > > Next, to pretty it up, templating libraries like Text::Template > or HTML::Template can help layout an interface for you. > > > > You may need login/user capabilities. You can do that with CGI > and templating yourself, but it's a lot of infrastructure you need > to set up. One of the frameworks may be more useful for you at > this point. > > > > Nowadays, it's also very trendy to have your web front ends be > javascript apps that handle all the layout and interface, and your > communication back and forth to the server is all done by handing > JSON objects or XML. So you might want to look into that as well. > On the one hand, it makes the web front end more complicated and > brings in different languages, but on the other it can keep the > server side a lot simpler if you're only handing data structures > back and forth to the client and letting the client side handle > all the interaction. > > > > -Jim... > > Nothing personal, but cgi is really passe. Joel > > > > > > > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead > wrote: > >> > >> Richard, > >> > >> I think that most people will tell you to use a web-based > framework and some of them are optimized for this. > >> > >> But it's pretty simple to create a single-page CGI that > displays some data and there are many examples available online. > I find HTML::Template to have a fairly easy interface for creating > HTML tables from DBI queries. Probably a key issue is how much > other infrastrcture you need. For example, if people need to > login, that's going to make a simple CGI a bad idea. > >> > >> -Alan > >> > >> > >> > >> On 3/26/2015 8:59 AM, Richard Reina wrote: > >>> > >>> > >>> ---------- Forwarded message ---------- > >>> From: Richard Reina > > >>> Date: 2015-03-26 8:15 GMT-05:00 > >>> Subject: Perl MySQL question > >>> To: chicago-talk at pm.org > >>> > >>> > >>> Hello All, > >>> > >>> What would be the easiest way to display query results from a > MySQL database -- running on a Debian machine -- onto a webpage. > What I would like is to allow a user to log in and be able to do a > few simple queries. I know enough perl and SQL to write the > queries via perl->DBI but I have never done any web programing. > What I mean is that I have written a lot of perl programs that > query databases and display the results on a console screen via > curses but never displayed results onto the www. I'm guessing that > I might need to install Apache but really have no clue beyond that. > >>> > >>> > >>> PS It does not have to be anything fancy. > >>> > >>> Any help would be greatly appreciated. > >>> > >>> Richard > >>> > >>> > >>> > >>> _______________________________________________ > >>> Chicago-talk mailing list > >>> Chicago-talk at pm.org > >>> http://mail.pm.org/mailman/listinfo/chicago-talk > >> > >> > >> -- > >> > >> Alan D. Mead, Ph.D. > >> President, Talent Algorithms Inc. > >> > >> science + technology = better workers > >> > >> +815.588.3846 (Office) > >> +267.334.4143 (Mobile) > >> > >> http://www.alanmead.org > >> > >> Announcing the Journal of Computerized Adaptive Testing (JCAT), a > >> peer-reviewed electronic journal designed to advance the > science and > >> practice of computerized adaptive testing: > http://www.iacat.org/jcat > >> > >> > >> _______________________________________________ > >> Chicago-talk mailing list > >> Chicago-talk at pm.org > >> http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk at pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -- Alan D. Mead, Ph.D. President, Talent Algorithms Inc. science + technology = better workers +815.588.3846 (Office) +267.334.4143 (Mobile) http://www.alanmead.org Announcing the Journal of Computerized Adaptive Testing (JCAT), a peer-reviewed electronic journal designed to advance the science and practice of computerized adaptive testing: http://www.iacat.org/jcat -------------- next part -------------- An HTML attachment was scrubbed... URL: From gatorreina at gmail.com Mon Mar 30 06:31:24 2015 From: gatorreina at gmail.com (Richard Reina) Date: Mon, 30 Mar 2015 08:31:24 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: <55194EA3.9030604@alanmead.org> References: <5514180F.5070204@alanmead.org> <55194EA3.9030604@alanmead.org> Message-ID: Alan, thanks for the tip. What if I were to use dreamweaver to create the HTML part? Would that make things easier for me? 2015-03-30 8:24 GMT-05:00 Alan Mead : > Richard, > > In my earlier reply, I should have emphasized a point: if you decide to > write a CGI, you'll be using Perl (and you'll need to learn a bit about how > Apache works). If you choose a framework, then you will probably be > working with that framework or with smaller amounts of Perl to manipulate > the objects of that framework. In other words, Perl isn't the most > important area of expertise for a framework; in order to get advice about a > framework, you'd do better to ask folks who use that framework. > > And if you are using a framework, then I recommend you start by installing > the framework on the server or a comparable server; there is no point in > studying a framework unless you have it to play with and you may find > differences in how easily you can install these frameworks. Once you have > one installed, then I'd see if there's a book available for it (even if > it's somewhat out-of-date). The kind of thing you're doing, is pretty > common. > > If you decide to go the CGI route, you could start with this old book: > http://www.oreilly.com/openbook/cgi/ch09_03.html , but I would fill in > the table using HTML::Temlplate: > http://search.cpan.org/~wonko/HTML-Template-2.95/lib/HTML/Template.pm#TMPL_LOOP > . Or, you could find many examples online: > http://www.google.com/search?q=perl+CGI+present+SQL+data+table+example, > like this one: > http://www.easysoft.com/developer/languages/perl/tutorial_data_web.html > > -Alan > > > On 3/30/2015 7:56 AM, Richard Reina wrote: > > Hey Everybody, > > Thanks for all the replies. Looks a little overwhelming but I will get > to studying and see if I can find my way. I'm sure I'll be back with more > questions but thanks again for all the ideas. > > Richard > > 2015-03-26 15:38 GMT-05:00 Joel Berger : > >> >> On Mar 26, 2015 10:53 AM, "Jim Thomason" wrote: >> > >> > I'd say that using Catalyst or any other MVC framework (my camp in this >> religious debate would be Mojolicious) is way overkill, especially for an >> initial simple pass. If you just want to get something braindead simple up >> and running lightning fast... >> > >> >> I have to strongly disagree. >> >> > 1) Get some sort of web server installed and configured. >> apache/nginx/one of the myriad perl servers, whatever. Ask your friendly >> local sysadmin for help and/or suggestions, if necessary. And as always, be >> concerned about security if this is public facing. >> >> Mojolicious or the PSGI compliant frameworks don't need any special >> servers, just modules which either come bundled or are installable from >> cpan. >> >> > >> > 2) Enable CGI in some manner - this is usually either enabling scripts >> in a certain directory, or things with a .cgi extension to be executable. >> >> Configuring CGI is painful, the above servers should "just work". >> >> > >> > 3) your cgi script is more or less the same as a command line script. >> If you're going to output just plain text (as you would have if you were >> sending to the screen or piping it to a file), just add this to the top: >> > >> > print "Content-type: text/plain\n\n"; >> > >> >> Whaaaa? Why print your own headers? That's what frameworks are for! >> >> > And you're done. That'll spit it out to the web and it'll look exactly >> the same as if you were sending it to a file. HTTP communication is really >> easy if you skirt a few of the rules - it really just needs a Content-type >> header so the browser knows the type of data it's receiving. There's more >> that you -should- do, and I don't suggest you do the above as a production >> run, but to get your feet wet and up and going, this'll have you spitting >> out text to the browser in under an hour. >> >> A mojolicious "hello world" is right on the main site and work need to be >> modified very little to make work in the manner you suggest. If it takes >> you an hour you might be doing it wrong. >> >> > >> > ...and now that the simple start up pleasantries are out of the way... >> > >> > First of all, you need to worry about security - make sure that the >> user can't send in arbitrary SQL queries to your server, ESPECIALLY if it's >> not firewalled off for only authorized users. The last thing you'd need is >> an open arbitrary SQL gateway that allows any black hat to come in and run >> an insert/update/drop table/alter table statement. This task is potentially >> non-trivial, but at a minimum, don't write it to accept arbitrary SQL from >> the browser. >> > >> > The CGI module is pretty popular for the IO requirements here. There >> are myriad other derivatives - CGI::Lite, CGI::Minimal, etc. Use whatever's >> handy. That'll give you better header handling, and simpler processing for >> reading in options passed by the user. >> > >> > Next, to pretty it up, templating libraries like Text::Template or >> HTML::Template can help layout an interface for you. >> > >> > You may need login/user capabilities. You can do that with CGI and >> templating yourself, but it's a lot of infrastructure you need to set up. >> One of the frameworks may be more useful for you at this point. >> > >> > Nowadays, it's also very trendy to have your web front ends be >> javascript apps that handle all the layout and interface, and your >> communication back and forth to the server is all done by handing JSON >> objects or XML. So you might want to look into that as well. On the one >> hand, it makes the web front end more complicated and brings in different >> languages, but on the other it can keep the server side a lot simpler if >> you're only handing data structures back and forth to the client and >> letting the client side handle all the interaction. >> > >> > -Jim... >> >> Nothing personal, but cgi is really passe. Joel >> >> > >> > >> > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead wrote: >> >> >> >> Richard, >> >> >> >> I think that most people will tell you to use a web-based framework >> and some of them are optimized for this. >> >> >> >> But it's pretty simple to create a single-page CGI that displays some >> data and there are many examples available online. I find HTML::Template >> to have a fairly easy interface for creating HTML tables from DBI queries. >> Probably a key issue is how much other infrastrcture you need. For >> example, if people need to login, that's going to make a simple CGI a bad >> idea. >> >> >> >> -Alan >> >> >> >> >> >> >> >> On 3/26/2015 8:59 AM, Richard Reina wrote: >> >>> >> >>> >> >>> ---------- Forwarded message ---------- >> >>> From: Richard Reina >> >>> Date: 2015-03-26 8:15 GMT-05:00 >> >>> Subject: Perl MySQL question >> >>> To: chicago-talk at pm.org >> >>> >> >>> >> >>> Hello All, >> >>> >> >>> What would be the easiest way to display query results from a MySQL >> database -- running on a Debian machine -- onto a webpage. What I would >> like is to allow a user to log in and be able to do a few simple queries. I >> know enough perl and SQL to write the queries via perl->DBI but I have >> never done any web programing. What I mean is that I have written a lot of >> perl programs that query databases and display the results on a console >> screen via curses but never displayed results onto the www. I'm guessing >> that I might need to install Apache but really have no clue beyond that. >> >>> >> >>> >> >>> PS It does not have to be anything fancy. >> >>> >> >>> Any help would be greatly appreciated. >> >>> >> >>> Richard >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> Chicago-talk mailing list >> >>> Chicago-talk at pm.org >> >>> http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> >> >> >> -- >> >> >> >> Alan D. Mead, Ph.D. >> >> President, Talent Algorithms Inc. >> >> >> >> science + technology = better workers >> >> >> >> +815.588.3846 (Office) >> >> +267.334.4143 (Mobile) >> >> >> >> http://www.alanmead.org >> >> >> >> Announcing the Journal of Computerized Adaptive Testing (JCAT), a >> >> peer-reviewed electronic journal designed to advance the science and >> >> practice of computerized adaptive testing: http://www.iacat.org/jcat >> >> >> >> >> >> _______________________________________________ >> >> Chicago-talk mailing list >> >> Chicago-talk at pm.org >> >> http://mail.pm.org/mailman/listinfo/chicago-talk >> > >> > >> > >> > _______________________________________________ >> > Chicago-talk mailing list >> > Chicago-talk at pm.org >> > http://mail.pm.org/mailman/listinfo/chicago-talk >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk >> > > > > _______________________________________________ > Chicago-talk mailing listChicago-talk at pm.orghttp://mail.pm.org/mailman/listinfo/chicago-talk > > > -- > > Alan D. Mead, Ph.D. > President, Talent Algorithms Inc. > > science + technology = better workers > > +815.588.3846 (Office) > +267.334.4143 (Mobile) > http://www.alanmead.org > > Announcing the Journal of Computerized Adaptive Testing (JCAT), a > peer-reviewed electronic journal designed to advance the science and > practice of computerized adaptive testing: http://www.iacat.org/jcat > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amead2 at alanmead.org Mon Mar 30 06:46:42 2015 From: amead2 at alanmead.org (Alan Mead) Date: Mon, 30 Mar 2015 08:46:42 -0500 Subject: [Chicago-talk] Fwd: Perl MySQL question In-Reply-To: References: <5514180F.5070204@alanmead.org> <55194EA3.9030604@alanmead.org> Message-ID: <551953C2.7020308@alanmead.org> I don't know; I lightly used DW about 10 years ago. I'm not aware that Dreamwaever directly supports HTML::Templates. If not, then you could always generate HTML (and CSS) using your favorite tools and then modify them to be tempates. The details of "templatizing" would depend on your final solution. The example from easysoft shows how to create a template for an HTML table using HTML::Templates. -Alan On 3/30/2015 8:31 AM, Richard Reina wrote: > Alan, thanks for the tip. What if I were to use dreamweaver to create > the HTML part? Would that make things easier for me? > > 2015-03-30 8:24 GMT-05:00 Alan Mead >: > > Richard, > > In my earlier reply, I should have emphasized a point: if you > decide to write a CGI, you'll be using Perl (and you'll need to > learn a bit about how Apache works). If you choose a framework, > then you will probably be working with that framework or with > smaller amounts of Perl to manipulate the objects of that > framework. In other words, Perl isn't the most important area of > expertise for a framework; in order to get advice about a > framework, you'd do better to ask folks who use that framework. > > And if you are using a framework, then I recommend you start by > installing the framework on the server or a comparable server; > there is no point in studying a framework unless you have it to > play with and you may find differences in how easily you can > install these frameworks. Once you have one installed, then I'd > see if there's a book available for it (even if it's somewhat > out-of-date). The kind of thing you're doing, is pretty common. > > If you decide to go the CGI route, you could start with this old > book: http://www.oreilly.com/openbook/cgi/ch09_03.html , but I > would fill in the table using HTML::Temlplate: > http://search.cpan.org/~wonko/HTML-Template-2.95/lib/HTML/Template.pm#TMPL_LOOP > > . Or, you could find many examples online: > http://www.google.com/search?q=perl+CGI+present+SQL+data+table+example, > like this one: > http://www.easysoft.com/developer/languages/perl/tutorial_data_web.html > > -Alan > > > On 3/30/2015 7:56 AM, Richard Reina wrote: >> Hey Everybody, >> >> Thanks for all the replies. Looks a little overwhelming but I >> will get to studying and see if I can find my way. I'm sure I'll >> be back with more questions but thanks again for all the ideas. >> >> Richard >> >> 2015-03-26 15:38 GMT-05:00 Joel Berger > >: >> >> >> On Mar 26, 2015 10:53 AM, "Jim Thomason" > > wrote: >> > >> > I'd say that using Catalyst or any other MVC framework (my >> camp in this religious debate would be Mojolicious) is way >> overkill, especially for an initial simple pass. If you just >> want to get something braindead simple up and running >> lightning fast... >> > >> >> I have to strongly disagree. >> >> > 1) Get some sort of web server installed and configured. apache/nginx/one of the >> myriad perl servers, whatever. Ask your friendly local >> sysadmin for help and/or suggestions, if necessary. And as >> always, be concerned about security if this is public facing. >> >> Mojolicious or the PSGI compliant frameworks don't need any >> special servers, just modules which either come bundled or >> are installable from cpan. >> >> > >> > 2) Enable CGI in some manner - this is usually either >> enabling scripts in a certain directory, or things with a >> .cgi extension to be executable. >> >> Configuring CGI is painful, the above servers should "just work". >> >> > >> > 3) your cgi script is more or less the same as a command >> line script. If you're going to output just plain text (as >> you would have if you were sending to the screen or piping it >> to a file), just add this to the top: >> > >> > print "Content-type: text/plain\n\n"; >> > >> >> Whaaaa? Why print your own headers? That's what frameworks >> are for! >> >> > And you're done. That'll spit it out to the web and it'll look exactly the same as if >> you were sending it to a file. HTTP communication is really >> easy if you skirt a few of the rules - it really just needs a >> Content-type header so the browser knows the type of data >> it's receiving. There's more that you -should- do, and I >> don't suggest you do the above as a production run, but to >> get your feet wet and up and going, this'll have you spitting >> out text to the browser in under an hour. >> >> A mojolicious "hello world" is right on the main site and >> work need to be modified very little to make work in the >> manner you suggest. If it takes you an hour you might be >> doing it wrong. >> >> > >> > ...and now that the simple start up pleasantries are out of >> the way... >> > >> > First of all, you need to worry about security - make sure >> that the user can't send in arbitrary SQL queries to your >> server, ESPECIALLY if it's not firewalled off for only >> authorized users. The last thing you'd need is an open >> arbitrary SQL gateway that allows any black hat to come in >> and run an insert/update/drop table/alter table statement. >> This task is potentially non-trivial, but at a minimum, don't >> write it to accept arbitrary SQL from the browser. >> > >> > The CGI module is pretty popular for the IO requirements >> here. There are myriad other derivatives - CGI::Lite, >> CGI::Minimal, etc. Use whatever's handy. That'll give you >> better header handling, and simpler processing for reading in >> options passed by the user. >> > >> > Next, to pretty it up, templating libraries like >> Text::Template or HTML::Template can help layout an interface >> for you. >> > >> > You may need login/user capabilities. You can do that with >> CGI and templating yourself, but it's a lot of infrastructure >> you need to set up. One of the frameworks may be more useful >> for you at this point. >> > >> > Nowadays, it's also very trendy to have your web front ends >> be javascript apps that handle all the layout and interface, >> and your communication back and forth to the server is all >> done by handing JSON objects or XML. So you might want to >> look into that as well. On the one hand, it makes the web >> front end more complicated and brings in different languages, >> but on the other it can keep the server side a lot simpler if >> you're only handing data structures back and forth to the >> client and letting the client side handle all the interaction. >> > >> > -Jim... >> >> Nothing personal, but cgi is really passe. Joel >> >> > >> > >> > On Thu, Mar 26, 2015 at 9:30 AM, Alan Mead >> > wrote: >> >> >> >> Richard, >> >> >> >> I think that most people will tell you to use a web-based >> framework and some of them are optimized for this. >> >> >> >> But it's pretty simple to create a single-page CGI that >> displays some data and there are many examples available >> online. I find HTML::Template to have a fairly easy >> interface for creating HTML tables from DBI queries. Probably >> a key issue is how much other infrastrcture you need. For >> example, if people need to login, that's going to make a >> simple CGI a bad idea. >> >> >> >> -Alan >> >> >> >> >> >> >> >> On 3/26/2015 8:59 AM, Richard Reina wrote: >> >>> >> >>> >> >>> ---------- Forwarded message ---------- >> >>> From: Richard Reina > > >> >>> Date: 2015-03-26 8:15 GMT-05:00 >> >>> Subject: Perl MySQL question >> >>> To: chicago-talk at pm.org >> >>> >> >>> >> >>> Hello All, >> >>> >> >>> What would be the easiest way to display query results >> from a MySQL database -- running on a Debian machine -- onto >> a webpage. What I would like is to allow a user to log in and >> be able to do a few simple queries. I know enough perl and >> SQL to write the queries via perl->DBI but I have never done >> any web programing. What I mean is that I have written a lot >> of perl programs that query databases and display the results >> on a console screen via curses but never displayed results >> onto the www. I'm guessing that I might need to install >> Apache but really have no clue beyond that. >> >>> >> >>> >> >>> PS It does not have to be anything fancy. >> >>> >> >>> Any help would be greatly appreciated. >> >>> >> >>> Richard >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> Chicago-talk mailing list >> >>> Chicago-talk at pm.org >> >>> http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> >> >> >> -- >> >> >> >> Alan D. Mead, Ph.D. >> >> President, Talent Algorithms Inc. >> >> >> >> science + technology = better workers >> >> >> >> +815.588.3846 (Office) >> >> +267.334.4143 (Mobile) >> >> >> >> http://www.alanmead.org >> >> >> >> Announcing the Journal of Computerized Adaptive Testing >> (JCAT), a >> >> peer-reviewed electronic journal designed to advance the >> science and >> >> practice of computerized adaptive testing: >> http://www.iacat.org/jcat >> >> >> >> >> >> _______________________________________________ >> >> Chicago-talk mailing list >> >> Chicago-talk at pm.org >> >> http://mail.pm.org/mailman/listinfo/chicago-talk >> > >> > >> > >> > _______________________________________________ >> > Chicago-talk mailing list >> > Chicago-talk at pm.org >> > http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> >> >> _______________________________________________ >> Chicago-talk mailing list >> Chicago-talk at pm.org >> http://mail.pm.org/mailman/listinfo/chicago-talk > > -- > > Alan D. Mead, Ph.D. > President, Talent Algorithms Inc. > > science + technology = better workers > > +815.588.3846 (Office) > +267.334.4143 (Mobile) > > http://www.alanmead.org > > Announcing the Journal of Computerized Adaptive Testing (JCAT), a > peer-reviewed electronic journal designed to advance the science and > practice of computerized adaptive testing: http://www.iacat.org/jcat > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -- Alan D. Mead, Ph.D. President, Talent Algorithms Inc. science + technology = better workers +815.588.3846 (Office) +267.334.4143 (Mobile) http://www.alanmead.org Announcing the Journal of Computerized Adaptive Testing (JCAT), a peer-reviewed electronic journal designed to advance the science and practice of computerized adaptive testing: http://www.iacat.org/jcat -------------- next part -------------- An HTML attachment was scrubbed... URL: From JJacobus at PonyX.com Mon Mar 30 09:17:28 2015 From: JJacobus at PonyX.com (Jim Jacobus) Date: Mon, 30 Mar 2015 11:17:28 -0500 Subject: [Chicago-talk] Testing if Page exists. Message-ID: <20150330164233.893DD11EE07@xx1.develooper.com> I have a program where I want to test if numerous html product pages exist at various customer websites. I'm trying to figure out what is the lightest and fastest way to do this. Essentially, I just want to find out if, for any given url, I get a 404 or 200 response. Don't want to download the whole page, but I don't know if that is possible. Tried LWP::Simple and HTTP::Request with various results. Any recommendations? Jim Jacobus From andy at petdance.com Mon Mar 30 09:46:19 2015 From: andy at petdance.com (Andy Lester) Date: Mon, 30 Mar 2015 11:46:19 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <20150330164233.893DD11EE07@xx1.develooper.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> Message-ID: > On Mar 30, 2015, at 11:17 AM, Jim Jacobus wrote: > > Tried LWP::Simple and HTTP::Request with various results. What were those various results? Did they not work for you? What was wrong? -- Andy Lester => www.petdance.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From JJacobus at PonyX.com Mon Mar 30 10:10:00 2015 From: JJacobus at PonyX.com (Jim Jacobus) Date: Mon, 30 Mar 2015 12:10:00 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: References: <20150330164233.893DD11EE07@xx1.develooper.com> Message-ID: <20150330171005.C936B11EB69@xx1.develooper.com> At 11:46 AM 3/30/2015, you wrote: >>On Mar 30, 2015, at 11:17 AM, Jim Jacobus >><JJacobus at PonyX.com> wrote: >> >>Tried LWP::Simple and HTTP::Request with various results. > >What were those various results? Did they not work for you? What was wrong? LWP::Simple & LWP::Useragent returned the page, but the pages are fairly dense with a lot of embedded javascript, embedded forms and ads the are being served up. All of which I don't need. It's just taking a lot of time and memory. I was just looking for something that would just give me a 404 or 200 or stop reading at the some place like the end of the /head tag. I'm trying to test out thousands of URLs which is the real problem. (This may not be possible.) >-- >Andy Lester => www.petdance.com > >_______________________________________________ >Chicago-talk mailing list >Chicago-talk at pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From younda at gmail.com Mon Mar 30 10:20:46 2015 From: younda at gmail.com (David J. Young) Date: Mon, 30 Mar 2015 12:20:46 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <20150330171005.C936B11EB69@xx1.develooper.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> Message-ID: You should be able to use a HTTP "HEAD" request instead of a "GET" or "POST" ydy -- There are only 10 types of people in the world; those that understand binary and those that don't. On Mon, Mar 30, 2015 at 12:10 PM, Jim Jacobus wrote: > At 11:46 AM 3/30/2015, you wrote: > > > On Mar 30, 2015, at 11:17 AM, Jim Jacobus wrote: > > Tried LWP::Simple and HTTP::Request with various results. > > > What were those various results? Did they not work for you? What was > wrong? > > > LWP::Simple & LWP::Useragent returned the page, but the pages are fairly > dense with a lot of embedded javascript, embedded forms and ads the are > being served up. All of which I don't need. It's just taking a lot of time > and memory. I was just looking for something that would just give me a 404 > or 200 or stop reading at the some place like the end of the /head tag. I'm > trying to test out thousands of URLs which is the real problem. (This may > not be possible.) > > > -- > Andy Lester => www.petdance.com > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at petdance.com Mon Mar 30 11:00:25 2015 From: andy at petdance.com (Andy Lester) Date: Mon, 30 Mar 2015 13:00:25 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <20150330171005.C936B11EB69@xx1.develooper.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> Message-ID: <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> > LWP::Simple & LWP::Useragent returned the page, but the pages are fairly dense with a lot of embedded javascript, embedded forms and ads the are being served up. All of which I don't need. It's just taking a lot of time and memory. I was just looking for something that would just give me a 404 or 200 or stop reading at the some place like the end of the /head tag. I'm trying to test out thousands of URLs which is the real problem. (This may not be possible.) You can use the LWP::Simple head() function like David said, but head() vs. get() is all-or-nothing. There?s no way to say ?Give me the page up to the and of the tag?. I?m curious as to how these pages are taking a lot of memory. You?re not storing them, are you? What memory problems are you running into? What?s the problem that you?re actually trying to solve? Is it taking too long to do those 1000 URL checks? How long is it taking, and how long would you like it to take? -- Andy Lester => www.petdance.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From hal.wigoda at gmail.com Mon Mar 30 11:30:57 2015 From: hal.wigoda at gmail.com (Hal Wigoda) Date: Mon, 30 Mar 2015 13:30:57 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> Message-ID: How about the Command "curl"? On Mon, Mar 30, 2015 at 1:00 PM, Andy Lester wrote: > LWP::Simple & LWP::Useragent returned the page, but the pages are fairly > dense with a lot of embedded javascript, embedded forms and ads the are > being served up. All of which I don't need. It's just taking a lot of time > and memory. I was just looking for something that would just give me a 404 > or 200 or stop reading at the some place like the end of the /head tag. I'm > trying to test out thousands of URLs which is the real problem. (This may > not be possible.) > > > You can use the LWP::Simple head() function like David said, but head() > vs. get() is all-or-nothing. There?s no way to say ?Give me the page up to > the and of the tag?. > > I?m curious as to how these pages are taking a lot of memory. You?re not > storing them, are you? What memory problems are you running into? > > What?s the problem that you?re actually trying to solve? Is it taking too > long to do those 1000 URL checks? How long is it taking, and how long > would you like it to take? > > -- > Andy Lester => www.petdance.com > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -- ----------------- Hal Wigoda Chicago -------------- next part -------------- An HTML attachment was scrubbed... URL: From JJacobus at PonyX.com Mon Mar 30 12:06:15 2015 From: JJacobus at PonyX.com (Jim Jacobus) Date: Mon, 30 Mar 2015 14:06:15 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> Message-ID: <20150330190949.C4C1611EB68@xx1.develooper.com> At 01:00 PM 3/30/2015, you wrote: >>LWP::Simple & LWP::Useragent returned the page, >>but the pages are fairly dense with a lot of >>embedded javascript, embedded forms and ads the >>are being served up. All of which I don't need. >>It's just taking a lot of time and memory. I >>was just looking for something that would just >>give me a 404 or 200 or stop reading at the >>some place like the end of the /head tag. I'm >>trying to test out thousands of URLs which is >>the real problem. (This may not be possible.) > >You can use the LWP::Simple head() function like >David said, but head() vs. get() is >all-or-nothing. There???s no way to say ???Give >me the page up to the and of the tag???. That's what I thought. >I???m curious as to how these pages are taking a >lot of memory. You???re not storing them, are >you? What memory problems are you running into? Ouch. Just fixed the memory problem. I was stupidly adding instead of re-using the string. That fixed that. >What???s the problem that you???re actually >trying to solve? Is it taking too long to do >those 100x 0 URL checks? How long is it taking, >and how long would you like it to take? The fetches were taking anywhere from 20-60 seconds each. The remote side is taking a long time to fetch the parts of the page out of several databases before it starts sending results. That's a problem of poor design on their side that I was hoping to work around. Thanks for your help. >-- >Andy Lester => www.petdance.com > >_______________________________________________ >Chicago-talk mailing list >Chicago-talk at pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From JJacobus at PonyX.com Mon Mar 30 12:09:44 2015 From: JJacobus at PonyX.com (Jim Jacobus) Date: Mon, 30 Mar 2015 14:09:44 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> Message-ID: <20150330190949.EAC8211EB8C@xx1.develooper.com> At 01:30 PM 3/30/2015, you wrote: >How about the Command "curl"? Curl or wget would take longer since I'd have to make a system() call and then parse the resulting file. >On Mon, Mar 30, 2015 at 1:00 PM, Andy Lester ><andy at petdance.com> wrote: >>LWP::Simple & LWP::Useragent returned the page, >>but the pages are fairly dense with a lot of >>embedded javascript, embedded forms and ads the >>are being served up. All of which I don't need. >>It's just taking a lot of time and memory. I >>was just looking for something that would just >>give me a 404 or 200 or stop reading at the >>some place like the end of the /head tag. I'm >>trying to test out thousands of URLs which is >>the real problem. (This may not be possible.) > >You can use the LWP::Simple head() function like >David said, but head() vs. get() is >all-or-nothing.? There???s no way to say >???Give me the page up to the and of the tag???. > >I???m curious as to how these pages are taking a >lot of memory.? You???re not storing them, are >you?? What memory problems are you running into? > >What???s the problem that you???re actually >trying to solve?? Is it taking too long to do >those 1000 URL checks?? How long is it taking, >and how long wouldx you like it to take? > >-- >Andy Lester =>? www.petdance.com > > >_______________________________________________ >Chicago-talk mailing list >Chicago-talk at pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk > > > > >-- >----------------- >Hal Wigoda >Chicago >_______________________________________________ >Chicago-talk mailing list >Chicago-talk at pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at petdance.com Mon Mar 30 12:13:59 2015 From: andy at petdance.com (Andy Lester) Date: Mon, 30 Mar 2015 14:13:59 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: <20150330190949.C4C1611EB68@xx1.develooper.com> References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> <20150330190949.C4C1611EB68@xx1.develooper.com> Message-ID: > On Mar 30, 2015, at 2:06 PM, Jim Jacobus wrote: > > The fetches were taking anywhere from 20-60 seconds each. The remote side is taking a long time to fetch the parts of the page out of several databases before it starts sending results. That's a problem of poor design on their side that I was hoping to work around. > Thanks for your help. LWP::Parallel might help you by making multiple requests at the same time. http://search.cpan.org/dist/ParallelUserAgent/ -- Andy Lester => www.petdance.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From joel.a.berger at gmail.com Tue Mar 31 07:11:52 2015 From: joel.a.berger at gmail.com (Joel Berger) Date: Tue, 31 Mar 2015 09:11:52 -0500 Subject: [Chicago-talk] Testing if Page exists. In-Reply-To: References: <20150330164233.893DD11EE07@xx1.develooper.com> <20150330171005.C936B11EB69@xx1.develooper.com> <4E9A09D0-4086-473C-BF62-3621BA11574A@petdance.com> <20150330190949.C4C1611EB68@xx1.develooper.com> Message-ID: Mojo::UserAgent and Mojo::IOLoop can be used to make simultaneous non-blocking requests. I have some blog posts at http://blogs.perl.org/users/joel_berger/ and there are examples in the documentation at http://mojolicio.us/perldoc On Mon, Mar 30, 2015 at 2:13 PM, Andy Lester wrote: > > On Mar 30, 2015, at 2:06 PM, Jim Jacobus wrote: > > The fetches were taking anywhere from 20-60 seconds each. The remote side > is taking a long time to fetch the parts of the page out of several > databases before it starts sending results. That's a problem of poor design > on their side that I was hoping to work around. > Thanks for your help. > > > LWP::Parallel might help you by making multiple requests at the same time. > > http://search.cpan.org/dist/ParallelUserAgent/ > > -- > Andy Lester => www.petdance.com > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: