Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrate a perl module

Suppose that I have a perl module Foo::Bar, initiated with module-starter and already have several packages under the namespace Foo::Bar and now I came to the conclusion it was a bad choice for name and want to call it MyBetterName::Bar.

Are there any tool to help in automation this process, without the need to replace all modules, pods, tests and examples. I know, I can write a perl script to do that, but supose again it is the first time I wrote a perl module and don't know very well what files should be envolved.

I tried google but found nothing that seemed to me helpful

like image 239
jvverde Avatar asked May 11 '26 22:05

jvverde


1 Answers

Should be enough to globally replace Foo::Bar and Foo/Bar

find -type f -exec perl -i -pe's{Foo(::|-|/)Bar}{MyBetterName${1}Bar}g;' {} +

Then rename the files themselves

find -depth -execdir rename 's/Foo/MyBetterName/g' {} \;
like image 188
ikegami Avatar answered May 14 '26 12:05

ikegami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!