1 pp.c TODO 2 3 Invalid type in unpack: '%c 4 my $A = pack ("A,A", 1,2) ; 5 my @A = unpack ("A,A", "22") ; 6 7 Attempt to pack pointer to temporary value 8 pack("p", "abc") ; 9 10__END__ 11# pp_pack.c 12use warnings 'pack' ; 13use warnings 'unpack' ; 14my @a = unpack ("A,A", "22") ; 15my $a = pack ("A,A", 1,2) ; 16no warnings 'pack' ; 17no warnings 'unpack' ; 18my @b = unpack ("A,A", "22") ; 19my $b = pack ("A,A", 1,2) ; 20EXPECT 21Invalid type ',' in unpack at - line 4. 22Invalid type ',' in pack at - line 5. 23######## 24# pp_pack.c 25use warnings 'pack' ; 26sub foo { my $a = "a"; return $a . $a++ . $a++ } 27my $a = pack("p", &foo) ; 28@a = "foo"; 29sub bar { pop @{\@_}, pack "p", $a[0] } # This should *not* warn, even 30bar(@a); # though $a[0] is SvTEMP. 31no warnings 'pack' ; 32my $b = pack("p", &foo) ; 33EXPECT 34Attempt to pack pointer to temporary value at - line 4. 35######## 36# pp_pack.c 37use warnings 'pack' ; 38print unpack("C", pack("C", -1)), "\n", 39 unpack("C", pack("C", 0)), "\n", 40 unpack("C", pack("C", 255)), "\n", 41 unpack("C", pack("C", 256)), "\n", 42 unpack("c", pack("c", -129)), "\n", 43 unpack("c", pack("c", -128)), "\n", 44 unpack("c", pack("c", 127)), "\n", 45 unpack("c", pack("c", 128)), "\n"; 46no warnings 'pack' ; 47print unpack("C", pack("C", -1)), "\n"; 48print unpack("C", pack("C", 0)), "\n"; 49print unpack("C", pack("C", 255)), "\n"; 50print unpack("C", pack("C", 256)), "\n"; 51print unpack("c", pack("c", -129)), "\n"; 52print unpack("c", pack("c", -128)), "\n"; 53print unpack("c", pack("c", 127)), "\n"; 54print unpack("c", pack("c", 128)), "\n"; 55EXPECT 56Character in 'C' format wrapped in pack at - line 3. 57Character in 'C' format wrapped in pack at - line 3. 58Character in 'c' format wrapped in pack at - line 3. 59Character in 'c' format wrapped in pack at - line 3. 60255 610 62255 630 64127 65-128 66127 67-128 68255 690 70255 710 72127 73-128 74127 75-128 76