File: perl-module.at

package info (click to toggle)
pspp 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,676 kB
  • sloc: ansic: 267,210; xml: 18,446; sh: 5,534; python: 2,881; makefile: 125; perl: 64
file content (724 lines) | stat: -rw-r--r-- 18,567 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017, 2020, 2021 Free Software Foundation, Inc.
dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
dnl
AT_BANNER([Perl module tests])

m4_divert_push([PREPARE_TESTS])
# Find the Address Sanitizer library that PSPP is linked against, if any.
# If it exists, it needs to be preloaded when we run Perl.
asan_lib=$("$abs_top_builddir/libtool" --mode=execute ldd \
               "$abs_top_builddir/src/ui/terminal/pspp" 2>/dev/null \
	   | grep asan \
	   | awk '{print $3}')
if test -e "$asan_lib"; then
    USING_ASAN=:
else
    USING_ASAN=false
    asan_lib=
fi

dnl This command can be used to run with the PSPP Perl module after it has been
dnl built (with "make") but before it has been installed.  The -I options are
dnl equivalent to "use ExtUtils::testlib;" inside the Perl program, but it does
dnl not need to be run with the perl-module build directory as the current
dnl working directory.
run_perl_module () {
    LD_PRELOAD="$asan_lib":"$LD_PRELOAD" \
    LD_LIBRARY_PATH="$abs_top_builddir/src/.libs" \
    DYLD_LIBRARY_PATH="$abs_top_builddir/src/.libs" \
    ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=false" \
    $PERL -I"$abs_top_builddir/perl-module/blib/arch" \
          -I"$abs_top_builddir/perl-module/blib/lib" "$@"
}
m4_divert_pop([PREPARE_TESTS])

AT_SETUP([Perl create system file])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([test.pl],
  [use warnings;
   use strict;
   use PSPP;

   my $d = PSPP::Dict->new();
   die "dictionary creation" if !ref $d;
   die if $d->get_var_cnt () != 0;

   $d->set_label ("My Dictionary");
   $d->set_documents ("These Documents");

   # Tests for variable creation

   my $var0 = PSPP::Var->new ($d, "le");
   die "trap illegal variable name" if ref $var0;
   die if $d->get_var_cnt () != 0;

   $var0 = PSPP::Var->new ($d, "legal");
   die "accept legal variable name" if !ref $var0;
   die if $d->get_var_cnt () != 1;

   my $var1 = PSPP::Var->new ($d, "money",
			      (fmt=>PSPP::Fmt::DOLLAR,
			       width=>4, decimals=>2) );
   die "cappet valid format" if !ref $var1;
   die if $d->get_var_cnt () != 2;

   $d->set_weight ($var1);

   my $sysfile = PSPP::Sysfile->new ('testfile.sav', $d);
   die "create sysfile object" if !ref $sysfile;

   $sysfile->close ();
])
AT_CHECK([run_perl_module test.pl])
AT_DATA([dump-dict.sps],
  [GET FILE='testfile.sav'.
DISPLAY FILE LABEL.
DISPLAY DOCUMENTS.
DISPLAY DICTIONARY.
SHOW WEIGHT.
])
AT_CHECK([pspp -O format=csv dump-dict.sps], [0], [dnl
Table: File Label
Label,My Dictionary

Table: Documents
These Documents

Table: Variables
Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
legal,1,Scale,Input,8,Right,F9.2,F9.2
money,2,Scale,Input,8,Right,DOLLAR6.2,DOLLAR6.2

Table: Settings
WEIGHT,money
])
AT_CLEANUP

