Click here to get back home

Custom PM Modules Won't Work

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Custom PM Modules Won't Work Rob 05-02-2006
Posted by Rob on May 2, 2006, 7:17 pm
Please log in for more thread options


Hello

I have written a website using Perl which runs in IIS and I now want to
divide the functionality into modules but as soon as I try I get the error
"The CGI Application Missbehaved"
Can someone give me a simple example Perl script that uses a module so I can
test to see if this is a server issue and can anyone recommend a way to fix
this?

I have tried both Use and Require with the same results

Thanks
Rob



Posted by Sisyphus on May 2, 2006, 9:31 pm
Please log in for more thread options



> Hello
>
> I have written a website using Perl which runs in IIS and I now want to
> divide the functionality into modules but as soon as I try I get the error
> "The CGI Application Missbehaved"
> Can someone give me a simple example Perl script that uses a module so I
can
> test to see if this is a server issue and can anyone recommend a way to
fix
> this?
>
> I have tried both Use and Require with the same results
>
> Thanks
> Rob

The module (Foo.pm):
---------------------------------------
package Foo;

#require Exporter;
#@ISA = qw(Exporter);
#@EXPORT = qw(greeting);

sub greeting {
print "Hello from foo\n";
}

1;
---------------------------------------

The script that uses Foo.pm:
---------------------------------------
use warnings;
use Foo;
Foo::greeting();
---------------------------------------

If, in Foo.pm, you include the code that is currently commented out, then
the script could be changed to:
---------------------------------------
use warnings;
use Foo;
greeting();
---------------------------------------

See 'perldoc Exporter' for more info and other (better) options regarding
export of functions from modules.

Cheers,
Rob



Posted by Rob on May 3, 2006, 2:11 am
Please log in for more thread options


Thanks

This works in a command prompt but won't work in a web script in IIS with
the CGI module also loaded
It says
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

Is it a permisions problem on the directory?
Or is Perl not looking in the same directory as the script for .pm files?

Thanks
Rob

>
>> Hello
>>
>> I have written a website using Perl which runs in IIS and I now want to
>> divide the functionality into modules but as soon as I try I get the
>> error
>> "The CGI Application Missbehaved"
>> Can someone give me a simple example Perl script that uses a module so I
> can
>> test to see if this is a server issue and can anyone recommend a way to
> fix
>> this?
>>
>> I have tried both Use and Require with the same results
>>
>> Thanks
>> Rob
>
> The module (Foo.pm):
> ---------------------------------------
> package Foo;
>
> #require Exporter;
> #@ISA = qw(Exporter);
> #@EXPORT = qw(greeting);
>
> sub greeting {
> print "Hello from foo\n";
> }
>
> 1;
> ---------------------------------------
>
> The script that uses Foo.pm:
> ---------------------------------------
> use warnings;
> use Foo;
> Foo::greeting();
> ---------------------------------------
>
> If, in Foo.pm, you include the code that is currently commented out, then
> the script could be changed to:
> ---------------------------------------
> use warnings;
> use Foo;
> greeting();
> ---------------------------------------
>
> See 'perldoc Exporter' for more info and other (better) options regarding
> export of functions from modules.
>
> Cheers,
> Rob
>
>



Posted by Brian McCauley on May 3, 2006, 7:13 am
Please log in for more thread options



Rob spits TOFU in our faces:

[please don't]

> [...] is Perl not looking in the same directory as the script for .pm files?

Perl does not do this by default. If you are sure that you want it to,
see the solution given in the FAQ. But it's probably better to stop
wanting to.


Posted by Rob on May 3, 2006, 6:22 pm
Please log in for more thread options


Thanks

I've got it now
FAQs are wonderful things!

I had to add this to the top of the main page and now everything is sorted:

use FindBin;
use lib "$FindBin::Bin";

Thanks
Rob

>
> Rob spits TOFU in our faces:
>
> [please don't]
>
>> [...] is Perl not looking in the same directory as the script for .pm
>> files?
>
> Perl does not do this by default. If you are sure that you want it to,
> see the solution given in the FAQ. But it's probably better to stop
> wanting to.
>



Similar ThreadsPosted
comp.lang.perl.modules,alt.autos.rod-n-custom,alt.kids-talk,alt.internet.p2p,alt.support.nutty.as.a.fruitcake December 28, 2004, 2:24 am
SSL protocol via custom module? August 4, 2006, 1:28 pm
Custom Software Development May 8, 2007, 7:07 am
How do you send a custom request with LWP::UserAgent? July 31, 2005, 6:09 am
Is it possible to use a custom perl binary inside a prebuilt apache/mod_perl environment? April 24, 2007, 5:15 pm
win32::api doesn't work? January 18, 2005, 11:47 pm
NET:LDAP start_tls does not work July 7, 2004, 12:19 pm
Compress::Bzip2 needs work April 20, 2005, 9:41 pm
Apache::DBI + mod_perl 2.0.1. Please, help! Cannot get it work! November 2, 2005, 7:58 am
mod_perl2 won't work w/ActivestateP588 V.822 August 7, 2007, 5:35 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap