Changeset 21574
- Timestamp:
- 07/27/08 18:44:51 (6 months ago)
- Location:
- perl5/Pugs-Compiler-Perl6/lib/Pugs
- Files:
-
- 3 modified
-
Emitter/Perl6/Perl5.pm (modified) (2 diffs)
-
Runtime/Perl6.pm (modified) (2 diffs)
-
Runtime/Perl6Prelude.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
perl5/Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm
r21573 r21574 802 802 || $subname eq 'index' || $subname eq 'undef' || $subname eq 'rand' || $subname eq 'int' 803 803 || $subname eq 'splice' || $subname eq 'keys' || $subname eq 'values' || $subname eq 'sort' 804 || $subname eq 'chomp' || $subname eq 'lc' || $subname eq 'abs' 804 || $subname eq 'chomp' || $subname eq 'lc' || $subname eq 'abs' || $subname eq 'sleep' 805 805 ) 806 806 { … … 840 840 if ($subname eq 'open') { 841 841 return 'Perl6::Internals::open('. _emit_parameter_capture( $n->{param} ) . ')'; 842 } 843 if ($subname eq 'slurp') { 844 return 'Pugs::Runtime::Perl6::IO::slurp'. emit_parenthesis( $n->{param} ); 842 845 } 843 846 -
perl5/Pugs-Compiler-Perl6/lib/Pugs/Runtime/Perl6.pm
r21566 r21574 23 23 sub perl { 24 24 local $Data::Dumper::Terse = 1; 25 my $can = UNIVERSAL::can($_[0] => 'perl'); 26 if ($can) { 27 $can->($_[0]); 28 } 29 else { 30 Dumper($_[0]); 31 } 25 my $self = shift; 26 my $can = UNIVERSAL::can($self => 'perl'); 27 my $v = $can 28 ? $can->($self) 29 : Dumper($self); 30 chomp $v; 31 return $v . ', ' . perl( @_ ) if @_; 32 return $v; 32 33 } 33 34 … … 184 185 185 186 sub slurp { 186 my $self = $_[0]; 187 my $content; 188 local $/; 189 $content = <$self>; 190 return bless \$content, 'Pugs::Runtime::Perl6::Scalar'; 187 if ( wantarray ) { 188 my @a; 189 if ( ref( $_[0] ) eq 'IO::File' ) { 190 my $f = shift; 191 @a = <$f>; 192 } 193 else { 194 local( @ARGV ) = ( @_ ); 195 @a = <ARGV>; 196 } 197 chomp @a; 198 return @a; 199 } 200 201 if ( ref( $_[0] ) eq 'IO::File' ) { 202 return <$_[0]>; 203 } 204 else { 205 local( $/, @ARGV ) = ( undef, @_ ); 206 return <ARGV>; 207 } 191 208 } 192 209 -
perl5/Pugs-Compiler-Perl6/lib/Pugs/Runtime/Perl6Prelude.pm
r12128 r21574 15 15 sub NaN is export { Pugs::Runtime::Perl6::NaN } 16 16 17 sub slurp { ... } # Slurps in an entire file17 # sub slurp { ... } # Slurps in an entire file 18 18 19 19 module Perl6::Internals; … … 21 21 sub compile_pir($code) { ... } 22 22 sub exit($status) is export { use v5; CORE::exit($status); use v6; } 23 sub sleep($seconds) is export { use v5; CORE::sleep($seconds); use v6; }23 # sub sleep($seconds) is export { use v5; CORE::sleep($seconds); use v6; } 24 24 25 25 sub open($file) { use v5; my $fh = IO::File->new; $fh->open($file); $fh; use v6; }
