Gabriel Horner > Fry-Shell-0.15 > Fry::Opt

Download:
Fry-Shell-0.15.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Fry::Opt - Class for shell options.

DESCRIPTION ^

Most option methods are called only when an option is set from the commandline. Such an option is called an active option. Near the end of each loop iteration, options along with other shell components are reset. &resetOptions is then called and depending on an option's attributes is reset.

An option object has the following attributes:

        Attributes with a '*' next to them are always defined.

        *id($): Unique id which is its name.    
        a($): Option alias.
        tags($): Contains a value which modifies an option's behavior. Only defined value is 'counter' which sets 
                an active option's stop value.
        value($): Can contain an option's value. Currently only options' with no type store their value here.
        *type($): Indicates where an option gets/sets its value. Currently can be one of three: flag,var,none. 'none' is the default.
                A flag type syncs it value with a shell flag. A var type syncs its value with a
                variable. A none type gets its value from the attribute value.
        action(\&): Given subroutine is called before a command for an active option.
                Subroutine is passed the shell object and the options' value set from the
                commandline. 
        stop($): Maintains an option's value for $stop + 1 loop iterations where $stop
                is this attribute's value. This gives an active option a timed noreset interval. Used mostly with menu option.
        noreset($): If set, the active option can't be reset (except for an overriding flag to &resetOptions).
        *default($): Default value that an option starts with and is set to whenever reset. Default value is 0.

PUBLIC METHODS ^

        Opt($opt): Returns an option's value.
        findSetOptions(): Returns hash of options that differ from their default
                values. Used when displaying the prompt.
        resetOptions(): Iterates through all options and resets them according to attributes.
        setOptions(%opt_to_value): Sets options to their values.  
        preParseCmd(%opt_to_value): Called before command execution with active
                options and their values to do various things depending on an option's
                attributes.

AUTHOR ^

Me. Gabriel that is. I welcome feedback and bug reports to cldwalker AT chwhat DOT com . If you like using perl,linux,vim and databases to make your life easier (not lazier ;) check out my website at www.chwhat.com.

COPYRIGHT & LICENSE ^

Copyright (c) 2004, Gabriel Horner. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: