home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- require 'stack.pl';
-
- # create two instances of class 'stack'
- $s1 = &newobject('stack');
- $s2 = &newobject('stack');
-
- # push items onto stack $s1
- &send($s1, 'push', 10);
- &send($s1, 'push', 20);
- &send($s1, 'push', 30);
-
- print "top of stack 1=" . &send($s1, 'top') . "\n";
- print "--- dump of stack 1 ---\n";
- &send($s1, 'dump');
-
- &send($s2, 'push', 'Hello, world.');
- print "top of stack 2=" . &send($s2, 'top') . "\n";
-
- print "--- show me ---\n";
- &send($s1, 'show_self');
- print "--- show me ---\n";
- &send($s2, 'show_self');
-
- &send($s1, 'pop');
- print "top of stack 1=" . &send($s1, 'top') . "\n";
-
- &send($s1, 'pop');
- print "top of stack 1=" . &send($s1, 'top') . "\n";
-
- &send($s1, 'pop');
- print "top of stack 1=" . &send($s1, 'top') . "\n";
-