@@ -1370,7 +1370,7 @@ C<with> command:
1370
1370
say "Not found"
1371
1371
}
1372
1372
1373
- The Perl 6 ecosystem has a module C < P5index > which exports an C < rindex >
1373
+ The Perl 6 ecosystem has a module C < P5index > which exports a C < rindex >
1374
1374
function that mimics the original Perl 5 behaviour as much as possible.
1375
1375
1376
1376
= head2 rmdir
@@ -1527,6 +1527,17 @@ equivalent.
1527
1527
Still works as in Perl 5, but is not limited to integer values for seconds.
1528
1528
And it always returns Nil.
1529
1529
1530
+ If you're interested in the return values of C < sleep > to ensure sleeping until
1531
+ a specified time, then you should use C < sleep-until > in Perl 6 (which takes
1532
+ an C < Instant > ).
1533
+
1534
+ If you're interested in running some code every N seconds, and you don't care
1535
+ on which thread it runs, you should probably use C < react > and C < whenever >
1536
+ with a C < Supply.interval > .
1537
+
1538
+ The Perl 6 ecosystem has a module C < P5sleep > which exports a C < sleep >
1539
+ function that mimics the original Perl 5 behaviour as much as possible.
1540
+
1530
1541
= head2 sockets
1531
1542
1532
1543
= item socket SOCKET, DOMAIN, TYPE, PROTOCOL
@@ -1573,7 +1584,6 @@ Available in Perl 6. Can also be used as a method. C<< splice(@foo, 2, 3,
1573
1584
1574
1585
= item split /PATTERN/
1575
1586
1576
-
1577
1587
Works mostly as in Perl 5. There are some exceptions, though. To get the
1578
1588
special behavior of using the empty string, you must actually use the
1579
1589
empty string - the special case of the empty pattern C < // > being treated
@@ -1680,6 +1690,9 @@ Available in Perl 6, see L<state|/syntax/state>.
1680
1690
1681
1691
C < study > is no more.
1682
1692
1693
+ The Perl 6 ecosystem has a module C < P5study > which exports a C < study >
1694
+ function that mimics the original Perl 5 behaviour as much as possible.
1695
+
1683
1696
= head2 sub
1684
1697
1685
1698
= item sub NAME BLOCK
@@ -1720,7 +1733,7 @@ C<"hola!".substr(1, 3)> both return "ola".
1720
1733
1721
1734
= item symlink OLDFILE, NEWFILE
1722
1735
1723
- See L < symlink >
1736
+ See L < symlink > .
1724
1737
1725
1738
= head2 syscall
1726
1739
@@ -1767,7 +1780,7 @@ As with C<sysopen> and friends, this has moved into the C<IO> classes.
1767
1780
1768
1781
= item tell FILEHANDLE
1769
1782
1770
- In C < IO::Handle > , but not yet documented, beyond a mention .
1783
+ As a method on C < IO::Handle > .
1771
1784
1772
1785
= head2 telldir
1773
1786
@@ -1781,24 +1794,41 @@ Possibly in C<IO::Path>, but not yet documented.
1781
1794
1782
1795
= item tied VARIABLE
1783
1796
1784
- [NEEDS FURTHER RESEARCH] S29 indicates that variable tying has been
1785
- replaced by container types. Unfortunately, what this means in practical
1786
- terms has not been obviously specified.
1797
+ The Perl 6 alternative to tieing a scalar, is the C < Proxy > container. For
1798
+ example:
1799
+
1800
+ sub lval() { Proxy.new(
1801
+ FETCH => method () { ...},
1802
+ STORE => method ($new) { ... }
1803
+ ) }
1804
+
1805
+ This makes C < lval > a left-value sub. Whenever the value is requested, the
1806
+ C < FETCH > method is called. And whenever it is used in an assignment, the
1807
+ C < STORE > method is called.
1808
+
1809
+ For arrays and hashes (objects that do the C < Positional > and/or C < Associative >
1810
+ role), one only needs to provide the methods that these roles require to get
1811
+ the functionality that C < tie > provides in Perl 5. These are documented in
1812
+ the C < Subscripts > section.
1813
+
1814
+ The Perl 6 ecosystem has a module C < P5tie > which exports C < tie > / C < tied >
1815
+ functions that mimics the original Perl 5 behaviour as much as possible.
1787
1816
1788
1817
= head2 time
1789
1818
1790
1819
= item time
1791
1820
1792
- "Returns an Int representing the current time." Although I < how > it represents the
1793
- current time isn't in the documentation currently, it appears to still be
1794
- seconds since epoch, as in Perl 5.
1821
+ Number of seconds since epoch (as an C < Int > ), same as in Perl 5.
1795
1822
1796
1823
= head2 times
1797
1824
1798
1825
= item times
1799
1826
1800
1827
Not available in Perl 6.
1801
1828
1829
+ The Perl 6 ecosystem has a module C < P5times > which exports a C < times >
1830
+ function that mimics the original Perl 5 behaviour as much as possible.
1831
+
1802
1832
= head2 tr///
1803
1833
1804
1834
= item tr///
@@ -1817,29 +1847,37 @@ The C<y///> equivalent does not exist.
1817
1847
1818
1848
= item truncate EXPR, LENGTH
1819
1849
1820
- Most likely somewhere in C < IO::Handle > , but not currently documented .
1850
+ Not currently implemented (2018.04) .
1821
1851
1822
1852
= head2 uc
1823
1853
1824
1854
= item uc EXPR
1825
1855
1826
1856
Works as a function and a method. C < uc("ha") > and C < "ha".uc > both return "HA".
1857
+ There is no support for the parameterless version.
1858
+
1859
+ The Perl 6 ecosystem has a module C < P5lc > which exports a C < uc >
1860
+ function that mimics the original Perl 5 behaviour as much as possible.
1827
1861
1828
1862
= head2 ucfirst
1829
1863
1830
1864
= item ucfirst EXPR
1831
1865
1832
1866
= item ucfirst
1833
1867
1834
- Perl 6 has done away with C < ucfirst > . The title case function L < C < tc > |/routine/tc> probably
1835
- does what you need.
1868
+ Perl 6 has done away with C < ucfirst > . The title case function
1869
+ L < C < tc > |/routine/tc> probably does what you need.
1870
+
1871
+ The Perl 6 ecosystem has a module C < P5lcfirst > which exports a C < ucfirst >
1872
+ function that mimics the original Perl 5 behaviour as much as possible.
1836
1873
1837
1874
= head2 undef
1838
1875
1839
1876
= item undef EXPR
1840
1877
1841
1878
There is no C < undef > in Perl 6. You can't undefine a function, and the closest
1842
1879
equivalent value is probably C < Nil > , but you'll likely have no use for that.
1880
+
1843
1881
If you were using something like C < (undef, $file, $line) = caller; > , you would
1844
1882
just get the filename and line number directly in Perl 6 instead of discarding
1845
1883
the first result of C < caller > . C < caller > has been replaced by C < callframe > in
@@ -1865,10 +1903,15 @@ The zero argument (implicit C<$_>) version of unlink is not available in Perl 6
1865
1903
1866
1904
= item unpack TEMPLATE
1867
1905
1868
- Available in Perl 6. The template options are currently more restricted
1869
- than they are in Perl 5. The current documented list can be found
1870
- L < here|/routine/unpack > .
1906
+ Available in Perl 6 when C < use experimental :pack > has been specified in the
1907
+ scope where C < unpack > needs to be called. The template options are currently
1908
+ more restricted than they are in Perl 5. The current documented list can be
1909
+ found at L < unpack|/routine/unpack > .
1871
1910
1911
+ The Perl 6 ecosystem has a module C < P5pack > which exports a C < unpack >
1912
+ function that mimics the original Perl 5 behaviour as much as possible
1913
+ and which has a bigger set of supported features than the experimental
1914
+ Perl 6 version.
1872
1915
1873
1916
= head2 unshift
1874
1917
@@ -1883,9 +1926,10 @@ equivalent to C<@a.unshift("blah")>.
1883
1926
1884
1927
= item untie VARIABLE
1885
1928
1886
- [NEEDS FURTHER RESEARCH] Functions for tying variables seem to be replaced in
1887
- Perl 6 by container types, as mentioned in S29. This has become no clearer
1888
- since I wrote the entry for C < tie > , above.
1929
+ Not supported in Perl 6, but see L < tie > for the whole story.
1930
+
1931
+ The Perl 6 ecosystem has a module C < P5tie > which exports a C < untie >
1932
+ function that mimics the original Perl 5 behaviour as much as possible.
1889
1933
1890
1934
= head2 use
1891
1935
@@ -1920,14 +1964,18 @@ No equivalent.
1920
1964
Available in Perl 6. Can also be used as a method. C < values %hash > is
1921
1965
equivalent to C < %hash.values > .
1922
1966
1923
-
1924
1967
= head2 vec
1925
1968
1926
1969
= item vec EXPR, OFFSET, BITS
1927
1970
1971
+ There is no support for vec() in Perl 6.
1972
+
1928
1973
S29 says "Should replace C < vec > with declared buffer/array of C < bit > ,
1929
- C < uint2 > , C < uint4 > , etc." It is unclear, however, that this has actually
1930
- happened.
1974
+ C < uint2 > , C < uint4 > , etc." Support for C < bit > , C < uint2 > , C < uint4 > has not
1975
+ landed yet. But support for C < uint8 > , C < int8 > , C < uint16 > , C < int16 > ,
1976
+ C < uint32 > , C < int32 > , C < uint64 > , C < int64 > as well as the system sized
1977
+ C < uint > and C < int > B < have > landed. In scalar forms, as well as in array
1978
+ and shaped array (aka matrix) forms.
1931
1979
1932
1980
= head2 wait
1933
1981
@@ -2021,7 +2069,7 @@ not advised:
2021
2069
2022
2070
= item warn LIST
2023
2071
2024
- C < warn > throws an exception. To simply print a message to C < $*ERR > , you
2072
+ C < warn > throws a resumable exception. To simply print a message to C < $*ERR > , you
2025
2073
would use the C < note > function. For more on exceptions, see
2026
2074
L < Exceptions|/language/exceptions > .
2027
2075
0 commit comments