Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbols associated with negated tags aren't removed from the import list #8

Closed
djerius opened this issue Sep 24, 2022 · 2 comments
Closed
Labels

Comments

@djerius
Copy link

djerius commented Sep 24, 2022

Exporter::Tiny version 1.004002

According to the docs,

You can add the bang prefix to tags too. This will import everything
except the colours.

use MyUtils qw( -all !:colours );

but it seems it doesn't work:

use v5.10;

use strict;
use warnings;

package Mine::AllMine {
    use base 'Exporter::Tiny';
    use constant { map { $_ => 1 } 'chocolate', 'vanilla' };

    our %EXPORT_TAGS = ( want => [qw( chocolate vanilla )] );
    our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
}


my %stuff;

%stuff = ();
Mine::AllMine->import( { into => \%stuff }, '-all' );
say 'All: ', join ', ', keys %stuff;

%stuff = ();
Mine::AllMine->import( { into => \%stuff }, '-all', '!vanilla' );
say 'All - vanilla: ', join ', ', keys %stuff;

%stuff = ();
Mine::AllMine->import( { into => \%stuff }, '-want' );
say 'Want: ', join ', ', keys %stuff;

%stuff = ();
Mine::AllMine->import( { into => \%stuff }, '-want', '!-want' );
say 'Want - Want: ', join ', ', keys %stuff;

With output:

$ perl  dev/exporter_tiny.pl
All: vanilla, chocolate
All - vanilla: chocolate
Want: chocolate, vanilla
Want - Want: chocolate, vanilla

I expected the Want - Want results to be an empty list.

@tobyink
Copy link
Owner

tobyink commented Sep 26, 2022

Yeah, it looks like I documented them as working but never implemented it!

@tobyink tobyink added the bug label Sep 30, 2022
tobyink added a commit that referenced this issue Sep 30, 2022
@tobyink tobyink closed this as completed Sep 30, 2022
clrpackages pushed a commit to clearlinux-pkgs/perl-Exporter-Tiny that referenced this issue Sep 30, 2022
…2 to version 1.004003

1.004003	2022-09-30

 [ Bug Fixes ]
 - If exporting non-CODE items which happen to have the same name as
   exported CODE items, their export was being quietly blocked. These
   exports should now work.
   Diab Jerius++
   <tobyink/p5-exporter-tiny#9>
 - Using ! with a tag now works; it was previously documented as working
   but not implemented.
   Diab Jerius++
   <tobyink/p5-exporter-tiny#8>
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 1, 2022
Upstream changes:
1.004003        2022-09-30

 [ Bug Fixes ]
 - If exporting non-CODE items which happen to have the same name as
   exported CODE items, their export was being quietly blocked. These
   exports should now work.
   Diab Jerius++
   <tobyink/p5-exporter-tiny#9>
 - Using ! with a tag now works; it was previously documented as working
   but not implemented.
   Diab Jerius++
   <tobyink/p5-exporter-tiny#8>

1.004002        2022-09-16

 [ Test Suite ]
 - Fix for t/15nonhashvalue.t on old versions of Test::More which don't
   support `done_testing`.

1.004001        2022-09-09

 [ Bug Fixes ]
 - Fix handling of non-hashref references in import list.

1.004000        2022-08-26

 [ Documentation ]
 - Document that the `-lexical` export option is experimental.

 [ Packaging ]
 - No functional changes; repackage as stable.

1.003_002       2022-08-18

 [ Bug Fixes ]
 - Quote $1 when passing it as a parameter to a function
   Eugen Konkov++
   <tobyink/p5-exporter-tiny#7>

1.003_001       2022-07-21

 [ Bug Fixes ]
 - Correctly check Perl version is at least 5.37.2+ before supporting
   -lexical option.

1.003_000       2022-07-21

 - Updated: Provide a `-lexical` export option on Perl 5.37.2+.
@djerius
Copy link
Author

djerius commented Oct 3, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants