ain symbols from being
exported. Typically this applies to extensions which have functions
or constants that may not exist on some systems.
.PP
The names of any symbols that cannot be exported should be listed
in the \f(CW@EXPORT_FAIL\fR array.
.PP
If a module attempts to import any of these symbols the Exporter
will give the module an opportunity to handle the situation before
generating an error. The Exporter will call an export_fail method
with a list of the failed symbols:
.PP
.Vb 1
\&  @failed_symbols = $module_name->export_fail(@failed_symbols);
.Ve
.PP
If the export_fail method returns an empty list then no error is
recorded and all the requested symbols are exported. If the returned
list is not empty then an error is generated for each symbol and the
export fails. The Exporter provides a default export_fail method which
simply returns the list unchanged.
.PP
Uses for the export_fail method include giving better error messages
for some symbols and performing lazy architectural checks (put more
symbols into \f(CW@EXPORT_FAIL\fR by default and then take them out if someone
actually tries to use them and an expensive check shows that they are
usable on that platform).
.Sh "Tag Handling Utility Functions"
.IX Subsection "Tag Handling Utility Functions"
Since the symbols listed within \f(CW%EXPORT_TAGS\fR must also appear in either
\&\f(CW@EXPORT\fR or \f(CW@EXPORT_OK\fR, two utility functions are provided which allow
you to easily add tagged sets of symbols to \f(CW@EXPORT\fR or \f(CW@EXPORT_OK:\fR
.PP
.Vb 1
\&  %EXPORT_TAGS = (foo => [qw(aa bb cc)], bar => [qw(aa cc dd)]);
.Ve
.PP
.Vb 2
\&  Exporter::export_tags('foo');     # add aa, bb and cc to @EXPORT
\&  Exporter::export_ok_tags('bar');  # add aa, cc and dd to @EXPORT_OK
.Ve
.PP
Any names which are not tags are added to \f(CW@EXPORT\fR or \f(CW@EXPORT_OK\fR
unchanged but will trigger a warning (with \f(CW\*(C`\-w\*(C'\fR) to avoid misspelt tags
names being silently added to \f(CW@EXPORT\fR or \f(CW@EXPORT_OK\fR. Future versions
may make this a fatal error.
.Sh "Generating combined tags"
.IX Subsection "Generating combined tags"
If several symbol categories exist in \f(CW%EXPORT_TAGS\fR, it's usually
useful to create the utility \*(L":all\*(R" to simplify \*(L"use\*(R" statements.
.PP
The simplest way to do this is:
.PP
.Vb 1
\&  %EXPORT_TAGS = (foo => [qw(aa bb cc)], bar => [qw(aa cc dd)]);
.Ve
.PP
.Vb 4
\&  # add all the other ":class" tags to the ":all" class,
\&  # deleting duplicates
\&  {
\&    my %seen;
.Ve
.PP
.Vb 3
\&    push @{$EXPORT_TAGS{all}},
\&      grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS;
\&  }
.Ve
.PP
\&\s-1CGI\s0.pm creates an \*(L":all\*(R" tag which contains some (but not really
all) of its categories.  That could be done with one small
change:
.PP
.Vb 4
\&  # add some of the other ":class" tags to the ":all" class,
\&  # deleting duplicates
\&  {
\&    my %seen;
.Ve
.PP
.Vb 4
\&    push @{$EXPORT_TAGS{all}},
\&      grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}}
\&        foreach qw/html2 html3 netscape form cgi internal