Tux

...making Linux just a little more fun!

Pointers to Perl CGI Resources

Ramanathan Muthaiah [rus.cahimb at gmail.com]
Wed, 18 Oct 2006 19:40:59 +0530

Hi Gang,

I could have Googl-ed to find plentiful of answers but decided otherwise to seek wisdom here.

My plans are to develop simple web-based application using Perl scripts and MySQL as back-end for data storage. Am planning to host the application using Apache http server. Am aware that Perl modules (DBI) are needed to interact with database. I have little knowledge of db design.

My question :

Am lost here, how to start this whole activity ? Reason is, am not comfortable in embedding the Perl scripts with HTML tags and regular functions for data management needs.

Intention is to keep the, scripts providing the front-end and back-end processing, separate and not mix all in the same script(s).

Looking forward to your suggestions.

/Ram


Top    Back


Thomas Adam [thomas.adam22 at gmail.com]
Wed, 18 Oct 2006 15:39:58 +0100

On Wed, 18 Oct 2006 19:40:59 +0530 "Ramanathan Muthaiah" <rus.cahimb at gmail.com> wrote:

> My plans are to develop simple web-based application using Perl
> scripts and MySQL as back-end for data storage. Am planning to host
> the application using Apache http server. Am aware that Perl modules
> (DBI) are needed to interact with database. I have little knowledge of
> db design.

Getting this part correct is paramount. I have no idea what the scale of your project is, but even a little knowledge of normalisation would go a long way into helping you. This is the main area your time should be focused on, since if you can't define your database schema with any reliability the whole thing will fall apart at the seams.

> My question :
> 
> Am lost here, how to start this whole activity ? Reason is, am not
> comfortable in embedding the Perl scripts with HTML tags and regular
> functions for data management needs.

That's not how it works. Ideally your CGI pages should just be perl scripts which run via mod_perl. There's always things like the CGI module and CARP to help you.

I realise this is a non-useful reply, but if you can be more specific about your requirements, then maybe we can tailor our answers to you.

-- Thomas Adam


Top    Back


Ramanathan Muthaiah [rus.cahimb at gmail.com]
Thu, 19 Oct 2006 00:49:51 +0530

> Getting this part correct is paramount.  I have no idea what the
> scale of your project is, but even a little knowledge of normalisation
> would go a long way into helping you.  This is the main area your time
> should be focused on, since if you can't define your database schema
> with any reliability the whole thing will fall apart at the seams.

Thanks for your suggestions. This should probably help me to address this topic with much care while designing the db; of course, the project is aimed at a group of ~40 developers but if the tool turns out be valuable (in terms of increasing productivity), then may be others ask for it.

Do you think, mysql documentation would be a good place to start ?

> That's not how it works.  Ideally your CGI pages should just be perl
> scripts which run via mod_perl.  There's always things like the CGI
> module and CARP to help you.
>
> I realise this is a non-useful reply, but if you can be more specific
> about your requirements, then maybe we can tailor our answers to you.

Am not at my workplace now to provide sample of code which takes care of the initial screen but I think this would not be starting point for me.

Yes, am planning to use CGI module.

Incidentally, I stumbled upon this mod_perl thing but unable to understand the adv of mod_perl over CGI.

Second, am still in a dilemma which OS env to use ? Linux or Win.

I prefer Linux as, almost all these are already available in my home system running Fedora core 5.

/Ram


Top    Back


Thomas Adam [thomas.adam22 at gmail.com]
Wed, 18 Oct 2006 22:31:41 +0100

On Thu, Oct 19, 2006 at 12:49:51AM +0530, Ramanathan Muthaiah wrote:

> Thanks for your suggestions. This should probably help me to address
> this topic with much care while designing the db; of course, the
> project is aimed at a group of ~40 developers but if the tool turns
> out be valuable (in terms of increasing productivity), then may be
> others ask for it.
> 
> Do you think, mysql documentation would be a good place to start ?

You seem to be skirting around a more fundamental problem: not knowing where to start. If this is the case, it makes me wonder just how efficient the thing is that you're trying to do. Do the people this project is aimed at (and you've said there's fourty of them) have any idea about Perl/MySQL integration? If not, you're screwed.

