Knowledge (XXG)

Moose (Perl)

Source 📝

22: 161:
A class has zero or more method modifiers. These modifiers can apply to its own methods, methods that are inherited from its ancestors or methods that are provided by roles.
265:. As of September 2012 there are 855 modules in 266 distributions in the MooseX namespace. Most of them can be optionally installed with the Task::Moose module. 239:, but unlike some implementations of interfaces they can provide a default implementation. Roles can be applied to individual instances as well as Classes. 172: 151: 207: 236: 43: 176: 65: 1363: 147: 140: 228: 165: 125: 1617: 1512: 1423: 1249: 93: 839:
method on the other hand is not replaced but extended in the subclass, so both methods are run in the correct order.
36: 30: 211: 82: 47: 1466: 96:
language features to Perl 5, and to make object-oriented Perl programming more consistent and less tedious.
1711: 1612: 1764: 133: 1532: 1517: 1418: 155: 89: 1665: 1446: 1265: 215: 109: 1686: 1433: 1356: 113: 1660: 1451: 1255: 1650: 1562: 1491: 1481: 199:
An attribute always has a name, and it may have a number of other defining characteristics.
1735: 1572: 1552: 1391: 203: 1696: 1758: 1742: 1721: 1706: 1691: 1655: 1349: 1577: 1557: 1396: 235:, but are composed horizontally rather than inherited. They are also somewhat like 1716: 1701: 1471: 1461: 1413: 1681: 1627: 1286: 1259: 1542: 1401: 183: 1537: 1527: 1456: 1316: 1586: 1547: 1522: 1441: 1305: 202:
An attribute's characteristics may include a read/write flag, a type,
1632: 1622: 1596: 1591: 1507: 1336: 1582: 232: 1331: 1567: 1486: 1406: 1386: 1372: 262: 86: 1345: 1250:
Raku (programming language) § Object-oriented programming
15: 195:
An attribute is a property of the class that defines it.
1341: 827:
class so the method of the same name defined in the
1674: 1643: 1605: 1500: 1432: 1379: 261:There are a number of Moose extension modules on 164:A class does zero or more roles (also known as 112:(MOP). Using the MOP, Moose provides complete 1357: 1287:"Moose - A postmodern object system for Perl" 8: 1364: 1350: 1342: 1268:, a web application framework using Moose 252:A role has zero or more required methods. 249:A role has zero or more method modifiers. 66:Learn how and when to remove this message 154:from its superclass(es). Moose supports 92:. Its stated purpose is to bring modern 29:This article includes a list of general 1278: 7: 831:class is not invoked in the case of 124:Moose allows a programmer to create 706:"Bad number of arguments" 472:"Bad number of arguments" 243:A role has zero or more attributes. 35:it lacks sufficient corresponding 14: 231:. They perform a similar task as 150:(a.k.a. parent classes). A class 246:A role has zero or more methods. 168:in other programming languages). 20: 273:This is an example of a class 1: 116:for all Moose-using classes. 227:Roles in Moose are based on 1262:framework inspired by Moose 1252:, the inspiration for Moose 842:This is the same using the 94:object-oriented programming 1781: 1730: 146:A class has zero or more 139:A class has zero or more 132:A class has zero or more 1306:Moose extensions on CPAN 848: 283: 81:is an extension of the 50:more precise citations. 156:multiple inheritance 90:programming language 1666:Perl Best Practices 1337:Moose Documentation 1266:Catalyst (software) 216:lazy initialization 110:metaobject protocol 1687:Randal L. Schwartz 114:type introspection 104:Moose is built on 1752: 1751: 1661:Intermediate Perl 1256:Joose (framework) 277:and its subclass 76: 75: 68: 1772: 1651:Programming Perl 1492:Template Toolkit 1366: 1359: 1352: 1343: 1319: 1314: 1308: 1303: 1297: 1296: 1294: 1293: 1283: 1239: 1236: 1233: 1230: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1173: 1170: 1167: 1164: 1161: 1158: 1155: 1152: 1149: 1146: 1143: 1140: 1137: 1134: 1131: 1128: 1125: 1122: 1119: 1116: 1113: 1110: 1107: 1104: 1101: 1098: 1095: 1092: 1089: 1086: 1083: 1080: 1077: 1074: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1029: 1026: 1023: 1020: 1017: 1014: 1011: 1008: 1005: 1002: 999: 996: 993: 990: 987: 984: 981: 978: 975: 972: 969: 966: 963: 960: 957: 954: 951: 948: 945: 942: 939: 936: 933: 930: 927: 924: 921: 918: 915: 912: 909: 906: 903: 900: 897: 894: 891: 888: 885: 882: 879: 876: 873: 870: 867: 864: 861: 858: 855: 852: 845: 838: 834: 830: 826: 822: 815: 812: 809: 806: 803: 800: 797: 794: 791: 788: 785: 782: 779: 776: 773: 770: 767: 764: 761: 758: 755: 752: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 542: 539: 536: 533: 530: 527: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 335: 332: 329: 326: 323: 320: 317: 314: 311: 308: 305: 302: 299: 296: 293: 290: 287: 280: 276: 107: 71: 64: 60: 57: 51: 46:this article by 37:inline citations 24: 23: 16: 1780: 1779: 1775: 1774: 1773: 1771: 1770: 1769: 1755: 1754: 1753: 1748: 1726: 1670: 1639: 1601: 1573:Request Tracker 1496: 1428: 1392:Perl Foundation 1375: 1370: 1328: 1323: 1322: 1315: 1311: 1304: 1300: 1291: 1289: 1285: 1284: 1280: 1275: 1246: 1241: 1240: 1237: 1234: 1231: 1228: 1225: 1222: 1219: 1216: 1213: 1210: 1207: 1204: 1201: 1198: 1195: 1192: 1189: 1186: 1183: 1180: 1177: 1174: 1171: 1168: 1165: 1162: 1159: 1156: 1153: 1150: 1147: 1144: 1141: 1138: 1135: 1132: 1129: 1126: 1123: 1120: 1117: 1114: 1111: 1108: 1105: 1102: 1099: 1096: 1093: 1090: 1087: 1084: 1081: 1078: 1075: 1072: 1069: 1066: 1063: 1060: 1057: 1054: 1051: 1048: 1045: 1042: 1039: 1036: 1033: 1030: 1027: 1024: 1021: 1018: 1015: 1012: 1009: 1006: 1003: 1000: 997: 994: 991: 988: 985: 982: 979: 976: 973: 970: 967: 964: 961: 958: 955: 952: 949: 946: 943: 940: 937: 934: 931: 928: 925: 922: 919: 916: 913: 910: 907: 904: 901: 898: 895: 892: 889: 886: 883: 880: 877: 874: 871: 868: 865: 862: 859: 856: 854:MooseX::Declare 853: 850: 844:MooseX::Declare 843: 836: 835:instances. The 832: 828: 824: 820: 819:There is a new 817: 816: 813: 810: 807: 804: 801: 798: 795: 792: 789: 786: 783: 780: 777: 774: 771: 768: 765: 762: 759: 756: 753: 750: 747: 744: 741: 738: 735: 732: 729: 726: 723: 720: 717: 714: 711: 708: 705: 702: 699: 696: 693: 690: 687: 684: 681: 678: 675: 672: 669: 666: 663: 660: 657: 654: 651: 648: 645: 642: 639: 636: 634:'clear' 633: 630: 627: 624: 621: 618: 615: 612: 609: 606: 603: 600: 597: 594: 591: 589:'Point' 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 558: 555: 552: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 375: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 336: 333: 330: 327: 324: 321: 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 278: 274: 271: 259: 225: 204:accessor method 193: 122: 105: 102: 72: 61: 55: 52: 42:Please help to 41: 25: 21: 12: 11: 5: 1778: 1776: 1768: 1767: 1757: 1756: 1750: 1749: 1747: 1746: 1739: 1731: 1728: 1727: 1725: 1724: 1719: 1714: 1709: 1704: 1699: 1697:Allison Randal 1694: 1689: 1684: 1678: 1676: 1672: 1671: 1669: 1668: 1663: 1658: 1653: 1647: 1645: 1641: 1640: 1638: 1637: 1636: 1635: 1630: 1625: 1615: 1609: 1607: 1603: 1602: 1600: 1599: 1594: 1589: 1580: 1575: 1570: 1565: 1560: 1555: 1550: 1545: 1540: 1535: 1530: 1525: 1520: 1515: 1510: 1504: 1502: 1498: 1497: 1495: 1494: 1489: 1484: 1479: 1474: 1469: 1464: 1459: 1454: 1449: 1444: 1438: 1436: 1430: 1429: 1427: 1426: 1421: 1416: 1411: 1410: 1409: 1404: 1399: 1389: 1383: 1381: 1377: 1376: 1371: 1369: 1368: 1361: 1354: 1346: 1340: 1339: 1334: 1332:Moose Homepage 1327: 1326:External links 1324: 1321: 1320: 1309: 1298: 1277: 1276: 1274: 1271: 1270: 1269: 1263: 1253: 1245: 1242: 849: 823:method in the 284: 270: 267: 258: 255: 254: 253: 250: 247: 244: 224: 221: 220: 219: 200: 192: 189: 188: 187: 182:A class has a 180: 171:A class has a 169: 162: 159: 144: 137: 121: 118: 101: 98: 85:system of the 74: 73: 28: 26: 19: 13: 10: 9: 6: 4: 3: 2: 1777: 1766: 1763: 1762: 1760: 1745: 1744: 1740: 1738: 1737: 1733: 1732: 1729: 1723: 1722:Jesse Vincent 1720: 1718: 1715: 1713: 1710: 1708: 1707:Sean M. Burke 1705: 1703: 1700: 1698: 1695: 1693: 1692:Damian Conway 1690: 1688: 1685: 1683: 1680: 1679: 1677: 1673: 1667: 1664: 1662: 1659: 1657: 1656:Learning Perl 1654: 1652: 1649: 1648: 1646: 1642: 1634: 1631: 1629: 1626: 1624: 1621: 1620: 1619: 1616: 1614: 1611: 1610: 1608: 1604: 1598: 1595: 1593: 1590: 1588: 1584: 1581: 1579: 1576: 1574: 1571: 1569: 1566: 1564: 1561: 1559: 1556: 1554: 1551: 1549: 1546: 1544: 1541: 1539: 1536: 1534: 1531: 1529: 1526: 1524: 1521: 1519: 1516: 1514: 1511: 1509: 1506: 1505: 1503: 1499: 1493: 1490: 1488: 1485: 1483: 1480: 1478: 1475: 1473: 1470: 1468: 1465: 1463: 1460: 1458: 1455: 1453: 1450: 1448: 1445: 1443: 1440: 1439: 1437: 1435: 1431: 1425: 1422: 1420: 1417: 1415: 1412: 1408: 1405: 1403: 1400: 1398: 1395: 1394: 1393: 1390: 1388: 1385: 1384: 1382: 1378: 1374: 1367: 1362: 1360: 1355: 1353: 1348: 1347: 1344: 1338: 1335: 1333: 1330: 1329: 1325: 1318: 1313: 1310: 1307: 1302: 1299: 1288: 1282: 1279: 1272: 1267: 1264: 1261: 1257: 1254: 1251: 1248: 1247: 1243: 1094:'Num' 923:'Num' 887:'Num' 847: 840: 613:'Num' 367:'Num' 331:'Num' 282: 268: 266: 264: 256: 251: 248: 245: 242: 241: 240: 238: 234: 230: 222: 217: 213: 209: 205: 201: 198: 197: 196: 190: 185: 181: 178: 174: 170: 167: 163: 160: 157: 153: 149: 145: 142: 138: 135: 131: 130: 129: 127: 119: 117: 115: 111: 99: 97: 95: 91: 88: 84: 80: 70: 67: 59: 49: 45: 39: 38: 32: 27: 18: 17: 1765:Perl modules 1741: 1734: 1578:SpamAssassin 1558:Movable Type 1476: 1397:Perl Mongers 1312: 1301: 1290:. Retrieved 1281: 1106:'rw' 935:'rw' 899:'rw' 841: 818: 625:'rw' 379:'rw' 343:'rw' 272: 260: 226: 194: 148:superclasses 123: 103: 78: 77: 62: 53: 34: 1717:brian d foy 1702:Audrey Tang 1472:Mojolicious 1462:DBIx::Class 1317:Task::Moose 1079:'z' 908:'y' 872:'x' 846:extension: 598:'z' 352:'y' 316:'x' 208:delegations 173:constructor 48:introducing 1682:Larry Wall 1434:Frameworks 1292:2017-03-06 1273:References 1260:JavaScript 257:Extensions 237:interfaces 214:value and 191:Attributes 177:destructor 134:attributes 106:Class::MOP 31:references 1712:chromatic 1543:Dada Mail 1533:Bricolage 1402:PerlMonks 184:metaclass 1759:Category 1743:Category 1538:Bugzilla 1528:BackupPC 1501:Software 1447:Catalyst 1407:archives 1244:See also 821:set_to() 269:Examples 152:inherits 100:Features 56:May 2010 1736:Outline 1606:Related 1587:Foswiki 1548:ikiwiki 1523:AWStats 1442:BioPerl 1419:Perl VM 1067:extends 1064:Point3D 837:clear() 833:Point3D 825:Point3D 586:extends 562:Point3D 559:package 286:package 279:Point3D 212:default 206:names, 141:methods 126:classes 120:Classes 44:improve 1675:People 1633:MoarVM 1623:Rakudo 1613:Parrot 1597:Webmin 1592:W3Perl 1553:Makepp 1508:Amavis 1452:Dancer 1414:module 1380:Things 1217:$ self 1199:$ self 1181:$ self 1145:set_to 1142:method 1121:$ self 1037:$ self 1019:$ self 992:set_to 989:method 968:$ self 950:$ self 941:method 796:$ self 778:$ self 760:$ self 715:$ self 685:set_to 661:$ self 649:$ self 538:$ self 520:$ self 481:$ self 451:set_to 427:$ self 409:$ self 397:$ self 233:mixins 229:traits 175:and a 166:traits 83:object 33:, but 1644:Books 1628:rules 1583:TWiki 1563:Munin 1513:Argus 1482:Plack 1477:Moose 1220:-> 1202:-> 1184:-> 1124:-> 1115:clear 1112:after 1103:=> 1091:=> 1082:=> 1070:Point 1061:class 1040:-> 1022:-> 971:-> 953:-> 944:clear 932:=> 920:=> 911:=> 896:=> 884:=> 875:=> 863:Point 860:class 829:Point 799:-> 781:-> 763:-> 721:shift 703:croak 664:-> 655:shift 637:=> 631:after 622:=> 610:=> 601:=> 571:Moose 541:-> 523:-> 487:shift 469:croak 430:-> 412:-> 403:shift 388:clear 376:=> 364:=> 355:=> 340:=> 328:=> 319:=> 298:Moose 289:Point 275:Point 223:Roles 79:Moose 1618:Raku 1568:OTRS 1518:@SSP 1487:PSGI 1424:YAPC 1387:CPAN 1373:Perl 1258:, a 580:Carp 307:Carp 263:CPAN 210:, a 108:, a 87:Perl 1467:LWP 1457:DBI 1229:$ z 1211:$ y 1193:$ x 1172:$ z 1169:Num 1163:$ y 1160:Num 1154:$ x 1151:Num 1088:isa 1076:has 1049:$ y 1031:$ x 1010:$ y 1007:Num 1001:$ x 998:Num 917:isa 905:has 881:isa 869:has 851:use 808:$ z 790:$ y 772:$ x 745:$ z 739:$ y 733:$ x 682:sub 640:sub 607:isa 595:has 577:use 568:use 550:$ y 532:$ x 505:$ y 499:$ x 448:sub 385:sub 361:isa 349:has 325:isa 313:has 304:use 295:use 1761:: 1232:); 1214:); 1196:); 1136:); 1109:); 1100:is 1052:); 1034:); 983:); 965:); 938:); 929:is 902:); 893:is 811:); 793:); 775:); 754:@_ 727:my 712:my 700:or 694:== 691:@_ 679:}; 676:); 646:my 628:); 619:is 553:); 535:); 514:@_ 493:my 478:my 466:or 460:== 457:@_ 442:); 424:); 394:my 382:); 373:is 346:); 337:is 281:: 128:: 1585:/ 1365:e 1358:t 1351:v 1295:. 1238:} 1235:} 1226:( 1223:z 1208:( 1205:y 1190:( 1187:x 1178:{ 1175:) 1166:, 1157:, 1148:( 1139:} 1133:0 1130:( 1127:z 1118:{ 1097:, 1085:( 1073:{ 1058:} 1055:} 1046:( 1043:y 1028:( 1025:x 1016:{ 1013:) 1004:, 995:( 986:} 980:0 977:( 974:y 962:0 959:( 956:x 947:{ 926:, 914:( 890:, 878:( 866:{ 857:; 814:} 805:( 802:z 787:( 784:y 769:( 766:x 757:; 751:= 748:) 742:, 736:, 730:( 724:; 718:= 709:; 697:4 688:{ 673:0 670:( 667:z 658:; 652:= 643:{ 616:, 604:( 592:; 583:; 574:; 565:; 556:} 547:( 544:y 529:( 526:x 517:; 511:= 508:) 502:, 496:( 490:; 484:= 475:; 463:3 454:{ 445:} 439:0 436:( 433:y 421:0 418:( 415:x 406:; 400:= 391:{ 370:, 358:( 334:, 322:( 310:; 301:; 292:; 218:. 186:. 179:. 158:. 143:. 136:. 69:) 63:( 58:) 54:( 40:.

Index

references
inline citations
improve
introducing
Learn how and when to remove this message
object
Perl
programming language
object-oriented programming
metaobject protocol
type introspection
classes
attributes
methods
superclasses
inherits
multiple inheritance
traits
constructor
destructor
metaclass
accessor method
delegations
default
lazy initialization
traits
mixins
interfaces
CPAN
Raku (programming language) § Object-oriented programming

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.