Can I condense my export routine in my Perl package?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















My current Perl package export feels long (snippet below). And yes, it's better to type all that just once in one place so my many Perl scripts can accesss it all with just:



use Funx;  


Still I was just hoping there would be an easy way to export everything with less typing.



package Funx;
#use strict;
use warnings;
use DBI;

use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(pdone dbstart dbstop dbc dbcdata numnums $SUCCESS $NOFILE
$COPYFAIL $SOXFAIL $CURLFAIL $OPENFAIL $APPRUNNING $RAWDBEXIISTS $DBCREATEERR $DBCONNECTERR $TMPFILEERR $DBWRITEERR $INVALIDUSER $DBLOCKERR $DBUNLOCKERR WERR);

our $SUCCESS = 0;
our $NOFILE = 1;
our $COPYFAIL = 2;
our $SOXFAIL = 3;
our $CURLFAIL = 4;
our $OPENFAIL = 5;
our $APPRUNNING = 6;
our $RAWDBEXIISTS = 7;
our $DBCREATEERR = 8;
our $DBCONNECTERR = 9;
our $TMPFILEERR = 10;
our $DBWRITEERR = 11;
our $INVALIDUSER = 12;
our $DBLOCKERR = 13;
our $DBUNLOCKERR = 14;
use constant WERR => 100;









share|improve this question

























  • What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

    – simbabque
    Nov 22 '18 at 15:35






  • 1





    Export a function that returns a hash? Or just export a hash directly?

    – stevieb
    Nov 22 '18 at 15:44






  • 1





    My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

    – Tanktalus
    Nov 22 '18 at 15:46


















1















My current Perl package export feels long (snippet below). And yes, it's better to type all that just once in one place so my many Perl scripts can accesss it all with just:



use Funx;  


Still I was just hoping there would be an easy way to export everything with less typing.



package Funx;
#use strict;
use warnings;
use DBI;

use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(pdone dbstart dbstop dbc dbcdata numnums $SUCCESS $NOFILE
$COPYFAIL $SOXFAIL $CURLFAIL $OPENFAIL $APPRUNNING $RAWDBEXIISTS $DBCREATEERR $DBCONNECTERR $TMPFILEERR $DBWRITEERR $INVALIDUSER $DBLOCKERR $DBUNLOCKERR WERR);

our $SUCCESS = 0;
our $NOFILE = 1;
our $COPYFAIL = 2;
our $SOXFAIL = 3;
our $CURLFAIL = 4;
our $OPENFAIL = 5;
our $APPRUNNING = 6;
our $RAWDBEXIISTS = 7;
our $DBCREATEERR = 8;
our $DBCONNECTERR = 9;
our $TMPFILEERR = 10;
our $DBWRITEERR = 11;
our $INVALIDUSER = 12;
our $DBLOCKERR = 13;
our $DBUNLOCKERR = 14;
use constant WERR => 100;









share|improve this question

























  • What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

    – simbabque
    Nov 22 '18 at 15:35






  • 1





    Export a function that returns a hash? Or just export a hash directly?

    – stevieb
    Nov 22 '18 at 15:44






  • 1





    My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

    – Tanktalus
    Nov 22 '18 at 15:46














1












1








1


0






My current Perl package export feels long (snippet below). And yes, it's better to type all that just once in one place so my many Perl scripts can accesss it all with just:



use Funx;  


Still I was just hoping there would be an easy way to export everything with less typing.



package Funx;
#use strict;
use warnings;
use DBI;

use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(pdone dbstart dbstop dbc dbcdata numnums $SUCCESS $NOFILE
$COPYFAIL $SOXFAIL $CURLFAIL $OPENFAIL $APPRUNNING $RAWDBEXIISTS $DBCREATEERR $DBCONNECTERR $TMPFILEERR $DBWRITEERR $INVALIDUSER $DBLOCKERR $DBUNLOCKERR WERR);

our $SUCCESS = 0;
our $NOFILE = 1;
our $COPYFAIL = 2;
our $SOXFAIL = 3;
our $CURLFAIL = 4;
our $OPENFAIL = 5;
our $APPRUNNING = 6;
our $RAWDBEXIISTS = 7;
our $DBCREATEERR = 8;
our $DBCONNECTERR = 9;
our $TMPFILEERR = 10;
our $DBWRITEERR = 11;
our $INVALIDUSER = 12;
our $DBLOCKERR = 13;
our $DBUNLOCKERR = 14;
use constant WERR => 100;









