Mailing List Archive

Apache2::Reload, Prototype mismatch
Hello,

I use Apache2::Reload on my dev env :
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadDirectories "/d/"

It works perfectly.
Of course I get the warnings "Subroutine redefined" when modules are reloaded.

But I also get :
Prototype mismatch: sub Functions::to_json: none vs ($@) at /d/Mod.pm line 6.
Prototype mismatch: sub Functions::from_json: none vs ($@) at /d/Mod.pm line 6.
Prototype mismatch: sub Functions::sha256_hex: none vs (;@)
at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
at /d/Mod.pm line 9.
Prototype mismatch: sub Functions::from_to: none vs ($$$;$)
at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
at /d/Mod.pm line 11.

Mod.pm :
1. package Functions;
2. use strict;
3. use warnings;
4. use Exporter qw(import);
5. our @EXPORT_TO = qw(func1 func2 func3);
6. use JSON qw(to_json from_json);
7. use Cache::Memcached;
8. use DBI;
9. use Digest::SHA qw(sha256_hex);
10. use MIME::Types;
11. use Encode qw(from_to);

Should I pay attention to these errors ?
How to properly solve them ?

Thank you very much !

Best regards,

Ben
Re: Apache2::Reload, Prototype mismatch [ In reply to ]
I think JSON module export from_json and to_json by default.

so this just works fine for me:

use strict;
use warnings;
use JSON;

print to_json({a=>1,b=>2});

Your code seems did't pass arguments to the methods correctly?


> On August 22, 2017 at 6:25 PM Ben RUBSON <ben.rubson@gmail.com> wrote:
>
>
> Hello,
>
> I use Apache2::Reload on my dev env :
> PerlModule Apache2::Reload
> PerlInitHandler Apache2::Reload
> PerlSetVar ReloadDirectories "/d/"
>
> It works perfectly.
> Of course I get the warnings "Subroutine redefined" when modules are reloaded.
>
> But I also get :
> Prototype mismatch: sub Functions::to_json: none vs ($@) at /d/Mod.pm line 6.
> Prototype mismatch: sub Functions::from_json: none vs ($@) at /d/Mod.pm line 6.
> Prototype mismatch: sub Functions::sha256_hex: none vs (;@)
> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
> at /d/Mod.pm line 9.
> Prototype mismatch: sub Functions::from_to: none vs ($$$;$)
> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
> at /d/Mod.pm line 11.
>
> Mod.pm :
> 1. package Functions;
> 2. use strict;
> 3. use warnings;
> 4. use Exporter qw(import);
> 5. our @EXPORT_TO = qw(func1 func2 func3);
> 6. use JSON qw(to_json from_json);
> 7. use Cache::Memcached;
> 8. use DBI;
> 9. use Digest::SHA qw(sha256_hex);
> 10. use MIME::Types;
> 11. use Encode qw(from_to);
>
> Should I pay attention to these errors ?
> How to properly solve them ?
>
> Thank you very much !
>
> Best regards,
>
> Ben
>
Re: Apache2::Reload, Prototype mismatch [ In reply to ]
Thank you for your answer !
I only get these errors when module is reloaded by Apache2::Reload.
Not during the next execution of the scripts using the module.
Only when it is reloaded.

I replaced :
use JSON qw(to_json from_json);
by :
use JSON;

And I now get an additional message when the module is reloaded :
Prototype mismatch: sub Functions::encode_json: none vs ($@) at /d/Mod.pm line 6.

encode_json is exported by default, but I don't use it at all.

Thank you again,

Ben


> On 22 Aug 2017, at 12:32, ?? <me@fenghe.org> wrote:
>
> I think JSON module export from_json and to_json by default.
>
> so this just works fine for me:
>
> use strict;
> use warnings;
> use JSON;
>
> print to_json({a=>1,b=>2});
>
> Your code seems did't pass arguments to the methods correctly?
>
>
>> On August 22, 2017 at 6:25 PM Ben RUBSON <ben.rubson@gmail.com> wrote:
>>
>>
>> Hello,
>>
>> I use Apache2::Reload on my dev env :
>> PerlModule Apache2::Reload
>> PerlInitHandler Apache2::Reload
>> PerlSetVar ReloadDirectories "/d/"
>>
>> It works perfectly.
>> Of course I get the warnings "Subroutine redefined" when modules are reloaded.
>>
>> But I also get :
>> Prototype mismatch: sub Functions::to_json: none vs ($@) at /d/Mod.pm line 6.
>> Prototype mismatch: sub Functions::from_json: none vs ($@) at /d/Mod.pm line 6.
>> Prototype mismatch: sub Functions::sha256_hex: none vs (;@)
>> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
>> at /d/Mod.pm line 9.
>> Prototype mismatch: sub Functions::from_to: none vs ($$$;$)
>> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
>> at /d/Mod.pm line 11.
>>
>> Mod.pm :
>> 1. package Functions;
>> 2. use strict;
>> 3. use warnings;
>> 4. use Exporter qw(import);
>> 5. our @EXPORT_TO = qw(func1 func2 func3);
>> 6. use JSON qw(to_json from_json);
>> 7. use Cache::Memcached;
>> 8. use DBI;
>> 9. use Digest::SHA qw(sha256_hex);
>> 10. use MIME::Types;
>> 11. use Encode qw(from_to);
>>
>> Should I pay attention to these errors ?
>> How to properly solve them ?
>>
>> Thank you very much !
>>
>> Best regards,
>>
>> Ben
>>
Re: Apache2::Reload, Prototype mismatch [ In reply to ]
The "subroutine redefined" warning is a normal side-effect of the
Apache2::Reload module providing information about which modules were
effected. I use it on development servers, but not on production
servers, because I want better performance from my production
environments.

