File: demo.numstr.pl

package info (click to toggle)
libclass-multimethods-perl 1.70-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 180 kB
  • ctags: 89
  • sloc: perl: 855; makefile: 37
file content (27 lines) | stat: -rwxr-xr-x 349 bytes parent folder | download | duplicates (2)
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/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) };