share|improve this question
















My current Perl package export feels long (snippet below). And yes, it's better to type all that just once in one place so my many Perl scripts can accesss it all with just:



use Funx;  


Still I was just hoping there would be an easy way to export everything with less typing.



package Funx;
#use strict;
use warnings;
use DBI;

use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(pdone dbstart dbstop dbc dbcdata numnums $SUCCESS $NOFILE
$COPYFAIL $SOXFAIL $CURLFAIL $OPENFAIL $APPRUNNING $RAWDBEXIISTS $DBCREATEERR $DBCONNECTERR $TMPFILEERR $DBWRITEERR $INVALIDUSER $DBLOCKERR $DBUNLOCKERR WERR);

our $SUCCESS = 0;
our $NOFILE = 1;
our $COPYFAIL = 2;
our $SOXFAIL = 3;
our $CURLFAIL = 4;
our $OPENFAIL = 5;
our $APPRUNNING = 6;
our $RAWDBEXIISTS = 7;
our $DBCREATEERR = 8;
our $DBCONNECTERR = 9;
our $TMPFILEERR = 10;
our $DBWRITEERR = 11;
our $INVALIDUSER = 12;
our $DBLOCKERR = 13;
our $DBUNLOCKERR = 14;
use constant WERR => 100;






perl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 15:34









simbabque

44.5k757106




44.5k757106










asked Nov 22 '18 at 15:33









Daniel KaplanDaniel Kaplan

332210




332210













  • What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

    – simbabque
    Nov 22 '18 at 15:35






  • 1





    Export a function that returns a hash? Or just export a hash directly?

    – stevieb
    Nov 22 '18 at 15:44






  • 1





    My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

    – Tanktalus
    Nov 22 '18 at 15:46



















  • What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

    – simbabque
    Nov 22 '18 at 15:35






  • 1





    Export a function that returns a hash? Or just export a hash directly?

    – stevieb
    Nov 22 '18 at 15:44






  • 1





    My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

    – Tanktalus
    Nov 22 '18 at 15:46

















What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

– simbabque
Nov 22 '18 at 15:35





What does Funx stand for? It's a good idea to use descriptive names for things. Also, why is use strict commented out?

– simbabque
Nov 22 '18 at 15:35




1




1





Export a function that returns a hash? Or just export a hash directly?

– stevieb
Nov 22 '18 at 15:44





Export a function that returns a hash? Or just export a hash directly?

– stevieb
Nov 22 '18 at 15:44




1




1





My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

– Tanktalus
Nov 22 '18 at 15:46





My 2 cents: call the package Err, and don't export. Then you can use return $Err::OPENFAIL; which is, IMO, clearer anyway.

– Tanktalus
Nov 22 '18 at 15:46












2 Answers
2






active

oldest

votes


















5














If you used constants instead of variables,



package Funx;

use strict;
use warnings;

use constant qw( );
use Exporter qw( import );

BEGIN {
my %error_codes = (
FUNX_SUCCESS => 0,
FUNX_NOFILE => 1,
FUNX_COPYFAIL => 2,
FUNX_SOXFAIL => 3,
FUNX_CURLFAIL => 4,
FUNX_OPENFAIL => 5,
FUNX_APPRUNNING => 6,
FUNX_RAWDBEXIISTS => 7,
FUNX_DBCREATEERR => 8,
FUNX_DBCONNECTERR => 9,
FUNX_TMPFILEERR => 10,
FUNX_DBWRITEERR => 11,
FUNX_INVALIDUSER => 12,
FUNX_DBLOCKERR => 13,
FUNX_DBUNLOCKERR => 14,
FUNX_WERR => 100,
);

constant->import(%error_codes);

my @syms = keys(%error_codes);
our @EXPORT_OK = @syms;
our %EXPORT_TAGS = ( ALL => @syms, ERROR_CODES => @syms );
}


On top of addressing the issue you raised, the above




  • Fixes the polluting of the user's namespace. Don't dump a bunch of symbols into other namespaces by default!

  • Fixes the poor names that could conflict with other modules. You think you're the only module that has a code for SUCCESS?

  • Fixes the polluting of your module's @ISA. Funx is not a subclass of Exporter.


Usage:



