Network::network_equal: fix definition check of array

Message ID 20180211231930.12738-1-berny156@gmx.de
State Dropped
Headers show
Series Network::network_equal: fix definition check of array | expand

Commit Message

Bernhard Held Feb. 12, 2018, 10:19 a.m. UTC
---
 config/cfgroot/network-functions.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tremer Feb. 12, 2018, 10:38 a.m. UTC | #1
Hello,

this patch shows the following perl errors:

defined(@array) is deprecated at config/cfgroot/network-functions.pl line 114.
	(Maybe you should just omit the defined()?)
defined(@array) is deprecated at config/cfgroot/network-functions.pl line 114.
	(Maybe you should just omit the defined()?)

You can use the testsuite at the bottom of the file to confirm that the
functions are doing what they are supposed to do.

Best,
-Michael

On Mon, 2018-02-12 at 00:19 +0100, Bernhard Held wrote:
> ---
>  config/cfgroot/network-functions.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl
> index 2902aabb0..3bf17b092 100644
> --- a/config/cfgroot/network-functions.pl
> +++ b/config/cfgroot/network-functions.pl
> @@ -111,7 +111,7 @@ sub network_equal {
>  	my @bin1 = &network2bin($network1);
>  	my @bin2 = &network2bin($network2);
>  
> -	if (!defined $bin1 || !defined $bin2) {
> +	if (!defined @bin1 || !defined @bin2) {
>  		return undef;
>  	}
>
Bernhard Held Feb. 12, 2018, 11:19 a.m. UTC | #2
On 02/12/2018 at 12:38 AM, Michael Tremer wrote:
> Hello,
> 
> this patch shows the following perl errors:
> 
> defined(@array) is deprecated at config/cfgroot/network-functions.pl line 114.
> 	(Maybe you should just omit the defined()?)
> defined(@array) is deprecated at config/cfgroot/network-functions.pl line 114.
> 	(Maybe you should just omit the defined()?)

Interesting, I'm testing on IPFire 2.19. Here perl 5.12 prefers the '$'.
My host with Perl 5.26 indeed prefers the '@' as well.

Which perl versions apply for network-functions.pl?

> You can use the testsuite at the bottom of the file to confirm that the
> functions are doing what they are supposed to do.
Thanks, this helps ;-)

Regards,
Bernhard
Michael Tremer Feb. 12, 2018, 10:08 p.m. UTC | #3
Hi,

the perl version is a bit outdated that we are running on IPFire. It's perl
5.12.3: https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=lfs/perl;h=0c239318c39
15cdfbad3ff602b075bb425513bf3;hb=HEAD

I ran that testsuite with exactly that version of perl.

Best,
-Michael

On Mon, 2018-02-12 at 01:19 +0100, Bernhard Held wrote:
> On 02/12/2018 at 12:38 AM, Michael Tremer wrote:
> > Hello,
> > 
> > this patch shows the following perl errors:
> > 
> > defined(@array) is deprecated at config/cfgroot/network-functions.pl line
> > 114.
> > 	(Maybe you should just omit the defined()?)
> > defined(@array) is deprecated at config/cfgroot/network-functions.pl line
> > 114.
> > 	(Maybe you should just omit the defined()?)
> 
> Interesting, I'm testing on IPFire 2.19. Here perl 5.12 prefers the '$'.
> My host with Perl 5.26 indeed prefers the '@' as well.
> 
> Which perl versions apply for network-functions.pl?
> 
> > You can use the testsuite at the bottom of the file to confirm that the
> > functions are doing what they are supposed to do.
> 
> Thanks, this helps ;-)
> 
> Regards,
> Bernhard

Patch

diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl
index 2902aabb0..3bf17b092 100644
--- a/config/cfgroot/network-functions.pl
+++ b/config/cfgroot/network-functions.pl
@@ -111,7 +111,7 @@  sub network_equal {
 	my @bin1 = &network2bin($network1);
 	my @bin2 = &network2bin($network2);
 
-	if (!defined $bin1 || !defined $bin2) {
+	if (!defined @bin1 || !defined @bin2) {
 		return undef;
 	}