View on
Gabriel Horner > Fry-Shell-0.15 > Fry::Sub



Annotate this POD


New  1
Open  0
View/Report Bugs


Fry::Sub - Class for shell subroutines


This class mainly provides a means to pick and choose among a group of subroutines that have the same functionality via &subHook. It is also serving as a storage class for practical subroutines to be reused by any library.


        Subroutine Methods
                call($a_sub,@args): Calls given subroutine id or alias with its arguments.
                subHook(%args): Creates a subroutine hook.
                        Has the following keys:
                        var: Variable containing current id of a subroutine object.
                        default: Default subroutine id to call if var is set to an invalid subroutine object.
                        args: Optional,argument passed to subroutine.
        Practical Subroutines
                chooseItems(@choices): Presents the given choices in a menu format, waits for input
                        to choose items and returns chosen items. The input is parsed by parseNum,
                        see it for input format.
                spliceArray($arrayref,$value): Deletes value from given arrayref.
                useThere($package,$useclass): The $useclass is used in the given $package.
        Parse Subroutines
                parseChunks($input): Splits input line with pipes into separate commands.
                parseMultiline(\$input): Parses multiline input.
                parseOptions(\$input): Parses options from input.
                parseNormal($input): Default parser for command section of input, splitting commands
                        and arguments by whitespace.
                parseEval($input): Parser that parses part of the line with &parseNormal and evals the
                        rest. The variable eval_splitter determines the splitting point. This
                        parser is used often with the &objectAct command:

                        -p=e objectAct selectall_arrayref,,'select * from pmodule'

                parseMenu($input): Parser used by menu option. Substitutes a number format with values.
                        The number format is a comma separated list of values. A range of values
                        can be specified with a '-' between numbers. Valid number formats are
                        1-5,8,12 and 1,8,4 .
                parseNum($entry,@args): Used by parseMenu to substitute numbers. Same format as
                        parseMenu but only accepting one entry.
        CmdList Subroutines
                cmd_normal(): lists all object ids from command class
                cmd_alias(): lists all object ids and aliases from command class
                empty(): empty subroutine, usually serves as a default subroutine for subroutine hooks


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


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: