in reply to Re^2: 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?

Thank you! And one more question -- hopefully the last: I've put File::Random and Want in a directory within the home directory of my hosting account, per related advice given here.

What's confusing me are these instructions at CPAN, about running the Makefile.Pl, and additionally the reference in the Dreamhost link above about the "use lib" command. I've tried to research all this myself, but I think I don't know enough about programming to figure it out.

Where/how do I need to take these final steps, so my script knows where to find the modules?

Replies are listed 'Best First'.
Re^4: will this random-text script work? how do i integrate a template?
by hawthorne (Novice) on Jan 16, 2007 at 15:59 UTC
    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)?

      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?