You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by iNetForce <fg...@systeamusa.com> on 2007/01/15 19:44:39 UTC

Making .pm files run.

I got a website from a friend and I was trying to get it to work on server
running FREEBSD with Apache and modperl. The website was coded to run an
Alias called go and has several .pm files. I got the alias go by adding a
line of configuration to the httpd.conf file but I've had no luck with .pm
files. I even tried the complete patch to the file which is something like
/go/1.pm and nothing, like if I was pointing nowhere. Do I need to add
something else to the httpd.conf file in order to execute those .pm files?

I'm completely new to modperl and apache, any help will be greatly
appreciated.

-- 
View this message in context: http://www.nabble.com/Making-.pm-files-run.-tf3016257.html#a8376413
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Making .pm files run.

Posted by to...@tuxteam.de.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Jan 16, 2007 at 11:06:54AM -0800, iNetForce wrote:
> 
> I installed Image Magick, but now im getting this error:

Hi, Force

just to repeat what has been said elsewhere in slightly different terms
when you see this:

> http# apachectl restart
> /usr/local/sbin/apachectl restart: httpd not running, trying to start
> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
> Can't locate Mail/Sendmail.pm
               ^^^^^^^^^^^^^^^^

that means that Perl is looking for a module Mail::Sendmail, which it
expects to be in one file Mail/Sendmail.pm. It is looking in the
following  directories (I edited for clarity):

>                                   in @INC (@INC contains:
>  /usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers
>  /usr/local/lib/perl5/5.8.8/BSDPAN
>  /usr/local/lib/perl5/site_perl/5.8.8/mach
>  /usr/local/lib/perl5/site_perl/5.8.8
>  /usr/local/lib/perl5/site_perl
>  /usr/local/lib/perl5/5.8.8/mach
>  /usr/local/lib/perl5/5.8.8
>  .
>  /usr/local/ /usr/local/lib/perl) at

So to remedy this, you can go to CPAN and install the missing module
(which will probably go to /usr/local/lib/perl5 or ...site_perl). You
might try to use the "standard" Perl modules in your OS (if there are
any), but guessing from the paths in your @INC it looks like a homegrown
Perl installation (the "local" bit). So CPAN looks like the better
approach.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFrc6jBcgs9XrR2kYRApg9AJ9Q527Wc6gM6ImVKEM3OyUj4YsD6QCaApJR
cB58h8/+7tXijWz/YCiSBiE=
=29h/
-----END PGP SIGNATURE-----


Re: Making .pm files run.

