in reply to How to best "use lib" relative to a web site root?

See FindBin. Its POD's SYNOPSIS should be enough to get you going.

Update: Also, if you generate an "app" with Mojolicious, you'll see that the app executable starts with this:

use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" }

...which is similar to the FindBin SYNOPSIS, but avoids the use of the lib pragma (not sure why).


Dave

Replies are listed 'Best First'.
Re^2: How to best "use lib" relative to a web site root?
by taint (Chaplain) on Nov 27, 2013 at 21:48 UTC
    Thank you, davido.

    I looked at that in perldoc, and also thought that to be a strong candidate (created for Mac filepath munging), but wasn't sure it'd fully accomplish my goal. I'll give it a go. While I'm at it, I'll see if I can deduce what would cause them to eliminate the lib pragma. Should provide me a great deal more insight on the very question I asked here. :)

    Thank you, davido. For taking the time to respond.

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;

        I got this bit of wisdom from the source of Mojolicious enlightenment: "you'd expect that's what lib does, but it doesn't! ...and that's the problem :)"

        Calling that "wisdom" is generous :)

        i wouldn't trust most of what that guy complains about ... unless he provides actual detail, hes prone to FUD