in reply to Re^7: perl install in Fedora 16
in thread perl install in Fedora 16

So far none of my efforts have changed the @INC at all. It is as it started. BEGIN { use lib "/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 /usr/share/perl5/vendor_perl/AnyEvent/Imp" }; end; produced 'Done" but no change. #use lib '/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 /usr/share/perl5/vendor_perl/AnyEvent/Imp'; likewis, 'Done' but no change inserting into the script: use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml"; also does not change the entry.

Replies are listed 'Best First'.
Re^9: perl install in Fedora 16
by Eliya (Vicar) on Feb 20, 2012 at 18:41 UTC

    Not sure what you're expecting to happen when you say it didn't change.  Are you expecting to manipulate @INC permanently?  That's not how it works.  use lib ... changes @INC only for the lifetime of the script.  Also, use lib doesn't take a space-separated string of directories, but a list of directories, if you need more than one.

    Consider this:

    #!/usr/bin/perl -wl use strict; BEGIN { print for @INC; print "-----" } use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml", "/foo/bar"; BEGIN { print for @INC; print "-----" } # use here whatever module lives in one of the added paths...
    $ ./955116.pl /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl . ----- /usr/share/perl5/vendor_perl/AnyEvent/Iml /foo/bar /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl . -----

    As you can see in the second printout of @INC (after the use lib), the two directories have been added.

    ___

    P.S.:  please use <p>...</p> (text paragraph) and <c>...</c> (code) tags to format your posts.

    For example, typing

    <p> inserting into the script: </p> <c> use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml"; </c> <p> also does not change the entry. </p>

    will render as

    inserting into the script:

    use lib "/usr/share/perl5/vendor_perl/AnyEvent/Iml";

    also does not change the entry.

      I added your code at the start of the script and the module was found! Now I have a new problem. The script (not mine) generates this error:

      Bareword "Tk::MainLoop" not allowed while "strict subs" in use at /usr +/share/perl5/vendor_perl/AnyEvent/Impl/Tk.pm line 134. Compilation failed in require at ./guiguts.pl line 49. BEGIN failed--compilation aborted at ./guiguts.pl line 49.

      Line 49 is Tk.pm which is the module in the directory needed in @INC

        I'm not sure what you're actually trying to do, but from rereading the thread I'm getting the impression you might perhaps simply be wanting to run a regular Perl/Tk GUI program(?)

        If so, you need to install Tk, not AnyEvent::Impl::Tk.

        If, OTOH, you know what you're doing and are in fact wanting to use AnyEvent::Impl::Tk, you'll need to provide more context about what you're trying to run.  It's hard to help otherwise.

        As for the error message 'Bareword "Tk::MainLoop" not allowed ...' itself, it means something is trying to call said MainLoop function without having loaded the Tk module.