File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
.prove
2
2
lib /Inline /pyhelper.so
3
3
Makefile
4
+ lib /.precomp
5
+ resources
Original file line number Diff line number Diff line change @@ -519,6 +519,10 @@ role PythonParent[$package, $class] {
519
519
);
520
520
}
521
521
522
+ method default_python {
523
+ $ default_python // = self . new ;
524
+ }
525
+
522
526
BEGIN {
523
527
PythonObject.^ add_fallback(-> $ , $ { True },
524
528
method ($ name ) {
@@ -537,3 +541,8 @@ BEGIN {
537
541
}
538
542
PythonObject.^ compose;
539
543
}
544
+
545
+ multi sub EVAL (Cool $ code , Str : $ lang where { ($ lang // ' ' ) eq ' Python' }, PseudoStash : $ context ) is export {
546
+ state $ py = ::(" Inline::Python" ). default_python;
547
+ $ py . run ($ code );
548
+ }
Original file line number Diff line number Diff line change 3
3
use v6 ;
4
4
use Inline::Python;
5
5
6
- say ' 1..1' ;
6
+ say ' 1..2' ;
7
+
8
+ EVAL ' print "ok 1 - EVAL eval\n"' , : from<Python >;
7
9
8
10
my $ py = Inline::Python. new ();
9
11
10
12
$ py . run ('
11
- print "ok 1 - basic eval\n";
13
+ print "ok 2 - direct eval\n";
12
14
' , : file);
13
15
14
16
# vim: ft=perl6
You can’t perform that action at this time.
0 commit comments