File: demo.numstr.pl

package info (click to toggle)
libclass-multimethods-perl 1.701-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 240 kB
  • sloc: perl: 1,517; makefile: 7
file content (27 lines) | stat: -rwxr-xr-x 353 bytes parent folder | download | duplicates (3)
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/env 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) };