Why would you want to?
Maybe you are just starting out with Perl and don't have a computer set up for Perl. Unix computers already include Perl, but maybe you don't have the permissions to run it on your computer.
Maybe you just want to try a Perl module for some external program that you don't want to install on your machine. Maybe you just got a bug report for Linux that you can't easily replicate. Maybe you are online and don't have access to your home machine. Maybe you just need 5GB of storage quickly.
You just need four steps to get to Perl in the Google Cloud Shell:
Log in with your Google credentials
That's how you pay for it - with information about yourself. Google will monitor what programs you invoke but not the command line parameters. In return, you get 5GB of permanent storage and a 2GB RAM virtual machine that includes Perl 5.24, other programming languages, the Google Cloud SDKs and other stuff.
Set up CPAN to use local::lib
Run the cpan command to perform the initial setup:
cpan
There, you need to answer two questions:
Install some stuff that you maybe want to try out
Upgrade Test::More, because the Debian stock 1.01 version causes some spurious test failurescpan Test::More cpan App::cpanminus Moo Future::AsyncAwait DBD::SQLite
More documentation on the Cloud Shell
Using the Cloud Shell as a web development environment
The cloud shell also comes with an included web proxy so that you (and only you) can try out web applications served from any web server on that machine. This makes the Cloud Shell a convenient testbed to try out web frameworks like Mojolicious, Dancer2, Dancer or even CGI::Application in PSGI mode.
Using Mojolicious
Install Mojolicious
cpan Mojolicious
Run minimal Mojolicious program:
perl -Mojo -E 'a("/hello" => {text => "Hello Mojo!"})->start' daemon - +l http://127.0.0.1:8080
Visit /hello in the Web Preview pane
Using Dancer2
Install Dancer2
cpan Dancer2Run minimal Dancer2 program:
perl -MDancer2 -e 'set port => 8080; get "/" => sub { "<i>Just</i> Ano +ther <b>Perl</b> <u>Hacker</u>," }; dance'
Using Dancer with Twiggy
cpan Dancer TwiggyRun minimal Dancer program:
plackup -e 'use Dancer; get "/hello/:name" => sub { return "Why, hello + there " . param("name"); }; dance;' --port 8080 -s Twiggy
Visit /hello/yourname in the Web Preview pane
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC: Tutorial for "Using Google Cloud Shell with Perl"
by choroba (Cardinal) on Jan 28, 2018 at 21:07 UTC | |
|
Re: RFC: Tutorial for "Using Google Cloud Shell with Perl"
by Crosis (Beadle) on Apr 23, 2018 at 07:23 UTC | |
by marto (Cardinal) on Apr 23, 2018 at 07:51 UTC |