Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Perl6: Choosing language version in the shebang line?

by kcott (Archbishop)
on Feb 22, 2017 at 07:17 UTC ( [id://1182499]=note: print w/replies, xml ) Need Help??


in reply to Perl6: Choosing language version in the shebang line?

G'day reverendmred,

Welcome to the Monastery.

"Now, Perl6 has changed all the rules."

I wasn't certain if you were clear on this, so, just to clarify the situation, Perl6 is not the latest version, or a simple update, of Perl5. They are different languages, with their own syntaxes. Except in the most trivial cases, you can't run Perl5 source as Perl6, or vice versa. Here's an example of the level of triviality that I'm talking about:

$ perl -e 'print "Hello, world!\n"' Hello, world! $ perl6 -e 'print "Hello, world!\n"' Hello, world! $

Perl6 has many similarities to Perl5, but they're not the same language. See https://docs.perl6.org/language/5to6-nutshell ("Perl 5 to Perl 6, in a nutshell: How do I do what I used to do?"). There's a number of other 5to6-* links in https://docs.perl6.org/language.html ("Perl 6 Language Documentation").

Perl6 is considered a sister language to Perl5 (see https://perl6.org/). Perl5 is the language to (continue to) choose for robust, production-grade code.

"Once long ago, we used the top of the file to point the script at the executable."

Long ago, and still today! That's called the shebang line. You could use either of these as the first line of your Perl script:

#!/usr/bin/env perl #!/usr/bin/env perl6
"... if you had good OO like Perl5 code, there should be no problem running it alongside new Perl6 code ..."

Yes, you can have both Perl5 and Perl6 code in the same source. See https://github.com/rakudo-p5/v5 for example code; follow links therein for further details.

"So, is there a way we can fork projects and modules on CPAN?"

Not really my area of expertise; however, https://modules.perl6.org/ has links to information about creating modules for Perl6.

— Ken

Replies are listed 'Best First'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1182499]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-03-28 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found