1

I am trying to run a Perl script directly from GitHub. This thread seems to address my issue (indeed, it helped me run dofiles in Stata directly from GitHub). However, when I type the following in a command prompt:

"perl https://rawgit.com/EconJoe/medline2014-xmlparsers/master/desc2014_meshtreenumbers.pl"

I get The following error message: "Can't open perl script "https://rawgit.com/EconJoe/medline2014-xmlparsers/master/desc2014_meshtreenumbers.pl": Invalid argument"

Thanks for any help.

Community
  • 1
  • 1
  • perl doesn't know how to execute remote scripts like that. You'll have to fetch the file to the local system, then run it. – stevieb Sep 29 '16 at 14:17
  • This is an extremely dangerous practice. The perl could contain `qx{ rm -rf / };` and any number of exploits, self-installation of malware, etc, perhaps strongly obfuscated or buried a few thousand lines into an otherwise normal looking script or just through an accident, hacked account, or a test that wasn't intended to be used. – Ashley Sep 29 '16 at 17:30
  • Thanks for the replies. Ashley--does this hold true if I am only using code in my own repositories? If so, is it any different from manually downloading and running code from GitHub? – Joseph Staudt Sep 30 '16 at 18:44

1 Answers1

6

perl can't fetch a script from a URL. You have to do that separately.

curl -L https://rawgit.com/EconJoe/medline2014-xmlparsers/master/desc2014_meshtreenumbers.pl | perl
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • 2
    `cpanm` also uses this in [its documentation](https://v1.metacpan.org/pod/App::cpanminus#Installing-to-system-perl) to show how to install it. – simbabque Sep 29 '16 at 14:20