Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ajtaylor (1283)

ajtaylor
  (email not shown publicly)
http://www.drewtaylor.com/

Journal of ajtaylor (1283)

Monday February 04, 2002
03:38 AM

Modules and tests and freelance work, oh my!

[ #2632 ]
Tonight I needed a module to read a simple config file. Right now I have a config hash in the cgi scripts which is passed on to the module constructor. But this means I have to change code to go from development to production. This is not a good thing, and it makes using CVS really hard. A separate config file is perfect for this situation. So I looked at AppConfig by the amazing Mr Wardley. It almost fit, except that I didn't like how it handled blocks (it prepends 'blockname_' to block variables). And I definitely needed access to the individual blocks, which AppConfig doesn't do since it flattens blocks. I suppose I could have subclassed it, but it was simple and easy enough I wanted to write my own. It's not like I'm creating another templating system...

So I wrote my own parser from scratch, with the exception of the hairy regexp in AppConfig::File::parse(). (I hope you don't mind Andy!) It's very simple, with methods to set the filename, parse it, and get/set values. It also uses AUTOLOAD to automagically support method calls like $cfg->variable(). And I figured out how to do method chaining so I could do $cfg->block()->variable(). It's pretty simple and it works nicely.

Now it was time for tests! Hooray, I'm going to write a test suite. I used Test::More, and I must say it was quite easy. (Thanks Schwern!) I wrote enough of the module to have something to test, and then I wrote my tests. Of course, I found a few bugs and promptly fixed them. It also helped me to flesh out the implementation. And best of all, I now have a set of comprehensive tests that I can run at any time to see if I've broken anything. I think I'll definitely be taking the time to write tests from now on for anything major. Tests are cool!

And now for the motivation for doing all this work tonight. I've decided that the market is going to suck for me for a while still so I'm going to focus on my existing freelance work, while developing new customers here in MA. This last fall I rewrote an application I had developed over the last year with the express intention of selling it to other printers. It takes business card orders online, and does some neat stuff w/ PDFs to save on human layout time. Oh, and it does the requisite reports as well. :-)

Of course, I need to get more organized if I want to have this software running for multiple customers, which mostly entails getting it under CVS and setting up development environments / backup strategys. It's been fun, and I've already found some areas I need to tackle to make it more commercially viable. Nothing terribly difficult as it's primarily in automating setup of objects in the system.

I've decided that if the good commonwealth of MA is paying me to be 'idle', I might as well make the best use of that time. I already feel much better about life & work because I've been busy. Last week was good for me freelance work wise, and I also remembered about some time I had forgotten to bill a client! It seems that no one else can help me, so I just have to pull myself up by the bootstraps and do it myself. Besides, I REALLY want to go to one of the perl conferences this year and to do that I'll have to pay for myself. Can't make it to TPC, much less YAPC on unemployment wages.

Finally, I would welcome any tips on how to approach businesses w/ my product and/or programming/networking services. I'll have a demo site setup where they can see it in action. I'll have business cards and hopefully a one page "fact sheet". I have all the tools for networking. I'm not very good at cold calls, but I can make a good impression. I am happy to listen to any proven sales techniques that would get me a few minutes w/ the owner/manager.

If you got this far, thanks for reading my ramblings. I do hope I made sense at least some of the time.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.