This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline changes into win32 branch. Now would be a good time
[perl5.git] / lib / fields.pm
1 package fields;
2
3 sub import {
4     my $class = shift;
5     my ($package) = caller;
6     my $fields = \%{"$package\::FIELDS"};
7     my $i = $fields->{__MAX__};
8     foreach my $f (@_) {
9         if (defined($fields->{$f})) {
10             require Carp;
11             Carp::croak("Field name $f already in use");
12         }
13         $fields->{$f} = ++$i;
14     }
15     $fields->{__MAX__} = $i;
16 }
17
18 1;