Occasionally I've noticed that modules don't reload properly, and
then strange errors occur when there is no problem with code. In
these cases, I stop and start the Apache HTTPd daemon to resolve the
problem.

> Hello,
>
> I use Apache2::Reload on my dev env :
> PerlModule Apache2::Reload
> PerlInitHandler Apache2::Reload
> PerlSetVar ReloadDirectories "/d/"
>
> It works perfectly.
> Of course I get the warnings "Subroutine redefined" when modules are reloaded.
>
> But I also get :
> Prototype mismatch: sub Functions::to_json: none vs ($@) at /d/Mod.pm line 6.
> Prototype mismatch: sub Functions::from_json: none vs ($@) at /d/Mod.pm line 6.
> Prototype mismatch: sub Functions::sha256_hex: none vs (;@)
> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
> at /d/Mod.pm line 9.
> Prototype mismatch: sub Functions::from_to: none vs ($$$;$)
> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
> at /d/Mod.pm line 11.
>
> Mod.pm :
> 1. package Functions;
> 2. use strict;
> 3. use warnings;
> 4. use Exporter qw(import);
> 5. our @EXPORT_TO = qw(func1 func2 func3);
> 6. use JSON qw(to_json from_json);
> 7. use Cache::Memcached;
> 8. use DBI;
> 9. use Digest::SHA qw(sha256_hex);
> 10. use MIME::Types;
> 11. use Encode qw(from_to);
>
> Should I pay attention to these errors ?
> How to properly solve them ?
>
> Thank you very much !
>
> Best regards,
>
> Ben
>


Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/
Re: Apache2::Reload, Prototype mismatch [ In reply to ]
Thank you Randolf for your answer.

Of course for the "subroutine redefined" messages, I agree.

But what about the "Prototype mismatch" messages ?

Ben

> On 22 Aug 2017, at 16:50, Randolf Richardson <randolf@modperl.pl> wrote:
>
> The "subroutine redefined" warning is a normal side-effect of the
> Apache2::Reload module providing information about which modules were
> effected. I use it on development servers, but not on production
> servers, because I want better performance from my production
> environments.
>
> Occasionally I've noticed that modules don't reload properly, and
> then strange errors occur when there is no problem with code. In
> these cases, I stop and start the Apache HTTPd daemon to resolve the
> problem.
>
>> Hello,
>>
>> I use Apache2::Reload on my dev env :
>> PerlModule Apache2::Reload
>> PerlInitHandler Apache2::Reload
>> PerlSetVar ReloadDirectories "/d/"
>>
>> It works perfectly.
>> Of course I get the warnings "Subroutine redefined" when modules are reloaded.
>>
>> But I also get :
>> Prototype mismatch: sub Functions::to_json: none vs ($@) at /d/Mod.pm line 6.
>> Prototype mismatch: sub Functions::from_json: none vs ($@) at /d/Mod.pm line 6.
>> Prototype mismatch: sub Functions::sha256_hex: none vs (;@)
>> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
>> at /d/Mod.pm line 9.
>> Prototype mismatch: sub Functions::from_to: none vs ($$$;$)
>> at /usr/local/lib/perl5/5.24/Exporter.pm line 66.
>> at /d/Mod.pm line 11.
>>
>> Mod.pm :
>> 1. package Functions;
>> 2. use strict;
>> 3. use warnings;
>> 4. use Exporter qw(import);
>> 5. our @EXPORT_TO = qw(func1 func2 func3);
>> 6. use JSON qw(to_json from_json);
>> 7. use Cache::Memcached;
>> 8. use DBI;
>> 9. use Digest::SHA qw(sha256_hex);
>> 10. use MIME::Types;
>> 11. use Encode qw(from_to);
>>
>> Should I pay attention to these errors ?
>> How to properly solve them ?
>>
>> Thank you very much !
>>
>> Best regards,
>>
>> Ben