hi all,

normally i wouldn't announce module releases on the beginner's list but
i think this is appropriate.

i have released Template::Simple .04 to cpan. many times you see mention
of using templates to solve problems with replacing text with
values. there are many template modules and systems on cpan and it can
be hard to figure out which one to use. i have suggested
Template::Simple for several reasons:

        * it is the simplest templater to learn and use
        * it is the fastest rendering templater

the new release has a new cookbook script with many runnable examples
and documentation on how each one works. it also has compiled templates
which speeds up rendering.  there is a benchmark script which compares
Template::Simple to Template::Teeny and the Template Toolkit.

the other module i have released to cpan is File::Slurp .16. this module
is a simple and fast way to read/write/modify entire files. we have seen
many newbies here who post code with poor calls to open (global handles,
no error checking, etc.). in many cases a single call to read_file will
do the job cleaner and faster. you can read the file into a scalar or
the lines into an array. there are other useful options too and other
subs. the newest one is also a commonly requested feature.
prepend_file() will write data to the beginning of a file.

finally, i am very proud of the code quality in those two modules. feel
free to look at them, ask me questions, flame the code, etc. i have no
issues with anything said about my code. if you find a bug or make a
useful request which i develop or use your code, i will credit you in
the Changes file (see that for all the recent changes and credits). my
personality is stable enough that i can handle critiques. i expect the
same from others but it seems that isn't always the case. a primary goal
of mine here and in my work is better code. you may not agree with my
code but i can always defend what i do with logic and experience. 35
years of coding with 18 years in perl lets me say that.

the modules do some very interesting things. one is a proper use of eval
string which i so violently shot down last week triggering the
interminable and useless recent flame war. in this case i am generating
perl code to render a template faster (the compiled template feature). i
even developed 2 other techniques which didn't use eval (see, i tried
NOT TO USE IT FIRST!!!). but the eval version was the fastest by a good
margin so it made its way into the module. it was chosen for that reason
and not by default. if you want template stuff, use a templater (see
above!) and not eval string. if i see it used again for such simple
stuff, i will again attempt to shoot it down as it is EVIL AND
DANGEROUS. i can use it since i know when not to use it. it is a last
resort solution, never the first choice. you can do anything with eval
string which doesn't mean you have to do everything with it.

have fun with the modules.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to