AT_SETUP([Perl writing cases to system files])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $d = PSPP::Dict->new();
    PSPP::Var->new ($d, "id",
		    (
		     fmt=>PSPP::Fmt::F,
		     width=>2,
		     decimals=>0
		     )
		    );

    PSPP::Var->new ($d, "name",
			   (
			    fmt=>PSPP::Fmt::A,
			    width=>20,
			    )
			   );

    $d->set_documents ("This should not appear");
    $d->clear_documents ();
    $d->add_document ("This is a document line");

    $d->set_label ("This is the file label");

    # Check that we can write cases to system files.
    my $sysfile = PSPP::Sysfile->new ("testfile.sav", $d);
    my $res = $sysfile->append_case ( [34, "frederick"]);
    die "append case" if !$res;

    $res = $sysfile->append_case ( [34, "frederick", "extra"]);
    die "append case with too many variables" if $res;
    $sysfile->close ();

    # Check that sysfiles are closed properly automaticallly in the destructor.
    my $sysfile2 = PSPP::Sysfile->new ("testfile2.sav", $d);
    $res = $sysfile2->append_case ( [21, "wheelbarrow"]);
    die "append case 2" if !$res;

    $res = $sysfile->append_case ( [34, "frederick", "extra"]);
    die "append case with too many variables" if $res;

    # Don't close.  We want to test that the destructor does that.
]])
AT_CHECK([run_perl_module test.pl])
AT_DATA([dump-dicts.sps],
  [GET FILE='testfile.sav'.
DISPLAY DICTIONARY.
DISPLAY FILE LABEL.
DISPLAY DOCUMENTS.
LIST.

GET FILE='testfile2.sav'.
DISPLAY DICTIONARY.
DISPLAY FILE LABEL.
DISPLAY DOCUMENTS.
LIST.
])
AT_CHECK([pspp -O format=csv dump-dicts.sps], [0], [dnl
Table: Variables
Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
id,1,Scale,Input,8,Right,F2.0,F2.0
name,2,Nominal,Input,20,Left,A20,A20

Table: File Label
Label,This is the file label

Table: Documents
This is a document line

Table: Data List
id,name
34,frederick

Table: Variables
Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
id,1,Scale,Input,8,Right,F2.0,F2.0
name,2,Nominal,Input,20,Left,A20,A20

Table: File Label
Label,This is the file label

Table: Documents
This is a document line

Table: Data List
id,name
21,wheelbarrow
])
AT_CLEANUP

AT_SETUP([Perl write variable parameters])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $dict = PSPP::Dict->new();
    die "dictionary creation" if !ref $dict;

    my $int = PSPP::Var->new ($dict, "integer",
			      (width=>8, decimals=>0) );

    $int->set_label ("My Integer");

    $int->add_value_label (99, "Silly");
    $int->clear_value_labels ();
    $int->add_value_label (0, "Zero");
    $int->add_value_label (1, "Unity");
    $int->add_value_label (2, "Duality");

    my $str = PSPP::Var->new ($dict, "string",
			      (fmt=>PSPP::Fmt::A, width=>8) );


    $str->set_label ("My String");
    $str->add_value_label ("xx", "foo");
    $str->add_value_label ("yy", "bar");

    $str->set_missing_values ("this", "that");

    my $longstr = PSPP::Var->new ($dict, "longstring",
			      (fmt=>PSPP::Fmt::A, width=>9) );


    $longstr->set_label ("My Long String");
    my $re = $longstr->add_value_label ("xxx", "xfoo");

    $int->set_missing_values (9, 99);

    my $sysfile = PSPP::Sysfile->new ("testfile.sav", $dict);


    $sysfile->close ();
]])
AT_CHECK([run_perl_module test.pl], [0], [], [stderr])
cat stderr
AT_DATA([dump-dict.sps],
  [GET FILE='testfile.sav'.
DISPLAY DICTIONARY.
])
AT_CHECK([pspp -O format=csv dump-dict.sps], [0], [dnl
Table: Variables
Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
integer,1,My Integer,Scale,Input,8,Right,F8.0,F8.0,9; 99
string,2,My String,Nominal,Input,8,Left,A8,A8,"""this    ""; ""that    """
longstring,3,My Long String,Nominal,Input,9,Left,A9,A9,

Table: Value Labels
Variable Value,,Label
My Integer,0,Zero
,1,Unity
,2,Duality
My String,xx,foo
,yy,bar
My Long String,xxx,xfoo
])
AT_CLEANUP

AT_SETUP([Perl dictionary survives system file])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([test.pl],
  [[use warnings;
use strict;
use PSPP;

my $sysfile ;

    {
	my $d = PSPP::Dict->new();

	PSPP::Var->new ($d, "id",
			(
			 fmt=>PSPP::Fmt::F,
			 width=>2,
			 decimals=>0
			 )
			);

	$sysfile = PSPP::Sysfile->new ("testfile.sav", $d);
    }

    my $res = $sysfile->append_case ([3]);
    print "Dictionary survives sysfile\n" if $res;
]])
AT_CHECK([run_perl_module test.pl], [0],
  [Dictionary survives sysfile
])
AT_CLEANUP

