Commit | Line | Data |
9eedd677 |
1 | use strictures 2; |
2 | use Module::Runtime qw(use_module); |
fa8f5696 |
3 | use DX::Utils qw(:builders); |
9eedd677 |
4 | |
e0644ad0 |
5 | { package FakeReadline; |
6 | sub readline { |
7 | return undef unless defined(my $line = readline($_[0])); |
8 | print $_[1].$line; |
9 | return $line; |
10 | } |
11 | sub history_add {} |
2548ce61 |
12 | sub isa { require Caroline; return 1 if Caroline->isa($_[1]); } |
e0644ad0 |
13 | } |
14 | |
9eedd677 |
15 | use_module('DX::ShellFrontend')->new( |
16 | session_mode => 'shell', |
17 | session => use_module('DX::ShellSession')->new( |
18 | shell_state => use_module('DX::ShellState')->new( |
19 | mode => 'shell', |
fa8f5696 |
20 | template_query_state => use_module('DX::QueryState')->new( |
21 | predicates => { |
22 | 'eq' => use_module('DX::Predicate::Eq')->new, |
23 | member_at => use_module('DX::Predicate::MemberAt')->new, |
9fd6087b |
24 | dict => use_module('DX::Predicate::Dict')->new, |
fa8f5696 |
25 | }, |
26 | globals => dict(), |
27 | proposition_sequence |
28 | => use_module('DX::PropositionSequence')->new_empty, |
29 | ), |
d294025e |
30 | trace_these => {}, |
e0644ad0 |
31 | ), |
32 | ), |
33 | (@ARGV |
34 | ? (readline => do { |
35 | open my $fh, '<', $ARGV[0] or die "Couldn't open script: $!"; |
36 | bless($fh, 'FakeReadline') |
37 | }) |
38 | : () |
9eedd677 |
39 | ), |
40 | )->repl |