Quick export question

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default RE: Quick export question

    > I'm wanting to setup a module that will export whatever is in
    > @EXPORT (if anythign) and ':basic'
    >
    > IE I want
    > use Monkey;
    > To be identical to
    > use Monkey qw(:basic);
    >
    > So if I have this on the module which of 3 ways I'm trying to
    > accoomplish that are valid (if any)?
    >
    > %EXPORT_TAGS = {
    > ':basic' => [qw(fred wilma barney dino)],
    > };
    Sorry about the mess there, Let me fix it:

    $EXPORT_TAGS{':DEFAULT'} = $EXPORT_TAGS{':basic'};

    Or

    $EXPORT_TAGS{':DEFAULT'} .= $EXPORT_TAGS{':basic'};

    Or

    $EXPORT_TAGS{':DEFAULT'} = > ($EXPORT_TAGS{':basic'},@EXPORT);

    There that's more readable!

    >
    > TIA
    >
    > Dan
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    Dan Muey Guest

  2. Similar Questions and Discussions

    1. very quick question
      In my database a field is designated as 0 or -1 . When i make my form how do i set up the drop down menu so that the user chooses yes or no and...
    2. Quick CSS question
      Hi, I have a css file that I used when building my template. Now that I'm building additional pages from the template, do I edit the same css file...
    3. quick MX question....
      how do you get rid of that window on the right where it says 'color swatches', 'components', etc.. it really bothers me, it makes the working area...
    4. Quick question
      if you want to select top 100 records, you will use SELECT TOP 100 * FROM tableName Is there anyone knows how to find bottom 100 records? ...
    5. A Quick Question
      Does anyone know if it is possible to create a Flash movie that has the ability to let the user click on a button to begin the installation of a...
  3. #2

    Default RE: Quick export question

    Dan Muey <dmuey@infiniplex.com> wrote:
    :
    : I'm wanting to setup a module that will export whatever is in
    : @EXPORT (if anythign) and ':basic'
    :
    : IE I want
    : use Monkey;
    : To be identical to
    : use Monkey qw(:basic);

    Seems like you really need is a way to test this
    for yourself. Here's a quickie I just wrote. I'm sure
    it fails for some modules, but . . .

    use strict;
    use warnings;
    use Data::Dumper;

    print Dumper imported( 'CGI', ':html' );

    sub imported {
    my( $module, @import ) = @_;
    require "$module.pm";
    my @previous_keys = keys %::;
    import $module @import;

    my %symbol_table = %::;
    delete @symbol_table{ @previous_keys };
    return [ keys %symbol_table ];
    }


    HTH,

    Charles K. Clarkson
    --
    Head Bottle Washer,
    Clarkson Energy Homes, Inc.
    Mobile Home Specialists
    254 968-8328


    Charles K. Clarkson Guest

  4. #3

    Default RE: Quick export question

    Dan Muey wrote:
    > I'm wanting to setup a module that will export whatever is in
    > @EXPORT (if anythign) and ':basic'
    >
    > IE I want
    > use Monkey;
    > To be identical to
    > use Monkey qw(:basic);
    >
    > So if I have this on the module which of 3 ways I'm trying to
    > accoomplish that are valid (if any)?
    >
    > %EXPORT_TAGS = {
    > ':basic' => [qw(fred wilma barney dino)],
    > };
    > $EXPORT_TAGS{':DEFAULT'} = $EXPORT_TAGS{':basic'}; # this would do it
    > right? Or
    > $EXPORT_TAGS{':DEFAULT'} .= $EXPORT_TAGS{':basic'}; Or
    > $EXPORT_TAGS{':DEFAULT'} = ($EXPORT_TAGS{':basic'},@EXPORT);
    Probably this will work (haven't tried it):

    $EXPORT_TAGS{':DEFAULT'} = [ @{$EXPORT_TAGS{':basic'}}, @EXPORT ];

    But I would do this instead:

    my @basic = qw(fred wilma barney dino);
    our @EXPORT = (qw/foo bar baz/, @basic);
    our %EXPORT_TAGS = (':basic' => \@basic);

    I don't think defining :DEFAULT for yourself is what the author of Exporter
    had in mind...
    Bob Showalter Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139