in reply to Re^3: will this random-text script work? how do i integrate a template?
in thread will this random-text script work? how do i integrate a template?

Okay -- I think I've figured out the  use lib thing.

Is this right?

#!/usr/bin/perl –Tw use strict; use CGI ':standard'; use lib qw("/perl_modules"); use File::Random qw/:all/; my $dir = '//spam_oracle/infinity'; my $file = random_file(-dir => $dir); my @lines = random_line($fname, int(rand(5)) + 1);

Specifically, will the script know to drill down within the perl_modules directory, if the modules are within subdirectories?

And is that the correct path, if the script itself is in a cgi-bin within a subdomain on my account (mact.jesskilby.com/cgi-bin/oracle.pl)?

Replies are listed 'Best First'.
Re^5: will this random-text script work? how do i integrate a template?
by CountZero (Bishop) on Jan 16, 2007 at 22:10 UTC
    As use lib qw(...) is (more or less) the same as adding your directory to the @INC array, it will drill down into this directory, just as if your directory was part of the normal Perl module tree. This means that you have to set up your private module directory in a similar way as Perl's.

    For instance: for File::Random you should place the file Random.pm inside a File directory, directly underneath your /perl_modules directory.

    Normally you should let the CPAN-module (or CPANPLUS-module) take care of this. Have a look at question 5 in the FAQ included in the CPAN-module documentation. It will explain how to set up CPAN so it installs in your private module directory.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Thanks so much for all your help! I sat down today with a progammer from my uni's compsci dept and worked out the last wrinkles, and I'm happy (more like ecstatic) to report that the script is now working! Site's not done yet, but the tricky part is finished.

      I'd like to thank you formally in the documentation for my project; what name would you like me to use?

        As I'm known as CountZero here, you may give credit to "CountZero".

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law