Thank you very much,
This was just what I was after, so simple, now that I know it, it is these sort of tricks I look out for on this site in an effort to eventually be able come up with them myself.
Please allow me to defend my choice of not using a module for this, apart from a lot of rework of both my script and templates. When I use a template to achieve a result, I've learnt how to use a template, but when I do it myself I better my understanding and knowledge of perl.
Most of my projects are web interfaces and cgi bits and pieces so my use for perl at the moment is narrow, so I am always looking for new methods and techniques, and for that THIS Monastery is a God send <Pun Definitely intended>
Thanks to all who responded to my question | [reply] |
Please allow me to defend my choice of not using a module for this...
There is absolutely nothing wrong with "rolling your own", so long as you understand why you are doing it. After all, how do you think the modules on CPAN were created? While many were for new functions, others were expanding upon previously created functionality or approaching the problem from an entirely different direction (the plethora of mail modules comes to mind).
However, if you happen to be working for a company, you are doing them a disservice. If you are new to Perl, as your post suggests, then you won't write Perl code that is as stable and well-thought out as most of the modules out there. Your company has to deal with your substandard code and is probably not getting best value for what they are paying you. As a matter of simple ethics, I would recommend not "rolling your own" in a business environment without very compelling reasons.
When I use a template to achieve a result, I've learnt how to use a template, but when I do it myself I better my understanding and knowledge of perl.
The above comment suggests to me that you would benefit greatly from using more modules and templates. If you don't use them, you can't appreciate how your knowledge of Perl increases through said use. Further, without those modules, Perl wouldn't be as popular as it is and you probably wouldn't be coding in it.
Much of being a good Perl programmer is being a good programmer. Learning the benefits of code reuse and modularization aren't specific to Perl, but you must understand these issues if you want to be a serious programmer. Read through the white paper for Template::Toolkit. In just fifteen minutes to half an hour of reading, you will have learned more about Web site creation and maintenance than I learned in my first six months of "doing it by hand." It covers the benefits of code reuse and modularity from a CGI perspective. Just some of the topics covered:
- Control over design aspects
- Cross-site consistency
- Separation of code and presentation
- Reusability
- Maintainability and portability
If you really want to be writing CGI programs, those are critical issues. By understanding them and getting them out of the way, you can focus on Perl.
Don't get me wrong, I meant what I said. There is NOTHING wrong with writing your own version of modules that are already out there if you are doing this to further your understanding. I have personally written a couple of CGI parsing routines in order to better understand the CGI protocol. However, if you are inexperienced with Perl and you arte doing this for an employer (as your post and home node hint at), you are doing them a disservice. That, in my opinion, is unethical.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] |
Thanks for your comments and the recommended reading, I see your point and agree, when it matters the best solution for the job is the only way to go, and I one thing i do know is anything I produce definitely isn't that!.
I do use modules various things, but I try to get a good hold on what core perl can do for me, then I look for modules to do it better and easier in the future. I'm constantly dropping my ways of doing things for a better method or implementation, sometimes by way of a module. on the other hand sometimes I find a function I've already done is already implemented in a module but prefer my method because it's more relevant to my application.
Please understand the work I am doing with perl here is VERY non critical, their just bits a pieces to be of use to my fellow employees. Sometimes I could have downloaded a whole application to do what I've done, but it wouldn't have everything I need and I couldn't easily modify it for my own purposes.
I work in a call center environment and perform many other tasks of which (thankfully) I do better than programming, but this is what is increasingly catching my interest and where I am leaning towards in my career. hopefully when I am doing more serious work with perl, I will be doing things ethically,
thanks for your advice
| [reply] |