$world->alias
$world->alias function: creates an ALIAS
void $world->alias( |
pattern
, |
substitution
, | |
[attributes ]
) ; |
void $world->alias( |
number
, |
[pattern
, | |
[substitution ]]
, | |
[attributes ]
) ; |
Creates a new alias, or edits the alias identified by number.
Entered commands will be matched against pattern (a Perl regular
expression), and if the pattern matches, the given substitution will
be applied. (In a s/pattern/substitution/
structure.)
Be careful that any part of the command can match. To match only
the exact string, use something like '^command$'
.
To match only in the beginning of the line, use
'^command'
.
Atributes is a reference to a hash defining attributes for the alias. Generally the call works like this:
$world->alias("pattern", "substitution", { attribute1 => value1, attribute2 => value2, ... })
Possible attributes:
pattern
: The pattern to
match.
substitution
: The substitution to
do.
ignorecase
: If value evaluates to
true, ignore case when matching the pattern.
perleval
: If true, the
substitution is made passing the "e" flag
(s/pattern/substitution/e
), so substitution
should be actually Perl statements to be evaluated when there is a
match.
enabled
: If value evaluates to
true, the alias is enabled, if false, it is disabled and commands
are not matched against it.
name
: Assigns a name to the
alias, so that it can be referenced by name.