File: perl.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (90 lines) | stat: -rw-r--r-- 2,120 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
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
###	SPAR <http://www.cpan.org/scripts/>
###	67	644	1067451878	1217599890	Makeppfile
#
# This file tests the perl(_begin) statement, the sub statement,
# the perl function and perl actions.
#
$(phony all): statements function oneline multiline rule-script.out


perl_begin

*{'f_xyz._'} = sub { "xyz" }

perl_end

perl { sub f_foo { return "foo"; } } # A one-line Perl statement.

sub f_abc { return "abc"; }	# A one-line sub statement.

statements:
	&echo $(xyz.-) $(abc) $(def-.) $(foo) $(bar) -o $@

sub f_jkl			# A multi-line sub statement.
{
  return "jkl";
}

perl {				# A multi-line Perl statement.
  sub f_bar { return "bar"; }
}

sub f_ghi {{			# A double-paren sub statement.
  return 'ghi';
}}

perl				# A double-paren Perl statement.
  {{
    *{"f_def-."} = sub { 'def' };
  }}

perl {
  $Mpp::pid = $$;
  run qw(script.pl statement-script.out b);
}


function:
	&echo $((makeperl scalar reverse( '$(abc):$(xyz.-)' ) )) ${perl f_foo . f_bar} -o $@
	&echo ${perl f_ghi . f_jkl} -o>>$@


oneline:
	makeperl { open my $$f, '>$(output)'; print $$f "single1\n" }
	perl { open my $f, '>>' . f_output; print $f "single2\n" }


multiline:
	makeperl {{
	  open my $$f, '>$(output)'; print $$f "multi1\n";
	}}
	perl {{
	  open my $f, '>>' . f_output; print $f "multi2\n";
	}}

rule-script.out:
	makeperl {{
	  $$Mpp::pid = $$$$;		# How much is that in Euros? :-)
	}}
	&script.pl $(output) d
###	2	755	1067451878	1066077772	script.pl
open my $f, ">>$ARGV[0]" or die "open $ARGV[0]: $!";
print $f "$0: running $ARGV[1] (", $Mpp::pid == $$ ? 'same' : 'different', " pid)\n";
###	D	755	1067451878	1066078592	answers
###	2	644	1067451878	1066078500	answers/function
zyx:cba foobar
ghijkl
###	1	644	1067451878	1190053907	answers/n_files
5 1 0
###	2	644	1067451878	1066078086	answers/multiline
multi1
multi2
###	1	644	1104006511	1209131381	answers/statement-script.out
script.pl: running b (same pid)
###	1	644	1067451878	1209131415	answers/rule-script.out
script.pl: running d (same pid)
###	1	644	1067451878	1066078086	answers/statements
xyz abc def foo bar
###	2	644	1067451878	1066078086	answers/oneline
single1
single2