Re: Which modules provide highest return-on-investment?
by moritz (Cardinal) on Oct 10, 2008 at 07:38 UTC
|
There are also many useful modules that don't really have a learning curve; you just look at their docs once or twice, and then you can use it to great benefit. | [reply] |
|
| [reply] |
|
You only needed to look at the DBI docs once? Wow... Do I need "fetch," "fetchrow," "fetchrow_array," "fetchrow_arrayref," or something else? It's a useful module, but unless you use it constantly, I can't imagine using it without the docs.
| [reply] |
|
| [reply] |
|
Re: Which modules provide highest return-on-investment?
by GrandFather (Saint) on Oct 10, 2008 at 09:23 UTC
|
That depends a whole lot on what you intend to use Perl for. Nice thing about CPAN is that there are really good modules for most things you might want to do.
If you don't have a nice IDE and don't feel inclined to learn to use the debugger then Data::Dump::Streamer or Data::Dumper are good friends.
GetOpt::Long can save a bunch of time if you are writing command line based scripts and Tk is pretty good for quick and dirty GUI based stuff.
A quick trawl through a bunch of my scripts shows a pretty high hit rate for File::Find, Mime::Lite, Date::Manip, List::Util and a whole bunch more. I guess really, being able to use CPAN is the place where it's worth investing your initial time.
Perl reduces RSI - it saves typing
| [reply] |
|
| [reply] |
Re: Which modules provide highest return-on-investment?
by toolic (Bishop) on Oct 10, 2008 at 16:29 UTC
|
Every script and module uses these (included in my template for new files):
Also in my template, which I later comment out when things stabilize:
User interface:
Very handy:
Great for understanding (others') regular expressions:
If you have the need for XML parsing:
| [reply] |
|
Noone seemed to mention CGI::Application and HTML::Template.
| [reply] |
|
(This is mostly directed to the OP.)
I think CGI::Application is a great thing to have but I also find it over-recommended. It's how, IMO, most solid web hackers would solve the problem of a big dispatch table with hook points. It's a good way to normalize flow and share plugins and such but if you're going to get your web code organized anyway, go all the way to Catalyst. CGI::Application is either a lot of effort that won't get you over that last hump (the many cool things Cat can do) or it's not much effort that is basically repeating things you already know and understand.
I hope that came out right. It's in the context of the OP: return on effort. I'm not criticizing CGI::App. I think it's a valuable package. I just think it's either on the easy side if you already know CGI programming well or less return on the effort than Cat if you'll need to learn a bunch either way.
As for HTML::Template, I completely understand the purists who opt for it because it's probably the theoretically cleanest View of those available. I personally would never choose it over Template::Toolkit. And that's another effort to gain ratio. HTML::Template is a snap to use. TT2 is a mini-language so it's a lot of effort. It's been worth it to me.
One of the ways you can tell if a more difficult package (or programming language for that matter) is worth the effort is to look at the community. TT2 and Cat and DBIC have active communities where answers are readily available on IRC, mailing lists, wiki, blog posts, or here at PM. If a package isn't worth the trouble, it won't be able to attract and retain a dedicated base.
| [reply] |
|
Re: Which modules provide highest return-on-investment?
by Your Mother (Archbishop) on Oct 10, 2008 at 15:32 UTC
|
I agree with moritz that there are many that require very little effort and pay handsomely. I interpret your question to also mean, what requires a lot of effort but ends up worth it in the end. These are pretty web centric but I recommend XML::LibXML, HTTP::Request, Catalyst, and any RFC/Standards based modules like URI or JSON. Modules like these, the latter or HTTP::Request (and HTTP::Response) especially, have the wonderful side-effect of teaching you how the underlying standards and technologies work. When you pick those up you're also picking up loads of extra knowledge which will transfer to other areas of work and even other languages.
| [reply] |
|
| [reply] |
|
I'm lame and undercaffeinated. I left out DBIx::Class and Rose::DB even though I was thinking about them when I started typing. Each of those has a bit of curve, especially when setting things up the first time or two. They repay in spades once any bunch of code or data starts to grow or get hairy or develop special needs.
| [reply] |
Re: Which modules provide highest return-on-investment?
by andreas1234567 (Vicar) on Oct 10, 2008 at 10:41 UTC
|
These are the ones I (seem to) use the most:
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
| [reply] [d/l] |
Re: Which modules provide highest return-on-investment?
by jplindstrom (Monsignor) on Oct 12, 2008 at 17:56 UTC
|
Moose.
Because of the complete and coherent way it provides you with a standard approach to do OO in Perl.
Because of the way it provides a declarative syntax to accomplish a lot of the things you need to do in order to produce solid code. For instance: Read-write/read-only values. Flexible type constraints where it makes sense to you. Required and default values. Lazy initialization. These are things you perhaps wouldn't normally bother with because of the extra effort and lines of code it would cost. But now all that is much cheaper.
Because of the way it scales from the very simple and minimal solutions, all the way up to meta programming.
Because of the way it is establishing itself as the foundation of bigger frameworks, e.g. DBIx::Class and Catalyst. This means you may very well need to know the basics of Moose anyway.
/J
| [reply] |
|
| [reply] |
Re: Which modules provide highest return-on-investment?
by pjf (Curate) on Oct 13, 2008 at 04:48 UTC
|
The modules I find give me the biggest bang-for-buck are the ones that allow me to avoid learning other, more costly methods of doing the same thing. strict is an obvious example of this, it tells me up-front when I've made a typo in a variable name, rather than me going through a costly debugging process.
In this regard, Moose is a big win, as it means I don't have to learn Perl's somewhat esoteric OO system
The other big bang-for-buck modules for me personally are ones that I've written myself, and which I find myself using in practically every program. IPC::System::Simple means I never have to look at $? again, or find myself wishing Perl would allow backticks without invoking the shell, or wishing that system() really did work the same way on all systems.
All my code these days start with use autodie. Having to write or die... after a call to open, close, chdir, unlink, binmode, rename, mkdir, rmdir, fork, etc etc is a total waste of time for me. Using autodie means not only does leaving out the manual error handling becomes correct, but I end up with nicer looking errors, and a number of esoteric bugs go away (eg, calls to fork and open which can legitimately return zero for success, and undef for failure).
When I move from wanting my program to simply die on error to something more complex to recover from that error, autodie gives me sane upgrade path, since the exceptions it produces contain full information as to which call failed, its argument, location, errno, and other pertinent information.
Since I've just turned this post into a massive advertisement for autodie, I should link to an old video on its usage. The big changes is that autodie now works in 5.8.x (not just 5.10.x), and the exception interface has changed slightly since the beta.
| [reply] |
Re: Which modules provide highest return-on-investment?
by Your Mother (Archbishop) on Oct 12, 2008 at 18:09 UTC
|
Since no one has mentioned it: DateTime is another great example. I resisted using it at all for a long time. It has big dependencies. It's difficult to understand its components. It has many moving parts. Date::Calc and Date::Manip are so easy by comparison. But in the end, date stuff is so messy, and weird and complicated that the seemingly difficult and scattered pieces of DateTime start to reveal themselves as necessary, clean, and flexible.
If I just want something like Date::Calc::check_date, great, but now if I have any plans to do anything more I reach for DateTime. My reticence kept me away from it for too long; it was false economy.
A few above have recommended just waiting till you need something to use it. I disagree. What happens when you wait till you need it is you don't even know what you need. It's like Turing machines. Any given package for a problem domain can do the work in front of you. You have to know them to know which you want. If you wait till the last minute to find out that DateTime or DBIC or Cat is the solution you want, you just let your deadline slip; maybe by a couple of weeks.
(update: jplindstrom was typing while I was so I didn't get the chance to say I agree completely, especially about skipping the mistakes -- packages with big, or expert, user bases tend to turn over bugs much more effectively.)
| [reply] [d/l] |
Re: Which modules provide highest return-on-investment?
by LesleyB (Friar) on Oct 11, 2008 at 07:44 UTC
|
I wouldn't try 'web stuff' without CGI;
CGI::FormBuilder is also worth getting the hang of IMHO.
HTML::Template and Template::Toolkit can also be useful. I have actually used HTML::Template as job control for IDL
Can't comment on much else because I don't have huge experience
| [reply] |
|
The original question wasn't purely about 'web stuff', though I appreciated Your Mother covering that area. I'm actually interested in the most worthwhile modules for any problem domain... parsing, visualization, natural language processing, biology, whatever.
email: perl -e 'print reverse map { chr( ord($_)-1 ) } split //, "\x0bufo/hojsfufqAofc";'
| [reply] |
Re: Which modules provide highest return-on-investment?
by EvanCarroll (Chaplain) on Oct 12, 2008 at 01:56 UTC
|
I'm going to leave out lwp, and dbi and other overly well knowns and CORE:: moduels assume a basic novice level perl programmer:
- Got to haves:
- Moose
- MooseX::Traits
- YAML
- XXX
- Devel::SimpleTrace
- Module::Install
- Module::Starter
- Extraction:
- Text::CSV (the new and improved, for all ___ deliminited files)
- DataExtract::FixedWidth (I created it, but it is still probably one of my most used modules)
- HTML::TreeBuilder
- Content Creation:
- Catalyst
- Template
I'm probably missing a bunch...
Some of the modules others have suggested legitimately bad imho, like Data::Dumper which has no upside when compaired to XXX. I also regret learning functional-module style perl, i.e. Exporter, vars, libs. et al. Moose ftw. I also regret learning every ORM I've ever learned: they all seem to ultimately be a waste of time.
| [reply] |
Re: Which modules provide highest return-on-investment?
by MadCat (Initiate) on Oct 12, 2008 at 08:32 UTC
|
If I could start over, I'd still probably follow the same route: Don't learn the ins and outs of something until I need it, and when I need something that frobnoggles fuzballs, I'll go on CPAN to see if there's a module around that can frobnoggle a fuzzball. If there is, install it, read the docs and then start the learning process.
For me the most important thing isn't knowing how a certain module works, but knowing where to find one or more modules that do what I want :) | [reply] |
Re: Which modules provide highest return-on-investment?
by jplindstrom (Monsignor) on Oct 12, 2008 at 18:06 UTC
|
I think the general answer to that question is: modules which solve problems in a domain which is
- General. This means a technical domain which is usable across many business domains.
- Complicated and big. This means e.g. implementations of protocols and languages (programming and markup).
By learning to use these modules you both learn a bit of the domain, and you don't get to make the (sometimes fatal) mistakes on your own.
Domains matching the points above are: databases, network interaction (Internet/Web), date/time, Unicode, XML.
/J
| [reply] |
Re: Which modules provide highest return-on-investment?
by Arunbear (Prior) on Oct 12, 2008 at 20:49 UTC
|
| [reply] |
Re: Which modules provide highest return-on-investment?
by Anonymous Monk on Oct 10, 2008 at 07:43 UTC
|
None. Spend your time learning general techniques, and you'll be able to pick up any module in no time. | [reply] |
|
| [reply] |
|
The modules don't define your domain, or teach you about it, they just do X using N techniques (OO, callbacks, iterators ...). Which domain for highest return of time/energy/X? Golf :)
| [reply] |