in reply to Re^6: Listing out the characters included in a character class [v5.38]
in thread Listing out the characters included in a character class

The module code you show in your scratchpad starts with:

package Regexp::CharClasses::Thai;

but your script (above) has:

use RegexpCharClassesThai; #Regexp-CharClasses-Thai.pm

There's a naming mismatch. Assuming at least one of those is correct, you should have one of these three combinations:

package Regexp::CharClasses::Thai; use Regexp::CharClasses::Thai; # Regexp/CharClasses/Thai.pm package RegexpCharClassesThai; use RegexpCharClassesThai; # RegexpCharClassesThai.pm package Regexp-CharClasses-Thai; use Regexp-CharClasses-Thai; # Regexp-CharClasses-Thai.pm

Of course, it's possible all of those are incorrect and you should have a fourth combination.

— Ken

Replies are listed 'Best First'.
Re^8: Listing out the characters included in a character class [naming mismatch]
by Corion (Patriarch) on Oct 31, 2023 at 14:46 UTC

    If they really want to load package Regexp::CharClasses::Thai from a file Regexp-CharClasses-Thai.pm, then the following should work:

    BEGIN { require 'Regexp-CharClasses-Thai.pm'; # resp. ideally use the full + path Regexp::CharClasses::Thai->import('IsThaiDigit'); }

    (see also use)

Re^8: Listing out the characters included in a character class [naming mismatch]
by Polyglot (Chaplain) on Nov 01, 2023 at 07:26 UTC
    Ken,

    The "naming mismatch" is simply accounted for: I put the version in my scratchpad which I intended to publish; however, in my own testing, I removed the colons from the name, both in the package, and in the "use" line of my script. So this was not one of the sources of errors (though I sure wish it could have been that simple). I do appreciate that you were alert to the potential issue with a mismatched name.

    Blessings,

    ~Polyglot~