« blib/lib/auto/share/dist/Beekeeper/scraper/lib/MyApp/Service/Scraper.pm
↑ Summary
blib/lib/auto/share/dist/Beekeeper/websocket/lib/MyApp/Service/Calculator.pm »
| 1 | #!/usr/bin/perl -wT | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | BEGIN { unshift @INC, ($ENV{'PERL5LIB'} =~ m/([^:]+)/g); } | ||
| 7 | |||
| 8 | |||
| 9 | use MyApp::Service::Calculator; | ||
| 10 | |||
| 11 | my $calc = MyApp::Service::Calculator->new; | ||
| 12 | |||
| 13 | print "> "; | ||
| 14 | |||
| 15 | while (my $line = <STDIN>) { | ||
| 16 | chomp $line; | ||
| 17 | |||
| 18 | last if $line eq 'quit'; | ||
| 19 | |||
| 20 | my $result = eval { $calc->eval_expr($line) }; | ||
| 21 | |||
| 22 | print $@ ? "ERR: $@" : "= $result\n"; | ||
| 23 | |||
| 24 | print "> "; | ||
| 25 | } | ||
| 26 | |||
| 27 | 1; |