> Yes, am planning to use CGI module.
> 
> Incidentally, I stumbled upon this mod_perl thing but unable to
> understand the adv of mod_perl over CGI.

Umm, because generally CGIs suck? What happens is that the interpreter (for whatever language the CGI is written in; in this case Perl) is spawned for every instance the page is viewed. Hence you can quickly see how slow and cumbersome it would get for a multi-user environment. Not to mention that persistent states would be compromised. At least if it is via mod_perl, it's Apache which spawns the process. This means that only one instance need be created for all instances it is viewed at if it is concurrent.

> Second, am still in a dilemma which OS env to use ? Linux or Win.

I'd go with RISCOS; the name seems more apt in this instance.

> I prefer Linux as, almost all these are already available in my home
> system running Fedora core 5.

Then there you go. ;) Again, until you provide more details, I can't help you. Note that my day job is perl programming with CGIs, so make use of this resource. :P

-- Thomas Adam

-- 
"If I were a witch's hat, sitting on her head like a paraffin stove, I'd
fly away and be a bat." -- Incredible String Band.


Top    Back


Ramanathan Muthaiah [rus.cahimb at gmail.com]
Thu, 26 Oct 2006 20:48:55 +0530

> You seem to be skirting around a more fundamental problem:  not knowing
> where to start.  If this is the case, it makes me wonder just how
> efficient the thing is that you're trying to do.  Do the people this
> project is aimed at (and you've said there's fourty of them) have any
> idea about Perl/MySQL integration?  If not, you're screwed.

Couple of years back, I have been introduced and worked on mysql but for very limited time (~ 6 months with no formal training) as part of requirement to develop web based application / tools. Though, I remember (very vaguely) some of the concepts but need to refresh the basics and those parts that will be needed for the current assignment.

>
> Umm, because generally CGIs suck?  What happens is that the interpreter
> (for whatever language the CGI is written in; in this case Perl) is
> spawned for every instance the page is viewed.  Hence you can quickly
> see how slow and cumbersome it would get for a multi-user environment.
> Not to mention that persistent states would be compromised.  At least if
> it is via mod_perl, it's Apache which spawns the process.  This means
> that only one instance need be created for all instances it is viewed at
> if it is concurrent.
>

That sounds like, mod_perl is the way to go.

> Then there you go.  ;)  Again, until you provide more details, I can't
> help you.  Note that my day job is perl programming with CGIs, so make
> use of this resource.  :P
>

I have written / come up with basic script (very very primitive to say the least) which I would like to share with you.

It was heartening to note that you are willing to extend your guidance in this regd. Thanks very much.

Hence, am considering to take your help / mentoring in this project (personally, I would like to make this happen, even if I do not have the chance to setup this project at my workplace, it will give me needed exp with web-based appln development), if you are willing.

/Ramanathan


Top    Back


Thomas Adam [thomas.adam22 at gmail.com]
Thu, 26 Oct 2006 16:30:21 +0100

On Thu, 26 Oct 2006 20:48:55 +0530 "Ramanathan Muthaiah" <rus.cahimb at gmail.com> wrote:

> Couple of years back, I have been introduced and worked on mysql but
> for very limited time (~ 6 months with no formal training) as part of
> requirement to develop web based application / tools. Though, I
> remember (very vaguely) some of the concepts but need to refresh the
> basics and those parts that will be needed for the current assignment.

"Assignment?" -- I hope this isn't some form of homework in disguise. :)

> It was heartening to note that you are willing to extend your guidance
> in this regd. Thanks very much.

Guidance yes, but I am not going to write it for you. I am not a consultant.

-- Thomas Adam


Top    Back


Ramanathan Muthaiah [rus.cahimb at gmail.com]
Thu, 26 Oct 2006 23:18:00 +0530

> "Assignment?" -- I hope this isn't some form of homework in
> disguise.  :)

Certainly, it's not that kind; but it is something, I tell / impose to myself to improve skills and keep alive my interests in technical things (and not just spend the rest of my preofessional career in only management). Of course, there is a day job which keeps me busy for the most part :-)

> Guidance yes, but I am not going to write it for you.  I am not a
> consultant.

Sure, that's not fair on my part to ask others to do my work; i do not stand to gain anything in that way.

/Ramanathan


Top    Back