use Funx;                                 # Imports nothing.
use Funx qw( ); # Imports nothing.
use Funx qw( :ERROR_CODES ); # Imports error codes.
use Funx qw( :ALL ); # Imports error codes.
use Funx qw( FUNX_SUCCESS FUNX_NOFILE ); # Imports specific error codes.





share|improve this answer

































    1














    You can use source filter to add some custom preprocessing.



    Example:



    package MyExport;

    use Filter::Util::Call;

    sub import {
    my ($type) = @_;
    my ($ref) = ;
    filter_add(bless $ref);
    }

    sub filter {
    my ($self) = @_;
    my ($status);

    if (($status = filter_read()) > 0) {
    s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/;
    }

    $status;
    }

    1;


    Usage:



    ...
    use MyExport;
    use Exporter;
    our @ISA = 'Exporter';
    our @EXPORT;
    ...
    our export $SUCCESS = 0;
    ...


    Note that this implementation may be buggy. Basically s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/; regexp turns lines like



    our export $SUCCESS = 0;


    into



    push @EXPORT, '$SUCCESS'; our $SUCCESS = 0;





    share|improve this answer
























    • Please don't seriously suggest source filters for anything more than trivial oneliners...

      – Grinnz
      Nov 23 '18 at 19:58












    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434203%2fcan-i-condense-my-export-routine-in-my-perl-package%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    If you used constants instead of variables,



    package Funx;

    use strict;
    use warnings;

    use constant qw( );
    use Exporter qw( import );

    BEGIN {
    my %error_codes = (
    FUNX_SUCCESS => 0,
    FUNX_NOFILE => 1,
    FUNX_COPYFAIL => 2,
    FUNX_SOXFAIL => 3,
    FUNX_CURLFAIL => 4,
    FUNX_OPENFAIL => 5,
    FUNX_APPRUNNING => 6,
    FUNX_RAWDBEXIISTS => 7,
    FUNX_DBCREATEERR => 8,
    FUNX_DBCONNECTERR => 9,
    FUNX_TMPFILEERR => 10,
    FUNX_DBWRITEERR => 11,
    FUNX_INVALIDUSER => 12,
    FUNX_DBLOCKERR => 13,
    FUNX_DBUNLOCKERR => 14,
    FUNX_WERR => 100,
    );

    constant->import(%error_codes);

    my @syms = keys(%error_codes);
    our @EXPORT_OK = @syms;
    our %EXPORT_TAGS = ( ALL => @syms, ERROR_CODES => @syms );
    }


    On top of addressing the issue you raised, the above




    • Fixes the polluting of the user's namespace. Don't dump a bunch of symbols into other namespaces by default!

    • Fixes the poor names that could conflict with other modules. You think you're the only module that has a code for SUCCESS?

    • Fixes the polluting of your module's @ISA. Funx is not a subclass of Exporter.


    Usage:



    use Funx;                                 # Imports nothing.
    use Funx qw( ); # Imports nothing.
    use Funx qw( :ERROR_CODES ); # Imports error codes.
    use Funx qw( :ALL ); # Imports error codes.
    use Funx qw( FUNX_SUCCESS FUNX_NOFILE ); # Imports specific error codes.





    share|improve this answer






























      5














      If you used constants instead of variables,



      package Funx;

      use strict;
      use warnings;

      use constant qw( );
      use Exporter qw( import );

      BEGIN {
      my %error_codes = (
      FUNX_SUCCESS => 0,
      FUNX_NOFILE => 1,
      FUNX_COPYFAIL => 2,
      FUNX_SOXFAIL => 3,
      FUNX_CURLFAIL => 4,
      FUNX_OPENFAIL => 5,
      FUNX_APPRUNNING => 6,
      FUNX_RAWDBEXIISTS => 7,
      FUNX_DBCREATEERR => 8,
      FUNX_DBCONNECTERR => 9,
      FUNX_TMPFILEERR => 10,
      FUNX_DBWRITEERR => 11,
      FUNX_INVALIDUSER => 12,
      FUNX_DBLOCKERR => 13,
      FUNX_DBUNLOCKERR => 14,
      FUNX_WERR => 100,
      );

      constant->import(%error_codes);

      my @syms = keys(%error_codes);
      our @EXPORT_OK = @syms;
      our %EXPORT_TAGS = ( ALL => @syms, ERROR_CODES => @syms );
      }


      On top of addressing the issue you raised, the above




      • Fixes the polluting of the user's namespace. Don't dump a bunch of symbols into other namespaces by default!

      • Fixes the poor names that could conflict with other modules. You think you're the only module that has a code for SUCCESS?

      • Fixes the polluting of your module's @ISA. Funx is not a subclass of Exporter.


      Usage:



      use Funx;                                 # Imports nothing.
      use Funx qw( ); # Imports nothing.
      use Funx qw( :ERROR_CODES ); # Imports error codes.
      use Funx qw( :ALL ); # Imports error codes.
      use Funx qw( FUNX_SUCCESS FUNX_NOFILE ); # Imports specific error codes.





      share|improve this answer




























        5












        5








        5







        If you used constants instead of variables,



        package Funx;

        use strict;
        use warnings;

        use constant qw( );
        use Exporter qw( import );

        BEGIN {
        my %error_codes = (
        FUNX_SUCCESS => 0,
        FUNX_NOFILE => 1,
        FUNX_COPYFAIL => 2,
        FUNX_SOXFAIL => 3,
        FUNX_CURLFAIL => 4,
        FUNX_OPENFAIL => 5,
        FUNX_APPRUNNING => 6,
        FUNX_RAWDBEXIISTS => 7,
        FUNX_DBCREATEERR => 8,
        FUNX_DBCONNECTERR => 9,
        FUNX_TMPFILEERR => 10,
        FUNX_DBWRITEERR => 11,
        FUNX_INVALIDUSER => 12,
        FUNX_DBLOCKERR => 13,
        FUNX_DBUNLOCKERR => 14,
        FUNX_WERR => 100,
        );

        constant->import(%error_codes);

        my @syms = keys(%error_codes);
        our @EXPORT_OK = @syms;
        our %EXPORT_TAGS = ( ALL => @syms, ERROR_CODES => @syms );
        }


        On top of addressing the issue you raised, the above




        • Fixes the polluting of the user's namespace. Don't dump a bunch of symbols into other namespaces by default!

        • Fixes the poor names that could conflict with other modules. You think you're the only module that has a code for SUCCESS?

        • Fixes the polluting of your module's @ISA. Funx is not a subclass of Exporter.


        Usage:



        use Funx;                                 # Imports nothing.
        use Funx qw( ); # Imports nothing.
        use Funx qw( :ERROR_CODES ); # Imports error codes.
        use Funx qw( :ALL ); # Imports error codes.
        use Funx qw( FUNX_SUCCESS FUNX_NOFILE ); # Imports specific error codes.





        share|improve this answer















        If you used constants instead of variables,



        package Funx;

        use strict;
        use warnings;

        use constant qw( );
        use Exporter qw( import );

        BEGIN {
        my %error_codes = (
        FUNX_SUCCESS => 0,
        FUNX_NOFILE => 1,
        FUNX_COPYFAIL => 2,
        FUNX_SOXFAIL => 3,
        FUNX_CURLFAIL => 4,
        FUNX_OPENFAIL => 5,
        FUNX_APPRUNNING => 6,
        FUNX_RAWDBEXIISTS => 7,
        FUNX_DBCREATEERR => 8,
        FUNX_DBCONNECTERR => 9,
        FUNX_TMPFILEERR => 10,
        FUNX_DBWRITEERR => 11,
        FUNX_INVALIDUSER => 12,
        FUNX_DBLOCKERR => 13,
        FUNX_DBUNLOCKERR => 14,
        FUNX_WERR => 100,
        );

        constant->import(%error_codes);

        my @syms = keys(%error_codes);
        our @EXPORT_OK = @syms;
        our %EXPORT_TAGS = ( ALL => @syms, ERROR_CODES => @syms );
        }


        On top of addressing the issue you raised, the above




        • Fixes the polluting of the user's namespace. Don't dump a bunch of symbols into other namespaces by default!

        • Fixes the poor names that could conflict with other modules. You think you're the only module that has a code for SUCCESS?

        • Fixes the polluting of your module's @ISA. Funx is not a subclass of Exporter.


        Usage:



        use Funx;                                 # Imports nothing.
        use Funx qw( ); # Imports nothing.
        use Funx qw( :ERROR_CODES ); # Imports error codes.
        use Funx qw( :ALL ); # Imports error codes.
        use Funx qw( FUNX_SUCCESS FUNX_NOFILE ); # Imports specific error codes.






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 23 '18 at 5:52

























        answered Nov 23 '18 at 5:42









        ikegamiikegami

        268k11181407




        268k11181407

























            1














            You can use source filter to add some custom preprocessing.



            Example:



            package MyExport;

            use Filter::Util::Call;

            sub import {
            my ($type) = @_;
            my ($ref) = ;
            filter_add(bless $ref);
            }

            sub filter {
            my ($self) = @_;
            my ($status);

            if (($status = filter_read()) > 0) {
            s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/;
            }

            $status;
            }

            1;


            Usage:



            ...
            use MyExport;
            use Exporter;
            our @ISA = 'Exporter';
            our @EXPORT;
            ...
            our export $SUCCESS = 0;
            ...


            Note that this implementation may be buggy. Basically s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/; regexp turns lines like



            our export $SUCCESS = 0;


            into



            push @EXPORT, '$SUCCESS'; our $SUCCESS = 0;





            share|improve this answer
























            • Please don't seriously suggest source filters for anything more than trivial oneliners...

              – Grinnz
              Nov 23 '18 at 19:58
















            1














            You can use source filter to add some custom preprocessing.



            Example:



            package MyExport;

            use Filter::Util::Call;

            sub import {
            my ($type) = @_;
            my ($ref) = ;
            filter_add(bless $ref);
            }

            sub filter {
            my ($self) = @_;
            my ($status);

            if (($status = filter_read()) > 0) {
            s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/;
            }

            $status;
            }

            1;


            Usage:



            ...
            use MyExport;
            use Exporter;
            our @ISA = 'Exporter';
            our @EXPORT;
            ...
            our export $SUCCESS = 0;
            ...


            Note that this implementation may be buggy. Basically s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/; regexp turns lines like



            our export $SUCCESS = 0;


            into



            push @EXPORT, '$SUCCESS'; our $SUCCESS = 0;





            share|improve this answer
























            • Please don't seriously suggest source filters for anything more than trivial oneliners...

              – Grinnz
              Nov 23 '18 at 19:58














            1












            1








            1







            You can use source filter to add some custom preprocessing.



            Example:



            package MyExport;

            use Filter::Util::Call;

            sub import {
            my ($type) = @_;
            my ($ref) = ;
            filter_add(bless $ref);
            }

            sub filter {
            my ($self) = @_;
            my ($status);

            if (($status = filter_read()) > 0) {
            s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/;
            }

            $status;
            }

            1;


            Usage:



            ...
            use MyExport;
            use Exporter;
            our @ISA = 'Exporter';
            our @EXPORT;
            ...
            our export $SUCCESS = 0;
            ...


            Note that this implementation may be buggy. Basically s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/; regexp turns lines like



            our export $SUCCESS = 0;


            into



            push @EXPORT, '$SUCCESS'; our $SUCCESS = 0;





            share|improve this answer













            You can use source filter to add some custom preprocessing.



            Example:



            package MyExport;

            use Filter::Util::Call;

            sub import {
            my ($type) = @_;
            my ($ref) = ;
            filter_add(bless $ref);
            }

            sub filter {
            my ($self) = @_;
            my ($status);

            if (($status = filter_read()) > 0) {
            s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/;
            }

            $status;
            }

            1;


            Usage:



            ...
            use MyExport;
            use Exporter;
            our @ISA = 'Exporter';
            our @EXPORT;
            ...
            our export $SUCCESS = 0;
            ...


            Note that this implementation may be buggy. Basically s/^(.*)s+exports+(S+)(.*)$/push @EXPORT, '$2'; $1 $2 $3/; regexp turns lines like



            our export $SUCCESS = 0;


            into



            push @EXPORT, '$SUCCESS'; our $SUCCESS = 0;






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 '18 at 17:03









            UjinT34UjinT34

            2,0711316




            2,0711316













            • Please don't seriously suggest source filters for anything more than trivial oneliners...

              – Grinnz
              Nov 23 '18 at 19:58



















            • Please don't seriously suggest source filters for anything more than trivial oneliners...

              – Grinnz
              Nov 23 '18 at 19:58

















            Please don't seriously suggest source filters for anything more than trivial oneliners...

            – Grinnz
            Nov 23 '18 at 19:58





            Please don't seriously suggest source filters for anything more than trivial oneliners...

            – Grinnz
            Nov 23 '18 at 19:58


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434203%2fcan-i-condense-my-export-routine-in-my-perl-package%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents