File: demo.numstr.pl

package info (click to toggle)
libclass-multimethods-perl 1.70-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 156 kB
  • ctags: 93
  • sloc: perl: 855; makefile: 53
file content (27 lines) | stat: -rwxr-xr-x 356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/local/bin/perl -w

use Class::Multimethods;

multimethod mm => ('#') => sub
{
	print "mm(number)\n";
	mm(superclass($_[0]));
};

multimethod mm => ('$') => sub
{
	print "mm(string)\n";
};

sub try
{
	print "$_[0]\n";
	eval $_[0];
	print "---\n";
}

try q{ mm(1) };
try q{ mm("2") };
try q{ mm("three") };
try q{ mm(4 . "") };
try q{ mm("5" + 0) };