- CREATECONFIGOPTIONS'S API METHODS
- COPYRIGHT AND LICENSE
App::Fetchware::CreateConfigOptions - Used by fetchware extensions to create their configuration options.
use App::Fetchware::ExportAPI KEEP => [qw(start end)], OVERRIDE => [qw(lookup download verify unarchive build install uninstall)];
App::Fetchware::ExportAPI is a utility helper class for fetchware extensions. It makes it easy to ensure that your fetchware extension implements or imports all of App::Fetchware's required API subroutines.
See section "CREATING A FETCHWARE EXTENSION" in App::Fetchware in App::Fetchware's documentation for more information on how to create your very own fetchware extension.
App::Fetchware::CreateConfigOptions (CreateConfigOptions) has only one user-servicable part--it's import() method. It works just like Exporter's import() method except it takes arguments differently, and checks it's arguments more thuroughly.
# import() *must* be called in a BEGIN block, because it # creates subroutines that have prototypes, and prototypes *must* be known # about at compile time not run time! use App::Fetchware::CreateConfigOptions ONE => [qw( page_name html_page_url user_agent html_treebuilder_callback download_links_callback )], BOOLEAN => [qw( keep_destination_directory )], IMPORT => [qw( temp_dir )], ;
Creates configuration options of the same types App::Fetchware uses. These are:
- 1. ONE - Stores one and only ever one value. If the configuration option is used more than once, an exception is thrown.
- 2. ONEARRREF - Stores one or more values. But only stores a list when provided a list when you call it such as
install_commands './configure', 'make', 'make install'would create a configuration option with three values. However, if a ONEARRREF is called more than once, and exception is also thrown.
- 3. MANY - Stores many values one at a time just like ONEARRREF, but can also be called any number of times, and values are appended to any already existing ones.
- 4. BOOLEAN - Stores true or false values such as
In addition to App::Fetchware's types, import() features an additional type:
- 5. IMPORT - the
IMPORTthis hash key does not create new configuration options, but instead imports already defined ones from App::Fetchware allowing you to reuse popular configuration options like
no_installin your fetchware extension.ou can specify the
import(..., NOIMPORT => 1);, to avoid the automatic importing of App::Fetchware configuration options.
Just use any of
BOOLEAN as faux hash keys being sure to wrap their arguments in a array reference brackets
import() creates subroutines that have prototypes, but in order for perl to honor those prototypes perl must know about them at compile-time; therefore, that is why import() must be called inside a
As with the rest of App::Fetchware, App::Fetchware::ExportAPI does not return ny error codes; instead, all errors are die()'d if it's Test::Fetchware's error, or croak()'d if its the caller's fault.
David Yingling <firstname.lastname@example.org>
This software is copyright (c) 2013 by David Yingling.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.