
japhy
Enthusiast
/ Moderator
Jan 17, 2001, 1:04 PM
Post #2 of 2
(473 views)
|
You are talking about subroutines. Just create a file with all the "aliases" you want, and incorporate that into all the programs you want them in.
# aliases.pm package aliases; use strict; my @export = qw( fopen cls ); sub import { shift; my $pkg = caller; no 'strict'; *{"${pkg}::$_"} = \&$_ for @_ ? @_ : @export; } sub fopen { my $file = shift; local *FH; open FH, $file or die "can't open $file: $!"; return \*FH; } { my $cls = `clear`; sub cls { print $cls } } 1; This module would be used like so:
use aliases; # imports fopen() and cls() use aliases qw( cls ); # imports ONLY cls() Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
|