1 #!/usr/local/bin/perl -s
12 #my @sort_styles = qw( plain ) ;
13 my @sort_styles = qw( plain orcish ST GRT ) ;
15 # These are some months to be sorted numerically.
31 # a jumbled array of months to be sorted
33 my @month_jumble = qw(February June October March January
34 April July November August December May September);
37 @month_to_num{ @months } = 1 .. @months ;
39 # These are some months to be sorted alphabetically
40 # (order determined by letters).
43 @month_to_let{ @months } = 'A' .. 'L' ;
49 name => 'closure error',
50 gold => sub { $month_to_num{$a} <=> $month_to_num{$b} },
51 error => qr/Global symbol "%month_to_num"/,
54 number => sub { $month_to_num{$_} },
62 name => 'closure numeric',
63 data => \@month_jumble,
64 gold => sub { $month_to_num{$a} <=> $month_to_num{$b} },
68 number => sub { $month_to_num{$_} },
76 name => 'closure string',
77 data => \@month_jumble,
78 gold => sub { $month_to_let{$a} cmp $month_to_let{$b} },
82 string => sub { $month_to_let{$_} },
89 name => 'double closure',
91 [ qw( November March ) ],
92 [ qw( January March ) ],
94 [ qw( January January ) ],
97 $month_to_let{$a->[0]} cmp $month_to_let{$b->[0]}
99 $month_to_num{$a->[1]} <=> $month_to_num{$b->[1]}
104 string => sub { $month_to_let{$_->[0]} },
105 number => sub { $month_to_num{$_->[1]} },
111 common_driver( $sort_tests, \@sort_styles ) ;