On Fri, 13 Oct 2006 1:48 pm, Ted wrote:
Hi,

I get the following warnings when using Apache2::Reload.  How can
I get rid of them? Constant subroutine MyApp::MY_CONSTANT redefined at
/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/ModPerl/Util.pm line 69.
Prototype mismatch: sub MyApp::MY_CONSTANT: none vs () at
/usr/local/lib/perl5/5.8.6/Exporter.pm line 65.
at MyApp.pm line 6
Prototype mismatch: sub MyApp::numerically: none vs ($$) at
/usr/local/lib/perl5/5.8.6/Exporter.pm line 65.
at MyApp.pm line 6

This pragma in your httpd.conf might take care of it:

<Perl>
  $ModPerl::Util::DEFAULT_UNLOAD_METHOD = 'unload_package_xs';
</Perl>

Thanks to gozer for the reference. I'll add this to the docs when I get a free tuit (this feature currently undocumented).

Here is the code:
------------
MyApp.pm
------------
#!/usr/local/bin/perl

package MyApp;
use strict;
use MyLib qw(MY_CONSTANT numerically);

sub handler {
   my $r = shift @_;
   $r->content_type('text/plain');
   print "Hello\n";
   return Apache2::Const::OK;
}
1;

------------
MyLib.pm
------------
#!/usr/local/bin/perl

package MyLib;
use strict;

BEGIN {
   use Exporter ();
   our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);

   @ISA       = qw(Exporter);
   @EXPORT    = qw();
   @EXPORT_OK = qw();

   %EXPORT_TAGS = (
       subs => [qw(MY_CONSTANT numerically)],
   );

   Exporter::export_ok_tags('subs');
}

use constant MY_CONSTANT => 'Test 123';

sub numerically ($$) {
   my($a, $b) = @_;
   $a <=> $b;
}
1;


Thanks,
Ted

Reply via email to