On 4/14/05, JupiterHost.Net <[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
> 
> To keep this on topic of the OP, there is still no need for either way
> with the way I was able to do it with import() which is better yet and
> makes this new argument moot and pointless.
> 
> Please die thread ;p
> 

I second that, but I thought regex != m// was an important point.  If
M is uncertain about where regexes can be used, I'm happy to help him
out ;)

--j

--
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