Fry-Shell

 view release on metacpan or  search on metacpan

lib/Fry/Shell.pm  view on Meta::CPAN

variables and what they do (note,variables take a scalar value unless
indicated otherwise):

	defaultlib: default library loaded instead of Fry::Lib::Default
	cmd_class: name of class which inherits loaded libraries
	plugin_config: config plugin 
	plugin_readline: readline plugin
	plugin_dump: dump plugin
	plugin_view: view plugin
	plugin_error: error plugin
	defaultlibs(\@): default libraries to load
	parsecmd: current subroutine for parsing commands
	cmdlist: current subroutine for autocompleting commands
	viewsub: current subroutine for viewing subs, is used when it has a nonzero value 
	fh: current filehandle for output
	view_options(\%): contains options to be passed at
	eval_splitter: used by &parseEval to delimit where normal parsing ends and where eval parsing begins
	field_delimiter: delimits fields used in view subroutines
	fh_file: used with fh_file option to specify filename
	pager: name of preferred pager
	mline_char: regular expression indicating end of a multiline command
	pipe_char: regular expression used to delimit piping between command names on commandline
	prompt: shell prompt
	core_config: name of core config file
	global_config:name of global config file
	lines: used by the menu option
	closefh: used by options to keep track of open filehandles
	quit: flag which indicates to &shell to quit when true
	skipcmd: flag which skips executing a command when true
	autoview: option variable, see section Useful Options
	skiparg: " "
	menu: " "
	method_caller: " "
	multiline: " "
	cmdlist: " "
	page: " "
	loaded_libs(\@): currently loaded libraries

=head2 Error

See L<Fry::Error> for details.

=head1 Miscellaneous

=head2 Creating Shell Components

When considering where and how to create/recreate shell component values, you should know how and in
what order they are loaded. For now, the creation of shell component objects at any of these stages
is ultimately done by &Fry::List::setOrMake.  This method creates an object if it doesn't exist. If
it does exist, it sets the object with its value.  The shell components are loaded in the following
order: config of Fry::Shell library, core config, config of all other libraries, global
config,load_obj option of &new and options setting variable values.

=head2 Useful Options

Fry::Shell comes with a few handy options (defined in &_default_data): 

	parsecmd: sets the current parsing subroutine, handy when needing to pass a command a
		complex data structure and want to use your own parsing syntax
	cmdlist: sets the current subroutine for autocompleting commands
	menu: sets parsecmd to parseMenu thus putting the user in a menu mode
		where each output line is aliased to a number for the following
		command, explained in SYNOPSIS Explained section
	fh_file: sends command's output to specified file name
	page: sends command's output to preferred pager
	autoview: flag which turns on/off autoview and a command's subroutine outputs for itself
	skiparg: flag which turns on/off skipping command argument checking
	multiline: begins multiline mode
	method_caller: Controls class or object that calls a method when calling a command. Value of
		1, calls method with CmdClass. See &Fry::Cmd::runCmd for details.

=head2 Subroutine Hooks

Subroutine hooks allows runtime choosing of which subroutine to call at its location. Every choice
is a Fry::Sub object defined in a library's config. You can choose your subroutine by setting the
variable containg the hook's subroutine id, which is only done for now by its option.

=head3 Parsers

A parser sub hook parses the input after options. It receives the input as a string and returns the
command and its arguments in an array.

	sub parseMyWay {
		my ($o,$input) = @_;
		return (split(/ |/,$input))
	}

Available parse subroutines are parse* methods in Fry::Sub. This hook's variable and option is
parsecmd.

=head3 Command Completion

This sub hook returns the list of commands when autocompleting commands. This hook's variable and
option is cmdlist.

=head3  View Subroutines

This sub hook displays output in &autoView when set to a nonzero value. This hook's variable and
option is viewsub.

=head2 Multiline Mode

To start a multiline session you flip the multiline option (ie '-M').
The multiline mode lasts as long as it doesn't encounter the variable
mline_char, default being ';'. Multiple lines of input are joined by a whitespace.

=head2 Using Autoloaded Libraries

This is a sweeet feature implented via &classAct and &objectAct that allow
you to load a normal module and act on its object and/or class methods.
See L<Fry::Lib::Default> for details.

=head2 Argument Checking

By default, any command with an arg attribute has its arguments checked. See <Fry::Cmd> for details.

=head1 PUBLIC METHODS

Shell scripting methods that are recommended for scripting Fry::Shell while methods that
are encouraged to be subclassed.



( run in 1.813 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )