2

I try write an perl_mod script, but it say: "Internal Server Error".

this is module file: (mm1.pm)

package mm1;
use strict;
use XML::Simple;
use DBI;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(asd);
our @EXPORT = qw(asd);

sub asd(){
    print "2222";
}

this is main file: (main.perl)

#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use mm1;

print header(-type => 'text/html', -charset=>'utf-8');
print "asdasd";

If i try run without "use mm1;" this main.perl then succeed.

What is the problem?

Thanks!

Sumurai8
  • 20,333
  • 11
  • 66
  • 100
Gábor Varga
  • 840
  • 5
  • 15
  • 25
  • 3
    Look in the error log to find additional information. Also see: From the [Stack Overflow Perl FAQ](http://stackoverflow.com/questions/tagged/perl?sort=faq): [How can I troubleshoot my Perl CGI script?](http://stackoverflow.com/questions/2165022/how-can-i-troubleshoot-my-perl-cgi-script) is partially applicable – daxim May 16 '12 at 07:16
  • Guessing: it cannot find the mm1 module because it was not in your `@INC`. Do a `use lib 'path/to/module/'` or put the module in one of the existing `@INC` paths. Or, the module does not compile itself. And end it with `1;`. Read what @daxim said to get the exact error message, and how to troubleshoot that. – Konerak May 16 '12 at 07:21
  • (btw, good job on making the question as small as possible!) – Konerak May 16 '12 at 07:23

1 Answers1

0

That's not a mod_perl module, it's a CGI program.

The (first) problem is almost certainly the fact that you've omitted the 1; from the end of your module file. But looking in the web server error log will confirm that.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97