use Net::protoent no longer works w/ FreeBSD perl 5.6.1

P

Paul Southworth

use Net::protoent;

This statement works with FreeBSD 4.8's default perl 5.005_03 but not with
perl 5.6.1 (built from FreeBSD ports). What happened and where can
I learn about the changes?

# uname -r
4.8-RELEASE-p13

[Trying perl 5.005_03]

# use.perl system
# perl -e 'use Net::protoent;'

[Trying perl 5.6.1]

# use.perl port
# perl -e 'use Net::protoent;'
'getproto' is not a valid variable name at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Email Cc: of any clues would be appreciated.

--Paul
 
B

Ben Morrow

use Net::protoent;

This statement works with FreeBSD 4.8's default perl 5.005_03 but not with
perl 5.6.1 (built from FreeBSD ports). What happened and where can
I learn about the changes?

# uname -r
4.8-RELEASE-p13

[Trying perl 5.005_03]

# use.perl system
# perl -e 'use Net::protoent;'

[Trying perl 5.6.1]

# use.perl port
# perl -e 'use Net::protoent;'
'getproto' is not a valid variable name at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Can you show us about the first 20 lines of /usr/local/.../protoent.pm?
Email Cc: of any clues would be appreciated.

No, sorry. This is Usenet.

Ben
 
P

Paul Southworth

[email protected] (Paul Southworth) said:
use Net::protoent;

This statement works with FreeBSD 4.8's default perl 5.005_03 but not with
perl 5.6.1 (built from FreeBSD ports). What happened and where can
I learn about the changes?

# uname -r
4.8-RELEASE-p13

[Trying perl 5.005_03]

# use.perl system
# perl -e 'use Net::protoent;'

[Trying perl 5.6.1]

# use.perl port
# perl -e 'use Net::protoent;'
'getproto' is not a valid variable name at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Can you show us about the first 20 lines of /usr/local/.../protoent.pm?

Yes!

$ head -20 /usr/local/lib/perl5/5.6.1/Net/protoent.pm
package Net::protoent;
use strict;

use 5.005_64;
our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN {
use Exporter ();
@EXPORT = qw(getprotobyname getprotobynumber getprotoent);
@EXPORT_OK = qw( $p_name @p_aliases $p_proto getproto );
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}
use vars @EXPORT_OK;

# Class::Struct forbids use of @ISA
sub import { goto &Exporter::import }

use Class::Struct qw(struct);
struct 'Net::protoent' => [
name => '$',
aliases => '@',
 
S

Sam Holden

[email protected] (Paul Southworth) said:
use Net::protoent;

This statement works with FreeBSD 4.8's default perl 5.005_03 but not with
perl 5.6.1 (built from FreeBSD ports). What happened and where can
I learn about the changes?

# uname -r
4.8-RELEASE-p13

[Trying perl 5.005_03]

# use.perl system
# perl -e 'use Net::protoent;'

[Trying perl 5.6.1]

# use.perl port
# perl -e 'use Net::protoent;'
'getproto' is not a valid variable name at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12
BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.6.1/Net/protoent.pm line 12.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Can you show us about the first 20 lines of /usr/local/.../protoent.pm?

Yes!

$ head -20 /usr/local/lib/perl5/5.6.1/Net/protoent.pm
package Net::protoent;
use strict;

use 5.005_64;
our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN {
use Exporter ();
@EXPORT = qw(getprotobyname getprotobynumber getprotoent);
@EXPORT_OK = qw( $p_name @p_aliases $p_proto getproto );
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}

use vars @EXPORT_OK;

Due to @EXPORT_OK being used as a list of variable names it can't include
the function, moving the function to @EXPORT seems the simplest solution.

On the perl 5.6.1 on both linux and Solaris machines here the same problem
exists, the 5.8.3 install of perl works fine, and looking at its copy
of that file "getproto" has been moved to @EXPORT.

On the perl 5.005_02 here the "getproto" function also isn't in the
@EXPORT_OK list (though it also isn't in the @EXPORT list), so I guess you've
stumbled across a bug that was fixed sometime between 5.6.1 and 5.8.3 and
intoduced sometime between 5.005_03 and 5.6.1... I'd take a stab and guess
at the 5.005 -> 5.6 and 5.6 -> 5.8 points if I had to start looking...

So upgrade :)

Or just move it from @EXPORT_OK to @EXPORT...
 
A

Anno Siegel

Sam Holden said:
[...]
$ head -20 /usr/local/lib/perl5/5.6.1/Net/protoent.pm
package Net::protoent;
use strict;

use 5.005_64;
our(@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN {
use Exporter ();
@EXPORT = qw(getprotobyname getprotobynumber getprotoent);
@EXPORT_OK = qw( $p_name @p_aliases $p_proto getproto );
%EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
}

use vars @EXPORT_OK;

Due to @EXPORT_OK being used as a list of variable names it can't include
the function, moving the function to @EXPORT seems the simplest solution.

Or leave it in @EXPORT_OK and say

use vars grep /^[$@%]/, @EXPORT_OK;

That's still pretty readable.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top