m4_define([PERL_GENERATE_SYSFILE],
  [AT_DATA([sample.sps],
    [[data list notable list /string (a8) longstring (a12) numeric (f10) date (date11) dollar (dollar8.2) datetime (datetime17)
begin data.
1111 One   1 1/1/1 1   1/1/1+01:01
2222 Two   2 2/2/2 2   2/2/2+02:02
3333 Three 3 3/3/3 3   3/3/3+03:03
.    .     . .     .   .
5555 Five  5 5/5/5 5   5/5/5+05:05
end data.


variable labels string 'A Short String Variable'
  /longstring 'A Long String Variable'
  /numeric 'A Numeric Variable'
  /date 'A Date Variable'
  /dollar 'A Dollar Variable'
  /datetime 'A Datetime Variable'.


missing values numeric (9, 5, 999).

missing values string ("3333").

add value labels
  /string '1111' 'ones' '2222' 'twos' '3333' 'threes'
  /numeric 1 'Unity' 2 'Duality' 3 'Thripality'.

variable attribute
    variables = numeric
    attribute=colour[1]('blue') colour[2]('pink') colour[3]('violet')
    attribute=size('large') nationality('foreign').


save outfile='sample.sav'.
]])
   AT_CHECK([pspp -O format=csv sample.sps])])

AT_SETUP([Perl read system file])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
PERL_GENERATE_SYSFILE
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $sf = PSPP::Reader->open ("sample.sav");

    my $dict = $sf->get_dict ();

    for (my $v = 0 ; $v < $dict->get_var_cnt() ; $v++)
    {
       my $var = $dict->get_var ($v);
       my $name = $var->get_name ();
       my $label = $var->get_label ();

       print "Variable $v is \"$name\", label is \"$label\"\n";

       my $vl = $var->get_value_labels ();

       print "Value Labels:\n";
       print "$_ => $vl->{$_}\n" for sort (keys %$vl);
    }

    while (my @c = $sf->get_next_case () )
    {
       for (my $v = 0; $v < $dict->get_var_cnt(); $v++)
       {
	   print "val$v: \"$c[$v]\"\n";
       }
       print "\n";
    }
]])
AT_CHECK([run_perl_module test.pl], [0],
  [Variable 0 is "string", label is "A Short String Variable"
Value Labels:
1111     => ones
2222     => twos
3333     => threes
Variable 1 is "longstring", label is "A Long String Variable"
Value Labels:
Variable 2 is "numeric", label is "A Numeric Variable"
Value Labels:
1 => Unity
2 => Duality
3 => Thripality
Variable 3 is "date", label is "A Date Variable"
Value Labels:
Variable 4 is "dollar", label is "A Dollar Variable"
Value Labels:
Variable 5 is "datetime", label is "A Datetime Variable"
Value Labels:
val0: "1111    "
val1: "One         "
val2: "1"
val3: "13197686400"
val4: "1"
val5: "13197690060"

val0: "2222    "
val1: "Two         "
val2: "2"
val3: "13231987200"
val4: "2"
val5: "13231994520"

val0: "3333    "
val1: "Three       "
val2: "3"
val3: "13266028800"
val4: "3"
val5: "13266039780"

val0: ".       "
val1: ".           "
val2: ""
val3: ""
val4: ""
val5: ""

val0: "5555    "
val1: "Five        "
val2: "5"
val3: "13334630400"
val4: "5"
val5: "13334648700"

])
AT_CLEANUP

