develooper Front page | perl.perl5.porters | Postings from April 2000

Creating OO Interface to

Casey R. Tweten
April 26, 2000 21:29
Creating OO Interface to
Message ID:
I have added an OO interface to because, well, I wanted to :-)

I thought I would share this idea with the p5p since you are the listed
maintainers of

I haven't busted old code (as far as I have tested) since the standard
interface exists in full force.

I think (perhaps it's just me) that:

my $sh = new Shell;

is just so much more nice and neat and orderly and namespace conserving
than the standard method of useing

I have attempted to update the 'documentation' so have a look.

Any other thoughts?

    Shell - run shell commands transparently within perl

     use Shell;
     print perl( '-e', 'print "Just another Perl Hacker\n"' );

     use Shell;
     sub cat;
     print cat '< /etc/passwd';

     use Shell;
     my $sh = new Shell;
     print $sh->grep( qw{ wheel /etc/group } );


    Shell can be used in an OO manner or in the standard `AUTOLOAD'ED way,
    see above.


      Date: Thu, 22 Sep 94 16:18:16 -0700
      Message-Id: <>
      From: Larry Wall <>
      Subject: a new module I just wrote

    Here's one that'll whack your mind a little out.


        use Shell;

        $foo = echo("howdy", "<funny>", "world");
        print $foo;

        $passwd = cat("</etc/passwd");
        print $passwd;

        sub ps;
        print ps -ww;

        cp("/etc/passwd", "/tmp/passwd");

    That's maybe too gonzo. It actually exports an AUTOLOAD to the current
    package (and uncovered a bug in Beta 3, by the way). Maybe the usual
    usage should be

        use Shell qw(echo cat ps cp);


    Original: Larry Wall,

    OO Interface, use strict and general clean-up: Casey Tweten

print 'Casey R. Tweten';
my $sig = { mail => '', 
            site => '' };
print "\n" . '.'x(length($sig->{site})) . "\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys %{$sig} Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About