Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Mini HowTo: How to port Perl 5 modules to Perl 6

by iblech (Friar)
on Mar 25, 2005 at 20:07 UTC ( #442402=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # This Perl 5 exporting code...
    require Exporter;
    ...
    
    # ...becomes this in Perl 6:
    sub foo(...) is export {...}
    
  2. or download this
    # Perl 5
    sub get_foo {
    ...
    $obj.foo = "...";
    # Notice: Standard assignment syntax!
    # Assignments should look line assingments, not like method calls
    
  3. or download this
    has $.foo is rw;
    
  4. or download this
    subtype OddInt of Int where { $^n % 2 == 1 }
    has OddInt $.foo is rw;
    # And then:
    $obj.foo = 12; # will die (at compile-time!)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://442402]
Approved by dragonchild
Front-paged by dragonchild
help
Chatterbox?
[davies]: LanX: No. The mayor of London would better be described as the transport commisar for London. S/h/it doesn't have a tenth of the power of La Sturgeon (and therefore does <10% of the damage).
[LanX]: xD ... complicated countrie(s)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-12-15 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (440 votes). Check out past polls.

    Notices?