install patch to module Text::LevenshteinXS

dear all,
I want to make use of the module Text::LevenshteinXS, I installed it
via perl -MCPAN -e 'shell'. While using it I noticed that the module
isn't UTF safe, so I searched the internet and found:

https://rt.cpan.org/Public/Bug/Display.html?id=36685

There one can download a patch for this module. How do I install this
patch? I found out that using linux I need to make use of the command
tool "patch". But how and where? The module files have been stored by
installation process in 2 different places:

/usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi/Text /
LevenshteinXS.pm

and the rest of the files under:
/root/.cpan/build/Text-LevenshteinXS-0.03-XqVYyk/

how do I apply the patch? and after invoking the patch command, do I
need to recompile the module?

Any ideas? or an alternative to this module? it needs to be UTF8 save
so taht rules out e.g. Text::WagnerFischer. the module String::Approx
isn't good for me either as it does string matching not comparing
using substrings.

thanx in advance for any hints!


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
rincewind_1970 [ Di, 20 Juli 2010 12:14 ] [ ID #2044818 ]

Re: install patch to module Text::LevenshteinXS

On Tue, Jul 20, 2010 at 6:14 AM, Frank M=C3=BCller <rincewind_1970 [at] yahoo.de=
> wrote:
> There one can download a patch for this module. How do I install this
> patch? I found out that using linux I need to make use of the command
> tool "patch". But how and where? The module files have been stored by
> installation process in 2 different places:
>
> /usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi/Text /
> LevenshteinXS.pm
>
> and the rest of the files under:
> /root/.cpan/build/Text-LevenshteinXS-0.03-XqVYyk/
>
> how do I apply the patch? and after invoking the patch command, do I
> need to recompile the module?

Disclaimers: I have not used the module in question. I have never
patched a Perl module before. I am just giving some friendly advice
that may or may not help.

I have used `patch' before, but never on a Perl module. You will more
than likely be expected to patch the original source, prior to any
build or installation process, and then follow the build and
installation instructions manually. I have very little experience with
CPAN so I can't advise on how they might be used together.

Assuming you have access to a Linux machine, start with `man patch'
from a console to learn about the patch command. That should explain
the various options, etc. Read carefully. :) If you want to understand
what a patch is, create a simple text file with a few lines (~5), make
a copy of it, and within the copy make a couple of simple changes on a
few lines. Then run this command:

diff -u original modified

Where original is the original file and modified is the modified file.
You should see a unified diff output (due to the -u option), which is
the same format as the patches you're trying to apply. It uses line
numbers and "context" lines as references and uses the first column to
indicate added and removed lines. You can search Google for help in
understanding that if you must.

The patching process is approximately as follows:

You can go where ever you'd like to go. I always keep source in $HOME/src.

cd $HOME/src

You may wish to use a Web browser instead. Download the source (the
patch appears to be for version 0.03 so make sure you download that
version).

wget http://search.cpan.org/CPAN/authors/id/J/JG/\
JGOLDBERG/Text-LevenshteinXS-0.03.tar.gz

Note that the backslash is just a line-wrap. Extract the source. You
can use the GUI if you prefer.

tar -xzf Text-LevenshteinXS-0.03.tar.gz

Move to the directory.

cd Text-LevenshteinXS-0.03

Now we can see if the patch is happy with what we've done. I glanced
at the patch that I assume you are referring too (there is apparently
an optimized one and a non-optimized one?). It seems all files are
within the same directory so as long as we're changed to that
directory (and we just did) there is no need for the -p option
(patch's default behavior bit me a lot when I was first learning to
use patch). Whichever patch you want, download it into the
Text-LevenshteinXS-0.03 directory that we just changed into. This may
or may not work:

patch --dry-run <Text-LevenshteinXS-0.03.utf8_\
optimized.diff

OR

patch --dry-run <Text-LevenshteinXS-0.03_utf8.diff

Depending on which patch you downloaded.

If the output looks happy then you can remove the --dry-run option and
patch for real. Once that is done, follow the instructions in the
README file distributed with the module source. Of course, I just
tried now and the patches don't seem to be happy. So either I'm doing
something wrong or the patches don't match the source properly. :)
That could either be my fault for getting the wrong version of source
or possibly the patch maker, though the former seems more likely.For
all I know I'm even missing steps. ;) At the very least, perhaps now
you understand the process enough to sort out the inconsistencies and
get it working.

Good luck?


--
Brandon McCaig <bamccaig [at] gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig [at] castopulence=
..org>

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Brandon McCaig [ Do, 22 Juli 2010 00:22 ] [ ID #2044968 ]
Perl » gmane.comp.lang.perl.beginners » install patch to module Text::LevenshteinXS

Vorheriges Thema: Entering array output
Nächstes Thema: Calling Exit from within a subroutine