Myths about Perl 6
I don&#x27;t necessarily want to wade into the discussion on the tone of the article, but I do want to detail something I&#x27;ve used Perl 6 for that makes me really enjoy working with the language. I&#x27;ve noticed a trend in threads where P6 comes up: I rarely see people actually point to specific instances where P6 features have been helpful. This lack of examples certainly doesn&#x27;t help push back against the idea that the language isn&#x27;t usable or, indeed, useful with anything less than 100% of the spec implemented.<p>I use P6 for all of my small deployment scripts (as well as a number of small utilities I&#x27;ve written, like a tmux wrapper). It gets out of my way when I just need something quick and useful from the start. For example it&#x27;s exceedingly easy to wrap other utilities because arguments to MAIN generate a command line interface automatically.<p>It also provides features that help me as I move from a useful-but-dirty prototype to a more maintainable script or piece of a more complex system. Gradual typing is a big part of this. I tend not to add types for most things, but it&#x27;s very easy to use the P6 type system to watch my back when I do want that help. It&#x27;s not as good at catching things before runtime as a hardcore static type system, but it manages to warn me &quot;... will never succeed with declared signature ...&quot; often enough.<p>I have a no-frills, no-auth file sharing site I deploy periodically to get a web front-end to share things with people (usually already on a VPN, sometimes just on a LAN). At the moment, I use a simple deploy script to do this manually, but I&#x27;m considering setting something up to automatically deploy it when connecting to a particular network. I almost definitely won&#x27;t get that part right on the first try and would <i>really</i> rather not end up accidentally deploying a no-auth filesystem on my server&#x27;s public IP address.<p>Using the P6 type system, I can easily define a subset of IPv4 addresses:<p><pre><code>    my @private-ranges = &lt;10.0.0.0&#x2F;8 172.16.0.0&#x2F;12 192.168.0.0&#x2F;16&gt;;
    subset IPv4::Private of IPv4 where -&gt; $ip { Net::Netmask.new(any @private-ranges).match($ip) };
</code></pre>
Then simply defining MAIN with a typed (and named, in this case, hence the colon) argument will handle all the checking at the type level.<p><pre><code>    sub MAIN(IPv4::Private :$ip) { ... }
</code></pre>
Now I won&#x27;t be able to deploy this service on a public IP as long as I use this deploy script as a primitive in whatever eventual solution I end up with, and the automatically generated usage message even helps communicate why a call failed (provided you have descriptive type&#x2F;parameter names).<p><pre><code>    λ |  .&#x2F;deploy --ip=$(dig +short myip.opendns.com @resolver1.opendns.com) 
    Usage:
      .&#x2F;deploy.p6 [--ip=&lt;Private&gt;]
    
    λ |  .&#x2F;deploy --ip=10.0.0.2
    Deploy successful.</code></pre>