Changeset 5001
- Timestamp:
- 06/26/05 11:08:26 (4 years ago)
- svk:copy_cache_prev:
- 6856
- Files:
-
- 1 removed
- 36 modified
- 1 moved
-
Makefile.PL (modified) (1 diff)
-
docs/quickref/data (modified) (1 diff)
-
examples/advocacy/motd-i.p6 (modified) (3 diffs)
-
examples/advocacy/motd.p6 (modified) (1 diff)
-
examples/cookbook/01strings/01-10interpolating-functions.p6 (modified) (1 diff)
-
examples/functional/monads.p6 (modified) (1 diff)
-
examples/games/animals.p6 (modified) (1 diff)
-
examples/games/hangman.p6 (modified) (1 diff)
-
examples/games/wizard.p6 (modified) (1 diff)
-
examples/golf/tsanta.pl (modified) (1 diff)
-
examples/irclog2html.p6 (modified) (1 diff)
-
examples/junctions/2.p6 (modified) (1 diff)
-
examples/junctions/passwd-check.p6 (modified) (1 diff)
-
examples/matrix.p5 (modified) (2 diffs)
-
examples/matrix.p6 (modified) (1 diff)
-
examples/naive_bayesian/naive_bayesian.p5 (modified) (1 diff)
-
examples/naive_bayesian/naive_bayesian.p6 (modified) (1 diff)
-
examples/network/bot_irc.p6 (modified) (1 diff)
-
examples/obfu/l33t.p6 (modified) (1 diff)
-
ext/Config-Tiny/lib/Config/Tiny.pm (modified) (1 diff)
-
ext/File-Spec/t/30_cwd.t (modified) (1 diff)
-
ext/Kwid-Event-Parser/lib/Kwid/Event/Parser.pm (modified) (3 diffs)
-
ext/Kwid-Event-Parser/t/basic.t (modified) (1 diff)
-
ext/Locale-KeyedText/lib/Locale/KeyedText.pm (modified) (1 diff)
-
ext/Pod-Event-Parser/lib/Pod/Event/Handler/HTML.pm (modified) (1 diff)
-
ext/Pod-Event-Parser/lib/Pod/Event/Parser.pm (modified) (2 diffs)
-
ext/Pod-Event-Parser/t/complex.t (modified) (1 diff)
-
ext/WTemplate/README (moved) (moved from ext/WTemplate/readme)
-
src/Pugs/Prim.hs (modified) (2 diffs)
-
src/Pugs/Run/Args.hs (modified) (1 diff)
-
src/perl6/Prelude/PIR.pm (modified) (1 diff)
-
t/builtins/strings/chomp.t (modified) (6 diffs)
-
t/builtins/system/01-strings-with-spaces.t (modified) (1 diff)
-
t/magicals/pid.t (modified) (1 diff)
-
t/pugsrun/01-dash-uppercase-i.t (modified) (2 diffs)
-
t/pugsrun/01-multiple-e.t (modified) (1 diff)
-
t/pugsrun/03-dash-p.t (modified) (1 diff)
-
t/unspecced/chomp.t (deleted)
Legend:
- Unmodified
- Added
- Removed
-
Makefile.PL
r4974 r5001 278 278 279 279 pugs.prof :: profiled 280 find t -type f | grep -v D | grep -v R | grep -v pugsrun | ./pugs +RTS -p -RTS -e 'my sub exit {}; for =\$\$*IN -> \$\$t is copy { chomp \$\$t; require \$\$t }'280 find t -type f | grep -v D | grep -v R | grep -v pugsrun | ./pugs +RTS -p -RTS -e 'my sub exit {}; for =\$\$*IN -> \$\$t is copy { \$\$t .= chomp; require \$\$t }' 281 281 282 282 optimised :: optimized -
docs/quickref/data
r3797 r5001 12 12 Methods: 13 13 14 .chomp 14 .chomp # Returns chomped string with a .newline property giving the 15 newline removed 15 16 .chop 16 17 .ord -
examples/advocacy/motd-i.p6
r4451 r5001 17 17 my $fh = open($dict) err die $!; 18 18 19 for =$fh->$line is copy{ 20 chomp $line; 21 push @list,$line || next() 19 for =$fh->$line { 20 push @list,chomp($line) || next() 22 21 }; 23 22 … … 40 39 while $keyed = =$*IN { 41 40 clear; 42 chomp $keyed;41 $keyed .= chomp; 43 42 my @keyed_args ; 44 43 if $keyed { … … 56 55 print "y/N ..."; 57 56 my $ans = =$*IN ;# XXX want 'is chomped'; 58 chomp $ans;57 $ans .= chomp; 59 58 60 59 # User wants to save changes -
examples/advocacy/motd.p6
r4451 r5001 15 15 my $dict = canonpath("$progdir/pugspraise"); 16 16 my $fh = open $dict err die $!; 17 my @list = map -> $a is copy {chomp $a; $a;}=$fh;17 my @list = map &chomp, =$fh; 18 18 19 19 #XXX it sure would make things tidier filehandle could be autochomped. -
examples/cookbook/01strings/01-10interpolating-functions.p6
r3174 r5001 40 40 From: Your Bank 41 41 Cc: &get_manager_list($naughty) 42 Date: { do { my $now = `date`; chomp $now; $now } } (today)42 Date: { do { my $now = `date`; $now .= chomp; $now } } (today) 43 43 44 44 Dear $naughty, -
examples/functional/monads.p6
r2824 r5001 64 64 return { 65 65 my $line = =$IN; 66 chomp $line;66 $line .= chomp; 67 67 $line; 68 68 }; -
examples/games/animals.p6
r3174 r5001 26 26 print "No!? What was it then? "; 27 27 # XXX: chomp(my $new = =$*IN)'d be nicer 28 my $new = =$*IN; chomp $new;28 my $new = =$*IN; $new .= chomp; 29 29 print "And a question that distinguishes a $this from a $new would be? "; 30 my $q = =$*IN; chomp $q;30 my $q = =$*IN; $q .= chomp; 31 31 my $yes = yes "And for a $new, the answer would be..."; 32 32 -
examples/games/hangman.p6
r3189 r5001 120 120 while ($letter = =$*IN) { 121 121 cls; 122 chomp($letter);122 $letter .= chomp; 123 123 124 124 if (guess($letter)) { -
examples/games/wizard.p6
r4091 r5001 3 3 multi sub prompt (Str ?$prompt) { 4 4 print $prompt; 5 my $input; ($input = =<>) .chomp;5 my $input; ($input = =<>) .= chomp; 6 6 return $input; 7 7 } -
examples/golf/tsanta.pl
r1031 r5001 34 34 my $golf = 0; 35 35 while (<FF>) { 36 chomp; next unless length;36 $_ .= chomp; next unless length; 37 37 s/^#!.*?perl// if $. == 1; 38 38 $golf += length; -
examples/irclog2html.p6
r3258 r5001 183 183 # ($time, $type, $nick, $text). 184 184 sub parse_ilogger2(Str $line is copy) { 185 chomp $line;185 $line .= chomp; 186 186 $line ~~ rx:Perl5/^\[(\d\d:\d\d)\] (.*)$/ or 187 187 die "Couldn't parse line »$line«!"; -
examples/junctions/2.p6
r3174 r5001 8 8 say "enter a colour: "; 9 9 my $y = =$*IN; 10 chomp $y;10 $y .= chomp; 11 11 12 12 my $result = ($x eq $y) ?? "acceptable" :: 'unacceptable' ; -
examples/junctions/passwd-check.p6
r3174 r5001 11 11 12 12 print "Enter new password: "; 13 my $password = =$IN; 14 chomp $password; 15 $password; 13 my $password = chomp =$IN; 16 14 } 17 15 -
examples/matrix.p5
r3079 r5001 6 6 print "5x5 matrix in one line: " unless @ARGV; 7 7 my $matrix = shift || <>; 8 chomp $matrix;8 $matrix .= chomp; 9 9 $matrix ||= "abcdefghijklmnopqrstuvwxy"; 10 10 my @matrix = [ ('_') x 7 ]; … … 68 68 substr(join('', @{ $matrix[1] }), 1, 5) =~ /$re/ or die; # Precompile 69 69 while (<$fh>) { 70 chomp;70 $_ .= chomp; 71 71 next if tr/a-z//c; # Regex would destroy the compiled one 72 72 // and push @matches, [ $_, sum map $scores{$_}, split // ]; -
examples/matrix.p6
r4103 r5001 4 4 print "5x5 matrix in one line: " unless @*ARGS; 5 5 my $matrix = @*ARGS[0] || =<>; 6 chomp $matrix;6 $matrix .= chomp; 7 7 $matrix ||= "abcdefghijklmnopqrstuvwxy"; 8 8 -
examples/naive_bayesian/naive_bayesian.p5
r3174 r5001 17 17 open DB, "<words.db.p5" || die "Cannot open the words.db.p5 file: $!"; 18 18 while (my $line = <DB>) { 19 chomp($line);19 $line .= chomp; 20 20 my ($key, $value) = split(/\t/, $line); 21 21 $words{$key} = $value; -
examples/naive_bayesian/naive_bayesian.p6
r4402 r5001 10 10 for (=$db) -> $_line { 11 11 my $line = $_line; 12 chomp($line);12 $line .= chomp; 13 13 my ($key, $value) = split("\t", $line); 14 14 %words{"$key"} = $value; -
examples/network/bot_irc.p6
r3174 r5001 33 33 while ($ligne = readline($hdl)) 34 34 { 35 chomp($ligne);35 $ligne .= chomp; 36 36 say "Serveur said : $ligne"; # if $debug; 37 37 -
examples/obfu/l33t.p6
r4900 r5001 196 196 method debug_action(Str $cmd is copy) returns Bool { 197 197 $:runnable = bool::false; 198 $cmd .chomp;198 $cmd .= chomp; 199 199 $cmd ||= $:last_db_command; 200 200 $:last_db_command = $cmd; -
ext/Config-Tiny/lib/Config/Tiny.pm
r4401 r5001 24 24 for =$input -> $line is copy { 25 25 ++$cnt; 26 chomp $line;26 $line .= chomp; 27 27 28 28 # Skip comments and empty lines -
ext/File-Spec/t/30_cwd.t
r2847 r5001 21 21 my @retval = system("cd"); 22 22 my $cwd = @retval[0]; 23 chomp($cwd);23 $cwd .= chomp; 24 24 return $cwd; 25 25 } -
ext/Kwid-Event-Parser/lib/Kwid/Event/Parser.pm
r2987 r5001 28 28 my $line = $fh.readline; 29 29 last unless $line.defined; # exit as soon as possible 30 chomp($line);30 $line .= chomp; 31 31 if ($line ~~ rx:perl5{^=kwid}) { 32 32 $is_parsing = 1; … … 77 77 $_line = $fh.readline; 78 78 } 79 chomp($verbatim);79 $verbatim .= chomp; 80 80 %events<start_element>('verbatim'); 81 81 %events<verbatim>($verbatim); … … 93 93 while (defined($_line) && 94 94 !($_line ~~ rx:perl5{^\n$}) ) { 95 chomp($_line);95 $_line .= chomp; 96 96 interpolate($_line, %events); 97 97 $_line = $fh.readline; -
ext/Kwid-Event-Parser/t/basic.t
r4203 r5001 94 94 } 95 95 # trim the last newline 96 chomp($buffer);96 $buffer .= chomp; 97 97 }, 98 98 string => -> ($str) { $buffer ~= $str } -
ext/Locale-KeyedText/lib/Locale/KeyedText.pm
r4711 r5001 711 711 LOOP: { 712 712 show_message( $translator, Locale::KeyedText.new_message( 'MYAPP_PROMPT' ) ); 713 my Str $user_input = $*IN; $user_input .chomp;713 my Str $user_input = $*IN; $user_input .= chomp; 714 714 $user_input or last LOOP; # user chose to exit program 715 715 try { -
ext/Pod-Event-Parser/lib/Pod/Event/Handler/HTML.pm
r3086 r5001 88 88 } 89 89 # trim the last newline 90 chomp($buffer);90 $buffer .= chomp; 91 91 }, 92 92 string => -> ($str) { $buffer ~= $str } -
ext/Pod-Event-Parser/lib/Pod/Event/Parser.pm
r3086 r5001 29 29 my $line = $fh.readline; 30 30 last unless $line.defined; # exit as soon as possible 31 chomp($line);31 $line .= chomp; 32 32 if ($line ~~ rx:perl5{^=pod}) { 33 33 $is_parsing = 1; … … 95 95 while (defined($_line) && 96 96 !($_line ~~ rx:perl5{^\n$}) ) { 97 chomp($_line);97 $_line .= chomp; 98 98 interpolate($_line, %events); 99 99 $_line = $fh.readline; -
ext/Pod-Event-Parser/t/complex.t
r4126 r5001 27 27 } 28 28 $fh.close(); 29 chomp($expected_output);29 $expected_output .= chomp; 30 30 31 31 # now compare -
src/Pugs/Prim.hs
r4986 r5001 110 110 return $ VStr [last str] 111 111 op1 "chomp" = \x -> do 112 ref <- fromVal x113 112 str <- fromVal x 114 113 if null str || last str /= '\n' 115 then return undef114 then return $ VStr str 116 115 else do 117 writeRef ref $ VStr (init str)118 return $ VStr [last str]116 -- writeRef ref $ VStr (init str) 117 return $ VStr $ init str 119 118 op1 "Str::split" = op1Cast (castV . words) 120 119 op1 "lc" = op1Cast (VStr . map toLower) … … 1324 1323 \\n Any pre undefine safe (?rw!Any)\ 1325 1324 \\n Str pre chop safe (?rw!Str=$_)\ 1326 \\n Str pre chomp safe (? rw!Str=$_)\1325 \\n Str pre chomp safe (?Str=$_)\ 1327 1326 \\n Any right = safe (rw!Any, Any)\ 1328 1327 \\n Int pre index safe (Str, Str, ?Int=0)\ -
src/Pugs/Run/Args.hs
r3910 r5001 145 145 joinDashE :: [Arg] -> [Arg] 146 146 joinDashE [] = [] 147 joinDashE ((Switch 'p'):args) = joinDashE ((Opt "-e" "while ($_ = =<>) { chomp $_;"):script++[(Opt "-e" "; say $_; }")]++rest)147 joinDashE ((Switch 'p'):args) = joinDashE ((Opt "-e" "while ($_ = =<>) { $_ .= chomp;"):script++[(Opt "-e" "; say $_; }")]++rest) 148 148 where 149 149 (script,rest) = partition isDashE args 150 150 isDashE (Opt "-e" _) = True 151 151 isDashE (_) = False 152 joinDashE ((Switch 'n'):args) = joinDashE ((Opt "-e" "while ($_ = =<>) { chomp $_;"):script++[(Opt "-e" "}")]++rest)152 joinDashE ((Switch 'n'):args) = joinDashE ((Opt "-e" "while ($_ = =<>) { $_ .= chomp;"):script++[(Opt "-e" "}")]++rest) 153 153 where 154 154 (script,rest) = partition isDashE args -
src/perl6/Prelude/PIR.pm
r4918 r5001 5 5 sub prefix:<?> ($var) returns Bool is primitive { true $var } 6 6 7 sub chomp (Str $str is rw) returns Str is primitive { 7 sub chomp (Str $str) returns Str is primitive { 8 # XXX return $str but newline("\n") 8 9 if substr($str, -1, 1) eq "\n" { 9 $str = substr $str, 0, chars($str) - 1; 10 "\n"; 10 substr $str, 0, chars($str) - 1; 11 11 } else { 12 undef;12 $str; 13 13 } 14 14 } -
t/builtins/strings/chomp.t
r3290 r5001 4 4 use Test; 5 5 6 plan 1 0;6 plan 13; 7 7 8 8 =pod … … 13 13 14 14 # L<S29/"Perl6::Str" /chomp/> 15 # See http://use.perl.org/~autrijus/journal/25351, too. 15 16 16 17 { 17 18 my $foo = "foo\n"; 18 19 chomp($foo); 20 is($foo, "foo\n", 'our variable was not yet chomped'); 21 $foo .= chomp; 19 22 is($foo, 'foo', 'our variable is chomped correctly'); 20 chomp($foo);23 $foo .= chomp; 21 24 is($foo, 'foo', 'our variable is chomped again with no effect'); 22 25 } … … 24 27 { 25 28 my $foo = "foo\n\n"; 26 chomp($foo);29 $foo .= chomp; 27 30 is($foo, "foo\n", 'our variable is chomped correctly'); 28 chomp($foo);31 $foo .= chomp; 29 32 is($foo, 'foo', 'our variable is chomped again correctly'); 30 chomp($foo);33 $foo .= chomp; 31 34 is($foo, 'foo', 'our variable is chomped again with no effect'); 32 35 } … … 34 37 { 35 38 my $foo = "foo\nbar\n"; 36 chomp($foo);39 $foo .= chomp; 37 40 is($foo, "foo\nbar", 'our variable is chomped correctly'); 38 chomp($foo);41 $foo .= chomp; 39 42 is($foo, "foo\nbar", 'our variable is chomped again with no effect'); 40 43 } … … 42 45 { 43 46 my $foo = "foo\n "; 44 chomp($foo);47 $foo .= chomp; 45 48 is($foo, "foo\n ", 'our variable is chomped with no effect'); 46 49 } … … 48 51 { 49 52 my $foo = "foo\n"; 50 my $chomped_foo = chomp($foo);51 is($chomped_foo, "\n", 'chomp returns the chomped value');52 is($foo, 'foo', 'and our variable is chomped correctly');53 my $chomped_foo = try { chomp($foo).newline }; 54 is($chomped_foo, "\n", 'chomp(...).newline returns the chomped value', :todo<feature>); 55 is($foo, "foo\n", 'and our variable was not chomped'); 53 56 } 54 57 58 { 59 my $foo = "foo\n"; 60 $foo .= chomp; 61 my $chomped_foo = try { $foo.newline }; 62 is($chomped_foo, "\n", 'chomp(...).newline returns the chomped value', :todo<feature>); 63 is($foo, "foo", 'and our variable was chomped'); 64 } -
t/builtins/system/01-strings-with-spaces.t
r4546 r5001 185 185 186 186 my $output = slurp $outfile; 187 chomp $output;187 $output .= chomp; 188 188 189 189 is($output,$expected,$name) -
t/magicals/pid.t
r3722 r5001 29 29 30 30 my $child_pid = slurp $tempfile; 31 chomp $child_pid;31 $child_pid .= chomp; 32 32 unlink $tempfile; 33 33 -
t/pugsrun/01-dash-uppercase-i.t
r3722 r5001 65 65 $command = join " ", map { qq("-I$_") } @dirs; 66 66 my $got = run_pugs( $command ~ " $fragment" ); 67 chomp $got;67 $got .= chomp; 68 68 69 69 if (substr($got,0,1) ~~ "[") { … … 81 81 $got = run_pugs( $command ~ " $fragment" ); 82 82 83 chomp $got;83 $got .= chomp; 84 84 if (substr($got,0,1) ~~ "[") { 85 85 # Convert from arrayref to array -
t/pugsrun/01-multiple-e.t
r3722 r5001 53 53 my @expected = <Hello Pugs>; 54 54 my $got = slurp $out_fn; 55 chomp $got;55 $got .= chomp; 56 56 if (substr($got,0,1) ~~ "\\") { 57 57 $got = substr($got,1); -
t/pugsrun/03-dash-p.t
r4549 r5001
