http://www.perlmonks.org?node_id=143107


in reply to OOP

I'll admit that my approach to programming in perl may be wrong, but i like challenges, however stupid they may make me. All of your points were 100% valid Ovid, and i'll agree with you to a certain extent. I will admit that i do use certain modules, ie DBI and the DBD modules... Even though i avoid cgi.pm, i do not avoid use strict;, -w, and -t. I'm not all that stupid ya know ;).

The main reason's why i don't use cgi.pm...

file uploading: It's ridiculously the simple way out for beginners... i chuckle when i see upload engines made with cgi.pm because it involves no actual parsing of code. If you look at any perl directory (hotscripts.com, perlarchive.com, cgi-resources.com), anything related to file uploading uses cgi.pm. It bothered me to see all programs which root back to the same place. Until i fully understand how cgi.pm (just one of many modules) works, i'll try to work my own way out of situations not because i'm full of pride, but just because it wouldn't be fair to myself.

Parsing query strings: i will sooner or later use cgi.pm for parsing just because it is the smarter way to deal with situations. For my scripts right now, i think that the code provided suits me well. I also don't use cgi.pm cuz that has OOP in it (going back and forth here), so that's why i want to get a good grep() on OOP. I shouldn't have said "as effective as cgi.pm" though.. sorry

I would love to get u'r opinion on my upload engine though Ovid. I know i'll get more people telling me i should use modules, and i will, when i learn to do what they do for the most part.

Forgot to thank everyone for their comments on OOP.. thanx :D. Thanks for the lil' talk Ovid.

Replies are listed 'Best First'.
Re: Re: OOP
by chromatic (Archbishop) on Feb 03, 2002 at 23:16 UTC
    Until i fully understand how cgi.pm (just one of many modules) works, i'll try to work my own way out of situations

    I agree with Ovid and tilly, but I'm not going to debate this point. Follow the links if you'd like to get my position.

    As a fellow programmer, a Saint here, a Perl 5 Porter, and an author, I have a request of you. Please do not share this code with anyone else. If you do feel compelled to share it, or to use it on the public Internet, please put up strong disclaimers that say, "Do not use this code. I don't know what I'm doing. This is not representative of the Perl language as a whole, good Perl programming practices, modules on the CPAN, or more experienced Perl programmers. Any and all errors and flaws in this code are my own learning experiences, and should not reflect badly upon anyone but myself."

    I don't mean this to sound harsh or flippant. I'd just like to stem the tide of bad code being distributed and re-used. If you want to reinvent wheels for your own education, fine. Please don't make things harder for the rest of us who have to deal with bad code on a daily basis.

    Thank you.

    Update: Removed some punctuation that affected the tone for the worse.

      Oh, if only someone had told Matt that so many years ago. What a different place the internet might be.



      Charles K. Clarkson
      Clarkson Energy Homes, Inc.
        Hey, my stuff's not that bad. ;-)
Re (tilly) 2: OOP
by tilly (Archbishop) on Feb 03, 2002 at 22:48 UTC
    This is a point of view that comes up every so often. While the idea of only using what you understand seems reasonable, actually it is seriously wrong for trivial reasons. If you think that you are actually doing this, then the only question is where you start lying to yourself. Because I guarantee you that that you are using stuff that you don't understand all of the time. You can't help doing so if you are getting anything useful done at all, from "Hello, World" on up.

    For an instance of a past conversation like this see Modules Vs. Manual Coding. I entered that thread fairly late at Re (tilly) 3: Modules Vs. Manual Coding. (A response that was somewhat heated for reasons that ichimunki stated.)

    About your code as presented, suppose that you write all of your scripts like this. Suppose that some day you have a form that managed to get over 2K of data in it. Your code would break, you would have no idea why it was broken, and if you were told why you would have no easy way to fix it. If you used CGI you would be able to change one word in one place and it all would work.

    For this and other reasons, I strongly recommend that instead of trying the futile path of understanding every single thing you ever use, learn to leverage effectively off of the work of others. (Which eventually leads to the attitudes I suggest at Re (tilly) 1: What if you are not a genius?.)

Re: Re: OOP
by BazB (Priest) on Feb 03, 2002 at 21:44 UTC

    Parham said:


    I also don't use cgi.pm cuz that has OOP in it.

    TMTOWTDI.

    CGI also has a functional interface.
    If you don't feel comfortable using the OO interface, the functional interface is there to be used. (See the CGI docs).

    Cheers.

    BazB.

Re: Re: OOP
by jryan (Vicar) on Feb 04, 2002 at 07:46 UTC
    Here is something to consider, from the emminent Dominus: Re: Perl 5.6.1.