Posted by Sean Davis <sd...@mail.nih.gov>.
On Tuesday 16 January 2007 15:12, iNetForce wrote:
> You got me lost there, the terminology you guys use really throw me off,
> sorry :(
> sendmail is installed on the system, what exactly do I need to do so I dont
> get the sendmail error?

Things that end in .pm are usually perl modules.  So, you will need to install 
ALL the perl modules that are needed, perhaps one-at-a-time.  CPAN 
(http://search.cpan.org) is the place to look.  

I don't know if you have a local perl user, but it sounds like it might be a 
good idea to touch base with him/her if these instructions aren't making much 
sense.

Hope that helps.

Sean


> Michael Peters wrote:
> > iNetForce wrote:
> >> I installed Image Magick, but now im getting this error:
> >>
> >> http# apachectl restart
> >> /usr/local/sbin/apachectl restart: httpd not running, trying to start
> >> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
> >> Can't locate Mail/Sendmail.pm in @INC (@INC contains:
> >
> > Now it's looking for Mail::Sendmail which will need to be installed as
> > well.
> > It's quite possible that there are many more of these which need to be
> > installed. So you can just keep installing them. To translate the file
> > path name
> > into a Perl module name you basically change all '/' into '::' and then
> > drop the
> > final '.pm'.
> >
> > --
> > Michael Peters
> > Developer
> > Plus Three, LP

Re: Making .pm files run.

Posted by Michael Peters <mp...@plusthree.com>.

iNetForce wrote:
> You got me lost there, the terminology you guys use really throw me off,
> sorry :(
> sendmail is installed on the system, what exactly do I need to do so I dont
> get the sendmail error?

It's not sendmail, it's the Perl module named Mail::Sendmail (which acts a kind
of a wrapper around sendmail). Almost all Perl modules are found on CPAN
(http://search.cpan.org/) and can be installed via the CPAN shell. I assumed you
installed Image::Magick that way, but you probably just installed it from source
the image-magick source.

On some systems the cpan shell can simply be accessed by the command 'cpan'. If
that doesn't work, then you can do the same thing via this command:

  perl -MCPAN -e shell

Since it's probably the first time it's been run on that box you'll need to
configure it. After your done with the configuration you can then install stuff:

  cpan> install Mail::Sendmail

That should get it installed for you.

-- 
Michael Peters
Developer
Plus Three, LP


Re: Making .pm files run.

Posted by iNetForce <fg...@systeamusa.com>.
You got me lost there, the terminology you guys use really throw me off,
sorry :(
sendmail is installed on the system, what exactly do I need to do so I dont
get the sendmail error?



Michael Peters wrote:
> 
> 
> 
> iNetForce wrote:
>> I installed Image Magick, but now im getting this error:
>> 
>> http# apachectl restart
>> /usr/local/sbin/apachectl restart: httpd not running, trying to start
>> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
>> Can't locate Mail/Sendmail.pm in @INC (@INC contains:
> 
> Now it's looking for Mail::Sendmail which will need to be installed as
> well.
> It's quite possible that there are many more of these which need to be
> installed. So you can just keep installing them. To translate the file
> path name
> into a Perl module name you basically change all '/' into '::' and then
> drop the
> final '.pm'.
> 
> -- 
> Michael Peters
> Developer
> Plus Three, LP
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-.pm-files-run.-tf3016257.html#a8397895
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Making .pm files run.

Posted by Michael Peters <mp...@plusthree.com>.

iNetForce wrote:
> I installed Image Magick, but now im getting this error:
> 
> http# apachectl restart
> /usr/local/sbin/apachectl restart: httpd not running, trying to start
> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
> Can't locate Mail/Sendmail.pm in @INC (@INC contains:

Now it's looking for Mail::Sendmail which will need to be installed as well.
It's quite possible that there are many more of these which need to be
installed. So you can just keep installing them. To translate the file path name
into a Perl module name you basically change all '/' into '::' and then drop the
final '.pm'.

-- 
Michael Peters
Developer
Plus Three, LP


Re: Making .pm files run.

Posted by iNetForce <fg...@systeamusa.com>.
I installed Image Magick, but now im getting this error:

http# apachectl restart
/usr/local/sbin/apachectl restart: httpd not running, trying to start
Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
Can't locate Mail/Sendmail.pm in @INC (@INC contains:
/usr/home/httpd/domains/ww                                            
w.ehunter.com/ehunter_perl/Handlers /usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local                                            
/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8
/usr/local/                                             lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .                                             
/usr/local/ /usr/local/lib/perl) at
/usr/home/httpd/domains/www.ehunter.com/ehu                                            
nter_perl/Handlers/RecipeEmailTool.pm line 6.
BEGIN failed--compilation aborted at
/usr/home/httpd/domains/www.ehunter.com/ehu                                            
nter_perl/Handlers/RecipeEmailTool.pm line 6.
Compilation failed in require at
/usr/home/httpd/domains/www.ehunter.com/ehunter                                            
_perl/Handlers/Recipes.pm line 9.
BEGIN failed--compilation aborted at
/usr/home/httpd/domains/www.ehunter.com/ehu                                            
nter_perl/Handlers/Recipes.pm line 9.
Compilation failed in require at (eval 9) line 3.


I'm sorry if im bothering you guys, I just want to make this work.
Thanks in advance.


Sean Davis-3 wrote:
> 
> On Tuesday 16 January 2007 12:03, iNetForce wrote:
> 
>> Now im getting this error on the httpd-error.log file:
>>
>> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
>> Can't locate Image/Magick.pm in @INC 
> 
> Looks like your code depends on Image::Magick.  You will probably need to 
> install it.  It is available on CPAN.
> 
> Sean
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-.pm-files-run.-tf3016257.html#a8396625
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Making .pm files run.

Posted by Sean Davis <sd...@mail.nih.gov>.
On Tuesday 16 January 2007 12:03, iNetForce wrote:

> Now im getting this error on the httpd-error.log file:
>
> Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
> Can't locate Image/Magick.pm in @INC 

Looks like your code depends on Image::Magick.  You will probably need to 
install it.  It is available on CPAN.

Sean

Re: Making .pm files run.

Posted by iNetForce <fg...@systeamusa.com>.
I added these lines:

<Perl>
  use lib '/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers';
</Perl>

PerlModule Recipes
    <Location /go/>
        SetHandler perl-script
        PerlHandler Recipes
        Options +ExecCGI
        PerlSendHeader On
        allow from all
    </Location>


Now im getting this error on the httpd-error.log file:

Syntax error on line 691 of /usr/local/etc/apache/httpd.conf:
Can't locate Image/Magick.pm in @INC (@INC contains:
/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers
/usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 . /usr/local/
/usr/local/lib/perl) at
/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/RecipeTool.pm
line 6.
BEGIN failed--compilation aborted at
/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/RecipeTool.pm
line 6.
Compilation failed in require at
/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/Recipes.pm
line 6.
BEGIN failed--compilation aborted at
/usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/Recipes.pm
line 6.
Compilation failed in require at (eval 9) line 3.
-- 
View this message in context: http://www.nabble.com/Making-.pm-files-run.-tf3016257.html#a8394174
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Making .pm files run.

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2007-01-15 at 10:44 -0800, iNetForce wrote:
> I got a website from a friend and I was trying to get it to work on server
> running FREEBSD with Apache and modperl.

Can you get your friend to give you instructions on how to configure it?
There are many ways to configure code to run under apache, and we don't
know what sort of setup his code is expecting.

For general configuration help, there is plenty of documentation on
http://perl.apache.org/.  You can see one example here:
http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules

- Perrin


Re: Making .pm files run.

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2007-01-15 at 14:31 -0800, iNetForce wrote:
>  Alias /go/ /usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/

This is probably not what you want.  Perl doesn't look for modules based
on the URL, it looks for them in @INC.  You need to put this module
somewhere that is in your @INC, or else add this directory to @INC.
Sometimes people add it putting a "use lib" statement in their conf
file, like this:

<Perl>
  use lib '/path/to/my/modules';
</Perl>

You don't need the Alias.  The Location block handles routing requests
to the module Recipe, so you just have to help perl find the file
Recipe.pm by getting the Recipe.pm file into a path that's in @INC.

- Perrin


Re: Making .pm files run.

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2007-01-15 at 14:31 -0800, iNetForce wrote:
> package Recipes;
[...]
>     PerlModule go::Recipes
>     <Location /go/>
>         SetHandler perl-script
>         PerlHandler go::Recipes
>         Options +ExecCGI
>         PerlSendHeader On
>         allow from all
>      </Location>

That module says it's package is "Recipes", not "go::Recipes".  You need
to change the PerlModule and PerlHandler directives to load "Recipes".
You should be seeing some junk in your error_log when you try to load a
module that doesn't exist, as you are now.

- Perrin


Re: Making .pm files run.

Posted by iNetForce <fg...@systeamusa.com>.
This is the information i gathered based on your request:

>From httpd-error.log:

[Mon Jan 15 15:50:36 2007] [notice] Apache/1.3.34 (Unix) mod_perl/1.29
configure
d -- resuming normal operations


Here is one of the files Recipes.pm
------------------------------------------------

package Recipes;

use strict;
use Apache::Constants;
use RecipePrintTool;
use RecipeTool;
use MyRecipeTool;
use RecipeReviews;
use RecipeEmailTool;
use RecipeSearchTool;

sub handler
{
        my $r = shift;

        my @uri = split /\//, $r->uri();

        my $prg;

        if ($uri[3] eq "print_recipe")
        {
                $prg = RecipePrintTool->new($r);
        }
        elsif ($uri[3] eq "my_recipe")
        {
                $prg = MyRecipeTool->new($r);
        }
        elsif ($uri[3] eq "recipe_reviews")
        {
                $prg = RecipeReviews->new($r);
        }
        elsif ($uri[3] eq "email_recipe")
        {
                $prg = RecipeEmailTool->new($r);
        }
        elsif ($uri[3] eq "recipe_search")
        {
                $prg = RecipeSearchTool->new($r);
        }
        else
        {
                $prg = RecipeTool->new($r);
        }

        $prg->Main();

        $r->push_handlers( PerlHandler => 'Handlers::Finish_Page' );

        return OK;
}

1;
__END__

-----------------------------------------------------------------------------

Should I run it as a Registry or as a Handler?
These are the only changes that I've made to the httpd.conf file.

I changed the DocumentRoot to : DocumentRoot
"/usr/home/httpd/domains/www.ehunter.com/ehunter_html"
then I added go as an Alias. Recipes.pm is inside the folder Handlers. I'm
trying to execute Recipes.pm by going to http://localhost/go/Recipes but
nothing.
   
 Alias /go/ /usr/home/httpd/domains/www.ehunter.com/ehunter_perl/Handlers/

    PerlModule go::Recipes
    <Location /go/>
        SetHandler perl-script
        PerlHandler go::Recipes
        Options +ExecCGI
        PerlSendHeader On
        allow from all
     </Location>


-- 
View this message in context: http://www.nabble.com/Making-.pm-files-run.-tf3016257.html#a8380720
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Making .pm files run.

Posted by Sean Davis <sd...@mail.nih.gov>.
iNetForce wrote:
> I got a website from a friend and I was trying to get it to work on server
> running FREEBSD with Apache and modperl. The website was coded to run an
> Alias called go and has several .pm files. I got the alias go by adding a
> line of configuration to the httpd.conf file but I've had no luck with .pm
> files. I even tried the complete patch to the file which is something like
> /go/1.pm and nothing, like if I was pointing nowhere. Do I need to add
> something else to the httpd.conf file in order to execute those .pm files?
>
> I'm completely new to modperl and apache, any help will be greatly
> appreciated.
>   

You probably need to start at the beginning.  We don't know what version 
of apache you are using, whether or not mod_perl is installed, and what 
version you are using.  We don't know how the .pm files are coded (to 
run as Registry scripts or as mod_perl handlers).  It is also important 
to describe how you are configuring apache.  If things aren't working, 
then it is worthwhile describing how they are not working, including 
looking at the error log. 

Before moving forward, it is definitely worth a look at the 
documentation for mod_perl:

http://perl.apache.org/docs/index.html

Sean