[sword-devel] Perl Sword string comparison problem
Mark Morgan
marktmorgan at gmail.com
Thu Sep 3 14:17:27 MST 2015
Peter,
I don't use Perl, but it seems to me that you are assigning $doc_text to
$tmp and thus throwing away the new SWBuf you created. From then on, $tmp
and $doc_text will refer to the same thing. The string they contain will
never be different.
God bless.
Mark Morgan
On Fri, Sep 4, 2015 at 6:12 AM, Peter von Kaehne <refdoc at gmx.net> wrote:
> I am trying to take a string, pack it into a SWBuf, take a copy of it
> into another SWBuf, run the copy through a stripfilter and then compare
> the string content of the outcome with the initial string:
>
>
> my $tmp = new Sword::SWBuf();
> $tmp=$doc_text; # where $doc_text is a SWBuf, obtained earlier.
> $manager->filterText($filter, $tmp);
>
> if ($tmp->c_str() ne $doc_text->c_str()) {
> print "GlobalOptionFilter=".%diacritics{$filter}."\n";
> }
> else { print "NotPresent=".%diacritics{$filter}."\n";
> }
>
> For reasons which are beyond me, it always runs down the "else" path.
>
> Despite the string in $doc_text having plenty of the stuff which I want
> to filter.
>
> Despite if I strew liberally print statements the two strings clearly
> being different, i.e. "unfiltered" vs "filtered"
>
> Despite if I compare by hand two strings the "ne" operator doing its
> job just fine. "a" ne "b" or indeed "unfiltered" ne "filtered"
>
> My forehead is bloodied by the frequency I have hit it against the
> wall.
>
> Suggestions?
>
> Thanks
>
> Peter
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20150904/07ee1d50/attachment.html>
More information about the sword-devel
mailing list