AT_SETUP([Perl copying system files])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
PERL_GENERATE_SYSFILE
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $input = PSPP::Reader->open ("sample.sav");

    my $dict = $input->get_dict ();

    my $output = PSPP::Sysfile->new ("copy.sav", $dict);

    while (my (@c) = $input->get_next_case () )
    {
      $output->append_case (\@c);
    }

    $output->close ();
]])
AT_CHECK([run_perl_module test.pl])
AT_DATA([dump-dicts.sps],
  [GET FILE='sample.sav'.
DISPLAY DICTIONARY.
DISPLAY ATTRIBUTES
LIST.

GET FILE='copy.sav'.
DISPLAY DICTIONARY.
DISPLAY ATTRIBUTES
LIST.
])
AT_CHECK([pspp -O format=csv dump-dicts.sps], [0],
  [[Table: Variables
Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
string,1,A Short String Variable,Nominal,Input,8,Left,A8,A8,"""3333    """
longstring,2,A Long String Variable,Nominal,Input,12,Left,A12,A12,
numeric,3,A Numeric Variable,Nominal,Input,8,Right,F10.0,F10.0,9; 5; 999
date,4,A Date Variable,Scale,Input,8,Right,DATE11,DATE11,
dollar,5,A Dollar Variable,Scale,Input,8,Right,DOLLAR11.2,DOLLAR11.2,
datetime,6,A Datetime Variable,Scale,Input,8,Right,DATETIME17.0,DATETIME17.0,

Table: Value Labels
Variable Value,,Label
A Short String Variable,1111,ones
,2222,twos
,3333[a],threes
A Numeric Variable,1,Unity
,2,Duality
,3,Thripality
Footnote: a. User-missing value

Table: Variable and Dataset Attributes
Variable and Name,,Value
A Numeric Variable,colour[1],blue
,colour[2],pink
,colour[3],violet
,nationality,foreign
,size,large

Table: Data List
string,longstring,numeric,date,dollar,datetime
1111,One,1,01-JAN-2001,$1.00,01-JAN-2001 01:01
2222,Two,2,02-FEB-2002,$2.00,02-FEB-2002 02:02
3333,Three,3,03-MAR-2003,$3.00,03-MAR-2003 03:03
.,.,.,.,.  ,.
5555,Five,5,05-MAY-2005,$5.00,05-MAY-2005 05:05

Table: Variables
Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
string,1,A Short String Variable,Nominal,Input,8,Left,A8,A8,"""3333    """
longstring,2,A Long String Variable,Nominal,Input,12,Left,A12,A12,
numeric,3,A Numeric Variable,Nominal,Input,8,Right,F10.0,F10.0,9; 5; 999
date,4,A Date Variable,Scale,Input,8,Right,DATE11,DATE11,
dollar,5,A Dollar Variable,Scale,Input,8,Right,DOLLAR11.2,DOLLAR11.2,
datetime,6,A Datetime Variable,Scale,Input,8,Right,DATETIME17.0,DATETIME17.0,

Table: Value Labels
Variable Value,,Label
A Short String Variable,1111,ones
,2222,twos
,3333[a],threes
A Numeric Variable,1,Unity
,2,Duality
,3,Thripality
Footnote: a. User-missing value

Table: Variable and Dataset Attributes
Variable and Name,,Value
A Numeric Variable,colour[1],blue
,colour[2],pink
,colour[3],violet
,nationality,foreign
,size,large

Table: Data List
string,longstring,numeric,date,dollar,datetime
1111,One,1,01-JAN-2001,$1.00,01-JAN-2001 01:01
2222,Two,2,02-FEB-2002,$2.00,02-FEB-2002 02:02
3333,Three,3,03-MAR-2003,$3.00,03-MAR-2003 03:03
.,.,.,.,.  ,.
5555,Five,5,05-MAY-2005,$5.00,05-MAY-2005 05:05
]])
AT_CLEANUP

AT_SETUP([Perl value formatting])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([dd.sps],
  [DATA LIST LIST /d (DATETIME17).
BEGIN DATA.
11/9/2001+08:20
END DATA.

SAVE OUTFILE='dd.sav'.
])
AT_CHECK([pspp -O format=csv dd.sps], [0],
  [Table: Reading free-form data from INLINE.
Variable,Format
d,DATETIME17.0
])
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $sf = PSPP::Reader->open ("dd.sav");

    my $dict = $sf->get_dict ();

    my (@c) = $sf->get_next_case ();

    my $var = $dict->get_var (0);
    my $val = $c[0];
    my $formatted = PSPP::format_value ($val, $var);
    my $str = gmtime ($val - PSPP::PERL_EPOCH);
    print "Formatted string is \"$formatted\"\n";
    print "Perl representation is \"$str\"\n";
]])
AT_CHECK([run_perl_module test.pl], [0],
  [[Formatted string is "11-SEP-2001 08:20"
Perl representation is "Tue Sep 11 08:20:00 2001"
]])
AT_CLEANUP

AT_SETUP([Perl opening nonexistent file])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $sf = PSPP::Reader->open ("no-such-file.sav");

    die "Returns undef on opening failure" if ref $sf;
    print $PSPP::errstr, "\n";
]])
AT_CHECK([run_perl_module test.pl], [0],
  [[An error occurred while opening `no-such-file.sav': No such file or directory.
]],
  [[Name "PSPP::errstr" used only once: possible typo at test.pl line 8.
]])
AT_CLEANUP

AT_SETUP([Perl missing values])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
PERL_GENERATE_SYSFILE
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $sf = PSPP::Reader->open ("sample.sav");

    my $dict = $sf->get_dict ();

    my (@c) = $sf->get_next_case ();

    my $stringvar = $dict->get_var (0);
    my $numericvar = $dict->get_var (2);
    my $val = $c[0];

    die "Missing Value Negative String"
        if PSPP::value_is_missing ($val, $stringvar);

    $val = $c[2];

    die "Missing Value Negative Num"
        if PSPP::value_is_missing ($val, $numericvar);

    @c = $sf->get_next_case ();
    @c = $sf->get_next_case ();

    $val = $c[0];
    die "Missing Value Positive"
        if !PSPP::value_is_missing ($val, $stringvar);

    @c = $sf->get_next_case ();
    $val = $c[2];
    die "Missing Value Positive SYS"
        if !PSPP::value_is_missing ($val, $numericvar);

    @c = $sf->get_next_case ();
    $val = $c[2];
    die "Missing Value Positive Num"
        if !PSPP::value_is_missing ($val, $numericvar);
]])
AT_CHECK([run_perl_module test.pl])
AT_CLEANUP

AT_SETUP([Perl custom attributes])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
PERL_GENERATE_SYSFILE
AT_DATA([test.pl],
  [[use warnings;
    use strict;
    use PSPP;

    my $sf = PSPP::Reader->open ("sample.sav");

    my $dict = $sf->get_dict ();

    my $var = $dict->get_var_by_name ("numeric");

    my $attr = $var->get_attributes ();

    foreach my $k (sort (keys (%$attr)))
    {
	my $ll = $attr->{$k};
	print "$k =>";
	print map "$_\n", join ', ', @$ll;
    }
]])
AT_CHECK([run_perl_module test.pl], [0],
  [[$@Role =>0
colour =>blue, pink, violet
nationality =>foreign
size =>large
]])
AT_CLEANUP

AT_SETUP([Perl Pspp.t])
AT_KEYWORDS([slow])
AT_SKIP_IF([test "$WITH_PERL_MODULE" = no])
# Skip this test if Perl's Text::Diff module is not installed.
AT_CHECK([perl -MText::Diff -e '' || exit 77])
# Skip this test if Perl's Test::More module is not installed.
AT_CHECK([perl -MTest::More -e '' || exit 77])
AT_CHECK([run_perl_module "$abs_top_builddir/perl-module/t/Pspp.t"], [0],
  [[1..37
ok 1 - use PSPP;
ok 2 - Dictionary Creation
ok 3
ok 4 - Trap illegal variable name
ok 5
ok 6 - Accept legal variable name
ok 7
ok 8 - Trap duplicate variable name
ok 9
ok 10 - Accept valid format
ok 11
ok 12 - Create sysfile object
ok 13 - Write system file
ok 14 - Append Case
ok 15 - Appending Case with too many variables
ok 16 - existance
ok 17 - Append Case 2
ok 18 - existance2
ok 19 - Check output
ok 20 - Dictionary Creation 2
ok 21 - Value label for short string
ok 22 - Value label for long string
ok 23 - Check output 2
ok 24 - Dictionary survives sysfile
ok 25 - Basic reader operation
ok 26 - Streaming of files
Formatted string is "11-SEP-2001 08:20"
ok 27 - format_value function
ok 28 - Perl representation of time
ok 29 - Returns undef on opening failure
ok 30 - Error string on open failure
ok 31 - Missing Value Negative String
ok 32 - Missing Value Negative Num
ok 33 - Missing Value Positive
ok 34 - Missing Value Positive SYS
ok 35 - Missing Value Positive Num
ok 36 - Custom Attributes
ok 37 - Case count
]],[ignore])
AT_CLEANUP