in reply to Re: Can't locate Test/JSON.pm in @INC
in thread Can't locate Test/JSON.pm in @INC

These are the package declarations: for the first:- package JSON; for the other:- package Test::JSON; Now, I checked using print($INC{"JSON.pm"}, "\n"); to find out which JSON.pm it was using. It turns out tht it uses, /usr/dir/packages/perl/perl-5.8.8/lib/site_perl/5.8.8/JSON.pm and after I try to use only a specific method, it gives me this error: Can't locate object method "is_valid_json" via package "Test::JSON" (perhaps you forgot to load "Test::JSON"?)

Replies are listed 'Best First'.
Re^3: Can't locate Test/JSON.pm in @INC
by taint (Chaplain) on Dec 27, 2013 at 17:49 UTC
    That's why I indicated that using a directory relative would make it easier to diagnose/implement.

    If both of your custom JSON modules declare

    package JSON;
    You should, as toolic initially asserted, be able to use
    use lib '/abc/xyz';
    or
    use lib ('/abc/xyz');
    then
    use JSON; use Test::JSON
    because as I noted earlier; the double-colon is a path/directory separator. Meaning; Test::JSON == Test/JSON.

    You might also try

    use lib '/abc/xyz/';
    as that negates the need to preface a slash before your custom modules.

    In any case; you must ensure that the path to your custom JSON modules preceeds (is before) your system Perl module path.
    That's why you see reference to conflicts within the system's perl, in the latest error you quoted.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

      Thanks Chris, that worked! I cant believe what a stupid mistake I was making. And yeah toolic was right.
        Good news. Glad you were able to get it right. :)

        --Chris

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH