On 4/14/05, M. Kristall <[EMAIL PROTECTED]> wrote:
> Jay Savage wrote:
> [snip]
> > But think a little bit about the convoluted namespace you created to
> > get that function in there.  Think also about this:  why have you put
> > this code into a module?  So you can reuse it, presumably.  Or at
> > least that's the assumption I'm working with.  Maybe you're even going
> > to share your module with other people.  Now let's say I maintain
> > Digest::MD5, and tomorrow, I decide that the function isn't going to
> > be called 'md5_base64' anymore, because I got sick of typing it.  From
> > now on it's going to be 'md5_64'.  You now have to go through and fix
> > your module to make it export the new function name.  Then you have to
> > go through every program that uses the module, and change every
> > occurance of 'md5_base64'--thank god for regex!
> That would effect more than just this single module. The purpose of APIs
> is that you can communicate by only needing to know the name of the
> function, not the code it does. By changing the name of the function,
> you change the API, meaning that anything that ever used that function
> will cease to function properly.
> Why use a regular expression when you know *exactly* what you are
> getting? Which is better $abc eq 'abc' or $abc =~ m/abc/?
> Not to mention that regex wouldn't help if the function name were
> changed to my_hash_function.
> 
> [snip]
> >
> > --jay

perl -p -i.old -e 's/old_func\((.*)\)/new_func($1)/g' *pl

--jay

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to