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

Discussion in 'Perl Misc' started by Paul Southworth, Feb 23, 2004.

  1. 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
     
    Paul Southworth, Feb 23, 2004
    #1
    1. Advertising

  2. Paul Southworth

    Ben Morrow Guest

    (Paul Southworth) wrote:
    > 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

    --
    perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
    qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
    1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
    2047502190/' #
     
    Ben Morrow, Feb 23, 2004
    #2
    1. Advertising

  3. In article <c1bqn7$oa8$>,
    Ben Morrow <> wrote:
    >
    > (Paul Southworth) wrote:
    >> 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 => '@',
     
    Paul Southworth, Feb 23, 2004
    #3
  4. Paul Southworth

    Sam Holden Guest

    On Mon, 23 Feb 2004 03:30:09 GMT,
    Paul Southworth <> wrote:
    > In article <c1bqn7$oa8$>,
    > Ben Morrow <> wrote:
    >>
    >> (Paul Southworth) wrote:
    >>> 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...

    --
    Sam Holden
     
    Sam Holden, Feb 23, 2004
    #4
  5. Paul Southworth

    Anno Siegel Guest

    Sam Holden <> wrote in comp.lang.perl.misc:
    > On Mon, 23 Feb 2004 03:30:09 GMT,
    > Paul Southworth <> wrote:
    > > In article <c1bqn7$oa8$>,
    > > Ben Morrow <> wrote:
    > >> (Paul Southworth) wrote:


    [...]

    > > $ 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
     
    Anno Siegel, Feb 23, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cory Nelson
    Replies:
    2
    Views:
    415
    Cory Nelson
    Apr 15, 2004
  2. =?Utf-8?B?QnJ5YW4gWk0=?=
    Replies:
    1
    Views:
    1,156
    =?Utf-8?B?QnJ5YW4gWk0=?=
    May 26, 2005
  3. bb
    Replies:
    2
    Views:
    387
  4. Mark
    Replies:
    6
    Views:
    574
    Andrew Thompson
    Nov 15, 2005
  5. John fabiani
    Replies:
    14
    Views:
    521
    Donn Cave
    Jul 2, 2004
Loading...

Share This Page