Skip to content

Commit dbdf383

Browse files
author
Perl 6 Evalbot
committed
give p6eval the ability to accept gist.github.com URLs
1 parent 52b1dc9 commit dbdf383

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/EvalbotExecuter.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ my $max_output_len = 290;
7878

7979
sub run {
8080
my ($program, $executer) = @_;
81+
if ($program =~ /^https:\/\/gist\.github\.com\/\d+$/) {
82+
my $page = `curl -s $program`;
83+
$page =~ /href="(\/raw[^"]+)"/;
84+
$program = `curl -s https://gist.github.com$1`;
85+
}
8186
my $response = _fork_and_eval($program, $executer);
8287
if (!length $response){
8388
$response = ' ( no output )';

0 commit comments

Comments
 (0)