The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

###############################################################################
###  string tests
###############################################################################

### default method
string		value;

### append method
string->append	_ext;

### equals method
%if ( string value_ext )
string		2value;
%endif

### match method
%if ( string->match "^2val" )
string		3value;
%endif

### test quoted string parsing
quoted_string	"quoted value";
quoted_string	"quoted
	string
on
		multiple
	lines

";
special_str	"quoted with \"special\" characters";
empty_string	"";

### gsub method
gsub_string	"foo bar baz bar quux";
gsub_string->gsub("bar", "WHEE");

### string with no value
no_value;
no_value->set;

### absolute path object
path		"/usr/local/bin";


###############################################################################
###  integer tests
###############################################################################

### default method
integer		0;
integer		"-1";
integer		55;

### test math functions
integer		5;
integer->add	1;	### 5 + 1 = 6
integer->sub	2;	### 6 - 2 = 4
integer->mult	10;	### 4 * 10 = 40
integer->div	5;	### 40 / 5 = 8

### conditional tests
%if ( integer->lt 10 )
integer->incr;		### 8++ = 9
%endif


###############################################################################
###  boolean tests
###############################################################################

### boolean value
boolean		true;
boolean		no;

### conditional tests
%if ( boolean )
integer		5;
%elif ( string foo )
integer		10;
%else
integer->decr;		### 9-- = 8
%endif

### this should default to true
bool_no_arg;


###############################################################################
###  list tests
###############################################################################

### default method
list			[ this, is, a, very, cool, list ];

### delete method
list->delete		a;
list->delete		[ very, list ];

### empty list parsing
build_list		[ ];

### add method
build_list->add		bar;
build_list->add		[ baz, quux ];

### add_top method
build_list->add_top	foo;

### add complex data to lists
complex_list		[ "quoted string", 0 ];
complex_list->add	[
				foo,
				[ random, sublist ],
				{ sub => hash }
			];


###############################################################################
###  hash tests
###############################################################################

### default method
hash		{
			key1	=> val1,
			key2	=> val2,
			key3	=> val3
		};
hash		{
			foo	=> 0,
			bar	=> 1,
			baz	=> 2
		};

### delete method
hash->delete	key1;
hash->delete	[ key3, key2 ];

### conditional tests
%if ( string 3value && ( integer 10 || bool_no_arg ) )
hash->delete	foo;
%else
hash->delete	bar;
%endif

### optional values - can be used to store a unique but unordered list
hash_opt_vals	{ larry, moe, curly };
hash_opt_vals	{ key => with_val_in_same_hash };

### complex hash data
hash		{
			list	=> [ this, is, a, list ],
			hash	=> { key => val }
		};
hash		{
			list	=> [ add, list, values ],
			hash	=> { key2 => val2 }
		};

### empty hash
empty_hash	{ };

### hash of lists
hash_ol		{
			key1	=> [ value, must, be, a, list ],
			key2	=> [ more, list, data ]
		};

### hash of hashes
hash_ul		{
			key1	=> { hash, data },
			key2	=> { more, hash, data }
		};


###############################################################################
###  table tests
###############################################################################

### default method
table		[
			[ row, 1, foo ],
			[ row, 2, bar ],
			[ row, 3, baz ]
		];

### insert_row method
table->insert_row( { 2 => bar }, [ row, "1.5", quux ] );

### replace_row_cells method
table->replace_row_cells( { 2 => bar }, { 0 => UNrow } );

### append_to_row_cells method
table->append_to_row_cells( { 2 => bar }, { 0 => again } );


###############################################################################
###  conditional tests
###############################################################################

i1		1;
i2		2;

%if ( i1 10 )
i1		20;
% if ( i2 2 )
i2->incr;
% endif
%endif