├── .gitignore ├── .mailmap ├── .travis.yml ├── CONTRIBUTING.pod ├── Changes ├── Changes.Class-MOP ├── LICENSE ├── Makefile.PL ├── README.md ├── TODO ├── author ├── doc-generator ├── extract-inline-tests └── find-dupe-test-numbers ├── benchmarks ├── caf_vs_moose.pl ├── cmop │ ├── all.yml │ ├── foo.pl │ ├── lib │ │ ├── Bench │ │ │ ├── Accessor.pm │ │ │ ├── Construct.pm │ │ │ └── Run.pm │ │ ├── MOP │ │ │ ├── Immutable │ │ │ │ ├── Point.pm │ │ │ │ └── Point3D.pm │ │ │ ├── Installed │ │ │ │ ├── Point.pm │ │ │ │ └── Point3D.pm │ │ │ ├── Point.pm │ │ │ └── Point3D.pm │ │ └── Plain │ │ │ ├── Point.pm │ │ │ └── Point3D.pm │ ├── loading-benchmark.pl │ ├── profile.pl │ └── run_yml.pl ├── immutable.pl ├── lotsa-classes.pl ├── method_modifiers.pl ├── moose_bench.pl ├── simple_class.pl ├── simple_compile.pl ├── simple_constructor.pl ├── type_constraints.pl └── type_constraints2.pl ├── dist.ini ├── doc └── moosex-compile ├── inc ├── CheckAuthorDeps.pm ├── CheckDelta.pm ├── CheckReleaseType.pm ├── Clean.pm ├── Documentation.pm ├── ExtractInlineTests.pm ├── GenerateDocs.pm ├── GitUpToDate.pm ├── MMHelper.pm ├── MakeMaker.pm ├── MyInline.pm ├── SimpleAuthority.pm ├── SimpleProvides.pm └── TestRelease.pm ├── lib ├── Class │ ├── MOP.pm │ └── MOP │ │ ├── Attribute.pm │ │ ├── Class.pm │ │ ├── Class │ │ └── Immutable │ │ │ └── Trait.pm │ │ ├── Deprecated.pm │ │ ├── Instance.pm │ │ ├── Method.pm │ │ ├── Method │ │ ├── Accessor.pm │ │ ├── Constructor.pm │ │ ├── Generated.pm │ │ ├── Inlined.pm │ │ ├── Meta.pm │ │ └── Wrapped.pm │ │ ├── MiniTrait.pm │ │ ├── Mixin.pm │ │ ├── Mixin │ │ ├── AttributeCore.pm │ │ ├── HasAttributes.pm │ │ ├── HasMethods.pm │ │ └── HasOverloads.pm │ │ ├── Module.pm │ │ ├── Object.pm │ │ ├── Overload.pm │ │ └── Package.pm ├── Moose.pm ├── Moose │ ├── Cookbook.pod │ ├── Cookbook │ │ ├── Basics │ │ │ ├── BankAccount_MethodModifiersAndSubclassing.pod │ │ │ ├── BinaryTree_AttributeFeatures.pod │ │ │ ├── BinaryTree_BuilderAndLazyBuild.pod │ │ │ ├── Company_Subtypes.pod │ │ │ ├── DateTime_ExtendingNonMooseParent.pod │ │ │ ├── Document_AugmentAndInner.pod │ │ │ ├── Genome_OverloadingSubtypesAndCoercion.pod │ │ │ ├── HTTP_SubtypesAndCoercion.pod │ │ │ ├── Immutable.pod │ │ │ ├── Person_BUILDARGSAndBUILD.pod │ │ │ └── Point_AttributesAndSubclassing.pod │ │ ├── Extending │ │ │ ├── Debugging_BaseClassRole.pod │ │ │ ├── ExtensionOverview.pod │ │ │ └── Mooseish_MooseSugar.pod │ │ ├── Legacy │ │ │ ├── Debugging_BaseClassReplacement.pod │ │ │ ├── Labeled_AttributeMetaclass.pod │ │ │ └── Table_ClassMetaclass.pod │ │ ├── Meta │ │ │ ├── GlobRef_InstanceMetaclass.pod │ │ │ ├── Labeled_AttributeTrait.pod │ │ │ ├── PrivateOrPublic_MethodMetaclass.pod │ │ │ ├── Table_MetaclassTrait.pod │ │ │ └── WhyMeta.pod │ │ ├── Roles │ │ │ ├── ApplicationToInstance.pod │ │ │ ├── Comparable_CodeReuse.pod │ │ │ └── Restartable_AdvancedComposition.pod │ │ ├── Snack │ │ │ ├── Keywords.pod │ │ │ └── Types.pod │ │ └── Style.pod │ ├── Deprecated.pm │ ├── Exception.pm │ ├── Exception │ │ ├── AccessorMustReadWrite.pm │ │ ├── AddParameterizableTypeTakesParameterizableType.pm │ │ ├── AddRoleTakesAMooseMetaRoleInstance.pm │ │ ├── AddRoleToARoleTakesAMooseMetaRole.pm │ │ ├── ApplyTakesABlessedInstance.pm │ │ ├── AttachToClassNeedsAClassMOPClassInstanceOrASubclass.pm │ │ ├── AttributeConflictInRoles.pm │ │ ├── AttributeConflictInSummation.pm │ │ ├── AttributeExtensionIsNotSupportedInRoles.pm │ │ ├── AttributeIsRequired.pm │ │ ├── AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass.pm │ │ ├── AttributeNamesDoNotMatch.pm │ │ ├── AttributeValueIsNotAnObject.pm │ │ ├── AttributeValueIsNotDefined.pm │ │ ├── AutoDeRefNeedsArrayRefOrHashRef.pm │ │ ├── BadOptionFormat.pm │ │ ├── BothBuilderAndDefaultAreNotAllowed.pm │ │ ├── BuilderDoesNotExist.pm │ │ ├── BuilderMethodNotSupportedForAttribute.pm │ │ ├── BuilderMethodNotSupportedForInlineAttribute.pm │ │ ├── BuilderMustBeAMethodName.pm │ │ ├── CallingMethodOnAnImmutableInstance.pm │ │ ├── CallingReadOnlyMethodOnAnImmutableInstance.pm │ │ ├── CanExtendOnlyClasses.pm │ │ ├── CanOnlyConsumeRole.pm │ │ ├── CanOnlyWrapBlessedCode.pm │ │ ├── CanReblessOnlyIntoASubclass.pm │ │ ├── CanReblessOnlyIntoASuperclass.pm │ │ ├── CannotAddAdditionalTypeCoercionsToUnion.pm │ │ ├── CannotAddAsAnAttributeToARole.pm │ │ ├── CannotApplyBaseClassRolesToRole.pm │ │ ├── CannotAssignValueToReadOnlyAccessor.pm │ │ ├── CannotAugmentIfLocalMethodPresent.pm │ │ ├── CannotAugmentNoSuperMethod.pm │ │ ├── CannotAutoDerefWithoutIsa.pm │ │ ├── CannotAutoDereferenceTypeConstraint.pm │ │ ├── CannotCalculateNativeType.pm │ │ ├── CannotCallAnAbstractBaseMethod.pm │ │ ├── CannotCallAnAbstractMethod.pm │ │ ├── CannotCoerceAWeakRef.pm │ │ ├── CannotCoerceAttributeWhichHasNoCoercion.pm │ │ ├── CannotCreateHigherOrderTypeWithoutATypeParameter.pm │ │ ├── CannotCreateMethodAliasLocalMethodIsPresent.pm │ │ ├── CannotCreateMethodAliasLocalMethodIsPresentInClass.pm │ │ ├── CannotDelegateLocalMethodIsPresent.pm │ │ ├── CannotDelegateWithoutIsa.pm │ │ ├── CannotFindDelegateMetaclass.pm │ │ ├── CannotFindType.pm │ │ ├── CannotFindTypeGivenToMatchOnType.pm │ │ ├── CannotFixMetaclassCompatibility.pm │ │ ├── CannotGenerateInlineConstraint.pm │ │ ├── CannotInitializeMooseMetaRoleComposite.pm │ │ ├── CannotInlineTypeConstraintCheck.pm │ │ ├── CannotLocatePackageInINC.pm │ │ ├── CannotMakeMetaclassCompatible.pm │ │ ├── CannotOverrideALocalMethod.pm │ │ ├── CannotOverrideBodyOfMetaMethods.pm │ │ ├── CannotOverrideLocalMethodIsPresent.pm │ │ ├── CannotOverrideNoSuperMethod.pm │ │ ├── CannotRegisterUnnamedTypeConstraint.pm │ │ ├── CannotUseLazyBuildAndDefaultSimultaneously.pm │ │ ├── CircularReferenceInAlso.pm │ │ ├── ClassDoesNotHaveInitMeta.pm │ │ ├── ClassDoesTheExcludedRole.pm │ │ ├── ClassNamesDoNotMatch.pm │ │ ├── CloneObjectExpectsAnInstanceOfMetaclass.pm │ │ ├── CodeBlockMustBeACodeRef.pm │ │ ├── CoercingWithoutCoercions.pm │ │ ├── CoercionAlreadyExists.pm │ │ ├── CoercionNeedsTypeConstraint.pm │ │ ├── ConflictDetectedInCheckRoleExclusions.pm │ │ ├── ConflictDetectedInCheckRoleExclusionsInToClass.pm │ │ ├── ConstructClassInstanceTakesPackageName.pm │ │ ├── CouldNotCreateMethod.pm │ │ ├── CouldNotCreateWriter.pm │ │ ├── CouldNotEvalConstructor.pm │ │ ├── CouldNotEvalDestructor.pm │ │ ├── CouldNotFindTypeConstraintToCoerceFrom.pm │ │ ├── CouldNotGenerateInlineAttributeMethod.pm │ │ ├── CouldNotLocateTypeConstraintForUnion.pm │ │ ├── CouldNotParseType.pm │ │ ├── CreateMOPClassTakesArrayRefOfAttributes.pm │ │ ├── CreateMOPClassTakesArrayRefOfSuperclasses.pm │ │ ├── CreateMOPClassTakesHashRefOfMethods.pm │ │ ├── CreateTakesArrayRefOfRoles.pm │ │ ├── CreateTakesHashRefOfAttributes.pm │ │ ├── CreateTakesHashRefOfMethods.pm │ │ ├── DefaultToMatchOnTypeMustBeCodeRef.pm │ │ ├── DelegationToAClassWhichIsNotLoaded.pm │ │ ├── DelegationToARoleWhichIsNotLoaded.pm │ │ ├── DelegationToATypeWhichIsNotAClass.pm │ │ ├── DoesRequiresRoleName.pm │ │ ├── EnumCalledWithAnArrayRefAndAdditionalArgs.pm │ │ ├── EnumValuesMustBeString.pm │ │ ├── ExtendsMissingArgs.pm │ │ ├── HandlesMustBeAHashRef.pm │ │ ├── IllegalInheritedOptions.pm │ │ ├── IllegalMethodTypeToAddMethodModifier.pm │ │ ├── IncompatibleMetaclassOfSuperclass.pm │ │ ├── InitMetaRequiresClass.pm │ │ ├── InitializeTakesUnBlessedPackageName.pm │ │ ├── InstanceBlessedIntoWrongClass.pm │ │ ├── InstanceMustBeABlessedReference.pm │ │ ├── InvalidArgPassedToMooseUtilMetaRole.pm │ │ ├── InvalidArgumentToMethod.pm │ │ ├── InvalidArgumentsToTraitAliases.pm │ │ ├── InvalidBaseTypeGivenToCreateParameterizedTypeConstraint.pm │ │ ├── InvalidHandleValue.pm │ │ ├── InvalidHasProvidedInARole.pm │ │ ├── InvalidNameForType.pm │ │ ├── InvalidOverloadOperator.pm │ │ ├── InvalidRoleApplication.pm │ │ ├── InvalidTypeConstraint.pm │ │ ├── InvalidTypeGivenToCreateParameterizedTypeConstraint.pm │ │ ├── InvalidValueForIs.pm │ │ ├── IsaDoesNotDoTheRole.pm │ │ ├── IsaLacksDoesMethod.pm │ │ ├── LazyAttributeNeedsADefault.pm │ │ ├── Legacy.pm │ │ ├── MOPAttributeNewNeedsAttributeName.pm │ │ ├── MatchActionMustBeACodeRef.pm │ │ ├── MessageParameterMustBeCodeRef.pm │ │ ├── MetaclassIsAClassNotASubclassOfGivenMetaclass.pm │ │ ├── MetaclassIsARoleNotASubclassOfGivenMetaclass.pm │ │ ├── MetaclassIsNotASubclassOfGivenMetaclass.pm │ │ ├── MetaclassMustBeASubclassOfMooseMetaClass.pm │ │ ├── MetaclassMustBeASubclassOfMooseMetaRole.pm │ │ ├── MetaclassMustBeDerivedFromClassMOPClass.pm │ │ ├── MetaclassNotLoaded.pm │ │ ├── MetaclassTypeIncompatible.pm │ │ ├── MethodExpectedAMetaclassObject.pm │ │ ├── MethodExpectsFewerArgs.pm │ │ ├── MethodExpectsMoreArgs.pm │ │ ├── MethodModifierNeedsMethodName.pm │ │ ├── MethodNameConflictInRoles.pm │ │ ├── MethodNameNotFoundInInheritanceHierarchy.pm │ │ ├── MethodNameNotGiven.pm │ │ ├── MustDefineAMethodName.pm │ │ ├── MustDefineAnAttributeName.pm │ │ ├── MustDefineAnOverloadOperator.pm │ │ ├── MustHaveAtLeastOneValueToEnumerate.pm │ │ ├── MustPassAHashOfOptions.pm │ │ ├── MustPassAMooseMetaRoleInstanceOrSubclass.pm │ │ ├── MustPassAPackageNameOrAnExistingClassMOPPackageInstance.pm │ │ ├── MustPassEvenNumberOfArguments.pm │ │ ├── MustPassEvenNumberOfAttributeOptions.pm │ │ ├── MustProvideANameForTheAttribute.pm │ │ ├── MustSpecifyAtleastOneMethod.pm │ │ ├── MustSpecifyAtleastOneRole.pm │ │ ├── MustSpecifyAtleastOneRoleToApplicant.pm │ │ ├── MustSupplyAClassMOPAttributeInstance.pm │ │ ├── MustSupplyADelegateToMethod.pm │ │ ├── MustSupplyAMetaclass.pm │ │ ├── MustSupplyAMooseMetaAttributeInstance.pm │ │ ├── MustSupplyAnAccessorTypeToConstructWith.pm │ │ ├── MustSupplyAnAttributeToConstructWith.pm │ │ ├── MustSupplyArrayRefAsCurriedArguments.pm │ │ ├── MustSupplyPackageNameAndName.pm │ │ ├── NeedsTypeConstraintUnionForTypeCoercionUnion.pm │ │ ├── NeitherAttributeNorAttributeNameIsGiven.pm │ │ ├── NeitherClassNorClassNameIsGiven.pm │ │ ├── NeitherRoleNorRoleNameIsGiven.pm │ │ ├── NeitherTypeNorTypeNameIsGiven.pm │ │ ├── NoAttributeFoundInSuperClass.pm │ │ ├── NoBodyToInitializeInAnAbstractBaseClass.pm │ │ ├── NoCasesMatched.pm │ │ ├── NoConstraintCheckForTypeConstraint.pm │ │ ├── NoDestructorClassSpecified.pm │ │ ├── NoImmutableTraitSpecifiedForClass.pm │ │ ├── NoParentGivenToSubtype.pm │ │ ├── OnlyInstancesCanBeCloned.pm │ │ ├── OperatorIsRequired.pm │ │ ├── OverloadConflictInSummation.pm │ │ ├── OverloadRequiresAMetaClass.pm │ │ ├── OverloadRequiresAMetaMethod.pm │ │ ├── OverloadRequiresAMetaOverload.pm │ │ ├── OverloadRequiresAMethodNameOrCoderef.pm │ │ ├── OverloadRequiresAnOperator.pm │ │ ├── OverloadRequiresNamesForCoderef.pm │ │ ├── OverrideConflictInComposition.pm │ │ ├── OverrideConflictInSummation.pm │ │ ├── PackageDoesNotUseMooseExporter.pm │ │ ├── PackageNameAndNameParamsNotGivenToWrap.pm │ │ ├── PackagesAndModulesAreNotCachable.pm │ │ ├── ParameterIsNotSubtypeOfParent.pm │ │ ├── ReferencesAreNotAllowedAsDefault.pm │ │ ├── RequiredAttributeLacksInitialization.pm │ │ ├── RequiredAttributeNeedsADefault.pm │ │ ├── RequiredMethodsImportedByClass.pm │ │ ├── RequiredMethodsNotImplementedByClass.pm │ │ ├── Role │ │ │ ├── Attribute.pm │ │ │ ├── AttributeName.pm │ │ │ ├── Class.pm │ │ │ ├── EitherAttributeOrAttributeName.pm │ │ │ ├── Instance.pm │ │ │ ├── InstanceClass.pm │ │ │ ├── InvalidAttributeOptions.pm │ │ │ ├── Method.pm │ │ │ ├── ParamsHash.pm │ │ │ ├── Role.pm │ │ │ ├── RoleForCreate.pm │ │ │ ├── RoleForCreateMOPClass.pm │ │ │ └── TypeConstraint.pm │ │ ├── RoleDoesTheExcludedRole.pm │ │ ├── RoleExclusionConflict.pm │ │ ├── RoleNameRequired.pm │ │ ├── RoleNameRequiredForMooseMetaRole.pm │ │ ├── RolesDoNotSupportAugment.pm │ │ ├── RolesDoNotSupportExtends.pm │ │ ├── RolesDoNotSupportInner.pm │ │ ├── RolesDoNotSupportRegexReferencesForMethodModifiers.pm │ │ ├── RolesInCreateTakesAnArrayRef.pm │ │ ├── RolesListMustBeInstancesOfMooseMetaRole.pm │ │ ├── SingleParamsToNewMustBeHashRef.pm │ │ ├── TriggerMustBeACodeRef.pm │ │ ├── TypeConstraintCannotBeUsedForAParameterizableType.pm │ │ ├── TypeConstraintIsAlreadyCreated.pm │ │ ├── TypeParameterMustBeMooseMetaType.pm │ │ ├── UnableToCanonicalizeHandles.pm │ │ ├── UnableToCanonicalizeNonRolePackage.pm │ │ ├── UnableToRecognizeDelegateMetaclass.pm │ │ ├── UndefinedHashKeysPassedToMethod.pm │ │ ├── UnionCalledWithAnArrayRefAndAdditionalArgs.pm │ │ ├── UnionTakesAtleastTwoTypeNames.pm │ │ ├── ValidationFailedForInlineTypeConstraint.pm │ │ ├── ValidationFailedForTypeConstraint.pm │ │ ├── WrapTakesACodeRefToBless.pm │ │ └── WrongTypeConstraintGiven.pm │ ├── Exporter.pm │ ├── Intro.pod │ ├── Manual.pod │ ├── Manual │ │ ├── Attributes.pod │ │ ├── BestPractices.pod │ │ ├── Classes.pod │ │ ├── Concepts.pod │ │ ├── Construction.pod │ │ ├── Contributing.pod │ │ ├── Delegation.pod │ │ ├── Delta.pod │ │ ├── Exceptions.pod │ │ ├── FAQ.pod │ │ ├── MOP.pod │ │ ├── MethodModifiers.pod │ │ ├── MooseX.pod │ │ ├── Resources.pod │ │ ├── Roles.pod │ │ ├── Support.pod │ │ ├── Types.pod │ │ └── Unsweetened.pod │ ├── Meta │ │ ├── Attribute.pm │ │ ├── Attribute │ │ │ ├── Native.pm │ │ │ └── Native │ │ │ │ ├── Trait.pm │ │ │ │ └── Trait │ │ │ │ ├── Array.pm │ │ │ │ ├── Bool.pm │ │ │ │ ├── Code.pm │ │ │ │ ├── Counter.pm │ │ │ │ ├── Hash.pm │ │ │ │ ├── Number.pm │ │ │ │ └── String.pm │ │ ├── Class.pm │ │ ├── Class │ │ │ └── Immutable │ │ │ │ └── Trait.pm │ │ ├── Instance.pm │ │ ├── Method.pm │ │ ├── Method │ │ │ ├── Accessor.pm │ │ │ ├── Accessor │ │ │ │ ├── Native.pm │ │ │ │ └── Native │ │ │ │ │ ├── Array.pm │ │ │ │ │ ├── Array │ │ │ │ │ ├── Writer.pm │ │ │ │ │ ├── accessor.pm │ │ │ │ │ ├── clear.pm │ │ │ │ │ ├── count.pm │ │ │ │ │ ├── delete.pm │ │ │ │ │ ├── elements.pm │ │ │ │ │ ├── first.pm │ │ │ │ │ ├── first_index.pm │ │ │ │ │ ├── get.pm │ │ │ │ │ ├── grep.pm │ │ │ │ │ ├── insert.pm │ │ │ │ │ ├── is_empty.pm │ │ │ │ │ ├── join.pm │ │ │ │ │ ├── map.pm │ │ │ │ │ ├── natatime.pm │ │ │ │ │ ├── pop.pm │ │ │ │ │ ├── push.pm │ │ │ │ │ ├── reduce.pm │ │ │ │ │ ├── set.pm │ │ │ │ │ ├── shallow_clone.pm │ │ │ │ │ ├── shift.pm │ │ │ │ │ ├── shuffle.pm │ │ │ │ │ ├── sort.pm │ │ │ │ │ ├── sort_in_place.pm │ │ │ │ │ ├── splice.pm │ │ │ │ │ ├── uniq.pm │ │ │ │ │ └── unshift.pm │ │ │ │ │ ├── Bool │ │ │ │ │ ├── not.pm │ │ │ │ │ ├── set.pm │ │ │ │ │ ├── toggle.pm │ │ │ │ │ └── unset.pm │ │ │ │ │ ├── Code │ │ │ │ │ ├── execute.pm │ │ │ │ │ └── execute_method.pm │ │ │ │ │ ├── Collection.pm │ │ │ │ │ ├── Counter │ │ │ │ │ ├── Writer.pm │ │ │ │ │ ├── dec.pm │ │ │ │ │ ├── inc.pm │ │ │ │ │ ├── reset.pm │ │ │ │ │ └── set.pm │ │ │ │ │ ├── Hash.pm │ │ │ │ │ ├── Hash │ │ │ │ │ ├── Writer.pm │ │ │ │ │ ├── accessor.pm │ │ │ │ │ ├── clear.pm │ │ │ │ │ ├── count.pm │ │ │ │ │ ├── defined.pm │ │ │ │ │ ├── delete.pm │ │ │ │ │ ├── elements.pm │ │ │ │ │ ├── exists.pm │ │ │ │ │ ├── get.pm │ │ │ │ │ ├── is_empty.pm │ │ │ │ │ ├── keys.pm │ │ │ │ │ ├── kv.pm │ │ │ │ │ ├── set.pm │ │ │ │ │ ├── shallow_clone.pm │ │ │ │ │ └── values.pm │ │ │ │ │ ├── Number │ │ │ │ │ ├── abs.pm │ │ │ │ │ ├── add.pm │ │ │ │ │ ├── div.pm │ │ │ │ │ ├── mod.pm │ │ │ │ │ ├── mul.pm │ │ │ │ │ ├── set.pm │ │ │ │ │ └── sub.pm │ │ │ │ │ ├── Reader.pm │ │ │ │ │ ├── String │ │ │ │ │ ├── append.pm │ │ │ │ │ ├── chomp.pm │ │ │ │ │ ├── chop.pm │ │ │ │ │ ├── clear.pm │ │ │ │ │ ├── inc.pm │ │ │ │ │ ├── length.pm │ │ │ │ │ ├── match.pm │ │ │ │ │ ├── prepend.pm │ │ │ │ │ ├── replace.pm │ │ │ │ │ └── substr.pm │ │ │ │ │ └── Writer.pm │ │ │ ├── Augmented.pm │ │ │ ├── Constructor.pm │ │ │ ├── Delegation.pm │ │ │ ├── Destructor.pm │ │ │ ├── Meta.pm │ │ │ └── Overridden.pm │ │ ├── Mixin │ │ │ └── AttributeCore.pm │ │ ├── Object │ │ │ └── Trait.pm │ │ ├── Role.pm │ │ ├── Role │ │ │ ├── Application.pm │ │ │ ├── Application │ │ │ │ ├── RoleSummation.pm │ │ │ │ ├── ToClass.pm │ │ │ │ ├── ToInstance.pm │ │ │ │ └── ToRole.pm │ │ │ ├── Attribute.pm │ │ │ ├── Composite.pm │ │ │ ├── Method.pm │ │ │ └── Method │ │ │ │ ├── Conflicting.pm │ │ │ │ └── Required.pm │ │ ├── TypeCoercion.pm │ │ ├── TypeCoercion │ │ │ └── Union.pm │ │ ├── TypeConstraint.pm │ │ └── TypeConstraint │ │ │ ├── Class.pm │ │ │ ├── DuckType.pm │ │ │ ├── Enum.pm │ │ │ ├── Parameterizable.pm │ │ │ ├── Parameterized.pm │ │ │ ├── Registry.pm │ │ │ ├── Role.pm │ │ │ └── Union.pm │ ├── Object.pm │ ├── Role.pm │ ├── Spec │ │ └── Role.pod │ ├── Unsweetened.pod │ ├── Util.pm │ └── Util │ │ ├── MetaRole.pm │ │ ├── TypeConstraints.pm │ │ └── TypeConstraints │ │ └── Builtins.pm ├── Test │ └── Moose.pm ├── metaclass.pm └── oose.pm ├── mop.c ├── mop.h ├── perltidyrc ├── ppport.h ├── t ├── 000_load.t ├── attributes │ ├── accessor_context.t │ ├── accessor_inlining.t │ ├── accessor_override_method.t │ ├── accessor_overwrite_warning.t │ ├── attr_dereference_test.t │ ├── attribute_accessor_generation.t │ ├── attribute_custom_metaclass.t │ ├── attribute_delegation.t │ ├── attribute_does.t │ ├── attribute_inherited_slot_specs.t │ ├── attribute_lazy_initializer.t │ ├── attribute_names.t │ ├── attribute_reader_generation.t │ ├── attribute_required.t │ ├── attribute_traits.t │ ├── attribute_traits_n_meta.t │ ├── attribute_traits_parameterized.t │ ├── attribute_traits_registered.t │ ├── attribute_triggers.t │ ├── attribute_type_unions.t │ ├── attribute_without_any_methods.t │ ├── attribute_writer_generation.t │ ├── bad_coerce.t │ ├── chained_coercion.t │ ├── clone_weak.t │ ├── default_class_role_types.t │ ├── default_undef.t │ ├── delegation_and_modifiers.t │ ├── delegation_arg_aliasing.t │ ├── delegation_target_not_loaded.t │ ├── illegal_options_for_inheritance.t │ ├── inherit_lazy_build.t │ ├── lazy_no_default.t │ ├── method_generation_rules.t │ ├── misc_attribute_coerce_lazy.t │ ├── misc_attribute_tests.t │ ├── more_attr_delegation.t │ ├── no_init_arg.t │ ├── no_slot_access.t │ ├── non_alpha_attr_names.t │ ├── numeric_defaults.t │ ├── trigger_and_coerce.t │ └── type_constraint.t ├── basics │ ├── always_strict_warnings.t │ ├── basic_class_setup.t │ ├── buildargs.t │ ├── buildargs_warning.t │ ├── create.t │ ├── create_anon.t │ ├── definition_context.t │ ├── deprecations.t │ ├── destruction.t │ ├── error_handling.t │ ├── global-destruction-helper.pl │ ├── global_destruction.t │ ├── import_unimport.t │ ├── inner_and_augment.t │ ├── load_into_main.t │ ├── method_modifier_with_regexp.t │ ├── methods.t │ ├── moose_object_does.t │ ├── moose_respects_type_constraints.t │ ├── override_and_foreign_classes.t │ ├── override_augment_inner_super.t │ ├── rebless.t │ ├── require_superclasses.t │ ├── super_and_override.t │ ├── super_warns_on_args.t │ ├── universal_methods_wrappable.t │ └── wrapped_method_cxt_propagation.t ├── bugs │ ├── DEMOLISHALL.t │ ├── DEMOLISHALL_shortcutted.t │ ├── DEMOLISH_eats_exceptions.t │ ├── DEMOLISH_eats_mini.t │ ├── DEMOLISH_fails_without_metaclass.t │ ├── Moose_Object_error.t │ ├── anon_method_metaclass.t │ ├── application_metarole_compat.t │ ├── apply_role_to_one_instance_only.t │ ├── attribute_trait_parameters.t │ ├── augment_recursion_bug.t │ ├── coerce_without_coercion.t │ ├── constructor_object_overload.t │ ├── create_anon_mkopt.t │ ├── create_anon_recursion.t │ ├── create_anon_role_pass.t │ ├── delete_sub_stash.t │ ├── find_custom_trait_rt_92089.t │ ├── handles_foreign_class_bug.t │ ├── immutable_metaclass_does_role.t │ ├── immutable_n_default_x2.t │ ├── inheriting_from_roles.t │ ├── inline_reader_bug.t │ ├── instance_application_role_args.t │ ├── lazybuild_required_undef.t │ ├── mark_as_methods_overloading_breakage.t │ ├── moo_delegation.t │ ├── moose_exporter_false_circular_reference_rt_63818.t │ ├── moose_octal_defaults.t │ ├── native_trait_handles_bad_value.t │ ├── overloading_edge_cases.t │ ├── reader_precedence_bug.t │ ├── role_caller.t │ ├── subclass_use_base_bug.t │ ├── subtype_conflict_bug.t │ ├── subtype_quote_bug.t │ ├── super_recursion.t │ ├── traits_with_exporter.t │ └── type_constraint_messages.t ├── cmop │ ├── ArrayBasedStorage_test.t │ ├── AttributesWithHistory_test.t │ ├── BinaryTree_test.t │ ├── C3MethodDispatchOrder_test.t │ ├── ClassEncapsulatedAttributes_test.t │ ├── Class_C3_compatibility.t │ ├── InsideOutClass_test.t │ ├── InstanceCountingClass_test.t │ ├── LazyClass_test.t │ ├── Perl6Attribute_test.t │ ├── RT_27329_fix.t │ ├── RT_39001_fix.t │ ├── RT_41255.t │ ├── add_attribute_alternate.t │ ├── add_method_debugmode.t │ ├── add_method_modifier.t │ ├── advanced_methods.t │ ├── anon_class.t │ ├── anon_class_create_init.t │ ├── anon_class_keep_alive.t │ ├── anon_class_leak.t │ ├── anon_class_removal.t │ ├── anon_packages.t │ ├── attribute.t │ ├── attribute_duplication.t │ ├── attribute_errors_and_edge_cases.t │ ├── attribute_get_read_write.t │ ├── attribute_initializer.t │ ├── attribute_introspection.t │ ├── attribute_non_alpha_name.t │ ├── attributes.t │ ├── basic.t │ ├── before_after_dollar_under.t │ ├── class_errors_and_edge_cases.t │ ├── class_is_pristine.t │ ├── class_precedence_list.t │ ├── constant_codeinfo.t │ ├── create_class.t │ ├── custom_instance.t │ ├── deprecated.t │ ├── get_code_info.t │ ├── immutable_custom_trait.t │ ├── immutable_metaclass.t │ ├── immutable_w_constructors.t │ ├── immutable_w_custom_metaclass.t │ ├── inline_and_dollar_at.t │ ├── inline_structor.t │ ├── insertion_order.t │ ├── instance.t │ ├── instance_inline.t │ ├── instance_metaclass_incompat.t │ ├── instance_metaclass_incompat_dyn.t │ ├── lib │ │ ├── ArrayBasedStorage.pm │ │ ├── AttributesWithHistory.pm │ │ ├── BinaryTree.pm │ │ ├── C3MethodDispatchOrder.pm │ │ ├── ClassEncapsulatedAttributes.pm │ │ ├── InsideOutClass.pm │ │ ├── InstanceCountingClass.pm │ │ ├── LazyClass.pm │ │ ├── MyMetaClass.pm │ │ ├── MyMetaClass │ │ │ ├── Attribute.pm │ │ │ ├── Instance.pm │ │ │ ├── Method.pm │ │ │ └── Random.pm │ │ ├── Perl6Attribute.pm │ │ └── SyntaxError.pm │ ├── load.t │ ├── magic.t │ ├── make_mutable.t │ ├── meta_method.t │ ├── meta_package.t │ ├── meta_package_extension.t │ ├── metaclass.t │ ├── metaclass_incompatibility.t │ ├── metaclass_incompatibility_dyn.t │ ├── metaclass_inheritance.t │ ├── metaclass_loads_classes.t │ ├── metaclass_reinitialize.t │ ├── method.t │ ├── method_modifiers.t │ ├── methods.t │ ├── modify_parent_method.t │ ├── new_and_clone_metaclasses.t │ ├── null_stash.t │ ├── numeric_defaults.t │ ├── package_variables.t │ ├── random_eval_bug.t │ ├── rebless_instance.t │ ├── rebless_instance_away.t │ ├── rebless_overload.t │ ├── rebless_with_extra_params.t │ ├── scala_style_mixin_composition.t │ ├── self_introspection.t │ ├── subclasses.t │ ├── subname.t │ └── universal_methods.t ├── compat │ ├── composite_metaroles.t │ ├── extends_nonmoose_that_isa_moose_with_metarole.t │ ├── foreign_inheritence.t │ ├── inc_hash.t │ ├── module_refresh_compat.t │ └── moose_respects_base.t ├── examples │ ├── Child_Parent_attr_inherit.t │ ├── example1.t │ ├── example2.t │ ├── example_Moose_POOP.t │ ├── example_Protomoose.t │ ├── example_w_DCS.t │ ├── example_w_TestDeep.t │ └── record_set_iterator.t ├── exceptions │ ├── attribute.t │ ├── class-mop-attribute.t │ ├── class-mop-class-immutable-trait.t │ ├── class-mop-class.t │ ├── class-mop-method-accessor.t │ ├── class-mop-method-constructor.t │ ├── class-mop-method-generated.t │ ├── class-mop-method-meta.t │ ├── class-mop-method-wrapped.t │ ├── class-mop-method.t │ ├── class-mop-mixin-hasattributes.t │ ├── class-mop-mixin-hasmethods.t │ ├── class-mop-module.t │ ├── class-mop-object.t │ ├── class-mop-package.t │ ├── class.t │ ├── cmop.t │ ├── exception-lazyattributeneedsadefault.t │ ├── frame-leak.t │ ├── meta-role.t │ ├── metaclass.t │ ├── moose-exporter.t │ ├── moose-meta-attribute-native-traits.t │ ├── moose-meta-class-immutable-trait.t │ ├── moose-meta-method-accessor-native-array.t │ ├── moose-meta-method-accessor-native-collection.t │ ├── moose-meta-method-accessor-native-grep.t │ ├── moose-meta-method-accessor-native-hash-set.t │ ├── moose-meta-method-accessor-native-hash.t │ ├── moose-meta-method-accessor-native-string-match.t │ ├── moose-meta-method-accessor-native-string-replace.t │ ├── moose-meta-method-accessor-native-string-substr.t │ ├── moose-meta-method-accessor-native.t │ ├── moose-meta-method-accessor.t │ ├── moose-meta-method-augmented.t │ ├── moose-meta-method-constructor.t │ ├── moose-meta-method-delegation.t │ ├── moose-meta-method-destructor.t │ ├── moose-meta-method-overridden.t │ ├── moose-meta-role-application-rolesummation.t │ ├── moose-meta-role-application-toclass.t │ ├── moose-meta-role-application-torole.t │ ├── moose-meta-role-application.t │ ├── moose-meta-role-attribute.t │ ├── moose-meta-role-composite.t │ ├── moose-meta-typecoercion-union.t │ ├── moose-meta-typecoercion.t │ ├── moose-meta-typeconstraint-enum.t │ ├── moose-meta-typeconstraint-parameterizable.t │ ├── moose-meta-typeconstraint-parameterized.t │ ├── moose-meta-typeconstraint-registry.t │ ├── moose-meta-typeconstraint.t │ ├── moose-role.t │ ├── moose-util-metarole.t │ ├── moose-util-typeconstraints.t │ ├── moose.t │ ├── object.t │ ├── overload.t │ ├── rt-92818.t │ ├── rt-94795.t │ ├── stringify.t │ ├── traits.t │ ├── typeconstraints.t │ ├── util.t │ ├── with-debugging.t │ └── without-debugging.t ├── immutable │ ├── apply_roles_to_immutable.t │ ├── buildargs.t │ ├── constructor_is_not_moose.t │ ├── constructor_is_wrapped.t │ ├── default_values.t │ ├── definition_context.t │ ├── immutable_constructor_error.t │ ├── immutable_destroy.t │ ├── immutable_meta_class.t │ ├── immutable_metaclass_with_traits.t │ ├── immutable_moose.t │ ├── immutable_roundtrip.t │ ├── immutable_trigger_from_constructor.t │ ├── inline_close_over.t │ ├── inline_fallbacks.t │ ├── inlined_constructors_n_types.t │ └── multiple_demolish_inline.t ├── lib │ ├── Bar.pm │ ├── Bar7 │ │ └── Meta │ │ │ ├── Trait.pm │ │ │ └── Trait2.pm │ ├── Foo.pm │ ├── Moose │ │ └── Meta │ │ │ └── Attribute │ │ │ └── Custom │ │ │ ├── Bar.pm │ │ │ ├── Foo.pm │ │ │ └── Trait │ │ │ ├── Bar.pm │ │ │ └── Foo.pm │ ├── MyExporter.pm │ ├── MyMetaclassRole.pm │ ├── MyMooseA.pm │ ├── MyMooseB.pm │ ├── MyMooseObject.pm │ ├── NoInlineAttribute.pm │ ├── Overloading │ │ ├── ClassConsumesRoleConsumesOverloads.pm │ │ ├── ClassWithCombiningRole.pm │ │ ├── ClassWithOneRole.pm │ │ ├── CombiningClass.pm │ │ ├── CombiningRole.pm │ │ ├── RoleConsumesOverloads.pm │ │ ├── RoleWithOverloads.pm │ │ └── RoleWithoutOverloads.pm │ ├── OverloadingTests.pm │ ├── Real │ │ └── Package.pm │ └── Role │ │ ├── BreakOnLoad.pm │ │ ├── Child.pm │ │ ├── Interface.pm │ │ └── Parent.pm ├── metaclasses │ ├── create_anon_with_required_attr.t │ ├── custom_attr_meta_as_role.t │ ├── custom_attr_meta_with_roles.t │ ├── easy_init_meta.t │ ├── export_with_prototype.t │ ├── exporter_also_with_trait.t │ ├── exporter_meta_lookup.t │ ├── exporter_sub_names.t │ ├── goto_moose_import.t │ ├── immutable_metaclass_compat_bug.t │ ├── meta_name.t │ ├── metaclass_compat.t │ ├── metaclass_compat_no_fixing_bug.t │ ├── metaclass_compat_role_conflicts.t │ ├── metaclass_parameterized_traits.t │ ├── metaclass_traits.t │ ├── metarole.t │ ├── metarole_combination.t │ ├── metarole_on_anon.t │ ├── metarole_w_metaclass_pm.t │ ├── metaroles_of_metaroles.t │ ├── moose_exporter.t │ ├── moose_exporter_trait_aliases.t │ ├── moose_for_meta.t │ ├── moose_nonmoose_metatrait_init_order.t │ ├── moose_nonmoose_moose_chain_init_meta.t │ ├── moose_w_metaclass.t │ ├── new_metaclass.t │ ├── new_object_BUILD.t │ ├── overloading.t │ ├── reinitialize.t │ └── use_base_of_moose.t ├── moose_util │ ├── apply_roles.t │ ├── create_alias.t │ ├── ensure_all_roles.t │ ├── method_mod_args.t │ ├── moose_util.t │ ├── moose_util_does_role.t │ ├── moose_util_search_class_by_role.t │ ├── resolve_alias.t │ └── with_traits.t ├── native_traits │ ├── array_coerce.t │ ├── array_from_role.t │ ├── array_subtypes.t │ ├── array_trigger.t │ ├── collection_with_roles.t │ ├── custom_instance.t │ ├── hash_coerce.t │ ├── hash_subtypes.t │ ├── hash_trigger.t │ ├── remove_attribute.t │ ├── shallow_clone.t │ ├── trait_array.t │ ├── trait_bool.t │ ├── trait_code.t │ ├── trait_counter.t │ ├── trait_hash.t │ ├── trait_number.t │ └── trait_string.t ├── recipes │ └── basics_genome_overloadingsubtypesandcoercion.t ├── roles │ ├── anonymous_roles.t │ ├── application_toclass.t │ ├── apply_role.t │ ├── build.t │ ├── conflict_many_methods.t │ ├── create_role.t │ ├── create_role_subclass.t │ ├── empty_method_modifiers_meta_bug.t │ ├── extending_role_attrs.t │ ├── free_anonymous_roles.t │ ├── imported_required_method.t │ ├── meta_role.t │ ├── method_aliasing_in_composition.t │ ├── method_exclusion_in_composition.t │ ├── method_modifiers.t │ ├── methods.t │ ├── more_alias_and_exclude.t │ ├── more_role_edge_cases.t │ ├── new_meta_role.t │ ├── overloading_combine_to_class.t │ ├── overloading_combine_to_instance.t │ ├── overloading_combine_to_role.t │ ├── overloading_composition_errors.t │ ├── overloading_remove_attributes_bug.t │ ├── overloading_to_class.t │ ├── overloading_to_instance.t │ ├── overloading_to_role.t │ ├── overriding.t │ ├── reinitialize_anon_role.t │ ├── role.t │ ├── role_attr_application.t │ ├── role_attribute_conflict.t │ ├── role_attrs.t │ ├── role_compose_requires.t │ ├── role_composite.t │ ├── role_composite_exclusion.t │ ├── role_composition_attributes.t │ ├── role_composition_conflict_detection.t │ ├── role_composition_errors.t │ ├── role_composition_method_mods.t │ ├── role_composition_methods.t │ ├── role_composition_override.t │ ├── role_composition_req_methods.t │ ├── role_conflict_detection.t │ ├── role_conflict_edge_cases.t │ ├── role_consumers.t │ ├── role_exclusion.t │ ├── role_exclusion_and_alias_bug.t │ ├── role_for_combination.t │ ├── roles_and_method_cloning.t │ ├── roles_and_req_method_edge_cases.t │ ├── roles_applied_in_create.t │ ├── run_time_role_composition.t │ ├── runtime_roles_and_attrs.t │ ├── runtime_roles_and_nonmoose.t │ ├── runtime_roles_w_params.t │ └── use_base_does.t ├── test_moose │ ├── test_moose.t │ ├── test_moose_does_ok.t │ ├── test_moose_has_attribute_ok.t │ ├── test_moose_meta_ok.t │ └── with_immutable.t ├── todo_tests │ ├── exception_reflects_failed_constraint.t │ ├── immutable_n_around.t │ ├── moose_and_threads.t │ ├── replacing_super_methods.t │ ├── required_role_accessors.t │ ├── role_insertion_order.t │ ├── various_role_features.t │ └── wrong-inner.t └── type_constraints │ ├── advanced_type_creation.t │ ├── class_subtypes.t │ ├── class_type_constraint.t │ ├── coerced_parameterized_types.t │ ├── container_type_coercion.t │ ├── container_type_constraint.t │ ├── custom_parameterized_types.t │ ├── custom_type_errors.t │ ├── define_type_twice_throws.t │ ├── duck_type_handles.t │ ├── duck_types.t │ ├── enum.t │ ├── inlining.t │ ├── match_type_operator.t │ ├── maybe_type_constraint.t │ ├── misc_type_tests.t │ ├── name_conflicts.t │ ├── normalize_type_name.t │ ├── parameterize_from.t │ ├── role_type_constraint.t │ ├── subtype_auto_vivify_parent.t │ ├── subtyping_parameterized_types.t │ ├── subtyping_union_types.t │ ├── throw_error.t │ ├── type_coersion_on_lazy_attributes.t │ ├── type_names.t │ ├── type_notation_parser.t │ ├── types_and_undef.t │ ├── union_is_a_type_of.t │ ├── union_types.t │ ├── union_types_and_coercions.t │ ├── util_find_type_constraint.t │ ├── util_more_type_coercion.t │ ├── util_std_type_constraints.t │ ├── util_type_coercion.t │ ├── util_type_constraints.t │ ├── util_type_constraints_export.t │ ├── util_type_reloading.t │ ├── with-specio.t │ └── with-type-tiny.t ├── weaver.ini ├── xs ├── Attribute.xs ├── AttributeCore.xs ├── Class.xs ├── Generated.xs ├── HasAttributes.xs ├── HasMethods.xs ├── Inlined.xs ├── Instance.xs ├── MOP.xs ├── Method.xs ├── Moose.xs ├── Package.xs ├── ToInstance.xs └── typemap └── xt └── author ├── authority.t ├── debugger-duck_type.t ├── memory_leaks.t ├── pod-coverage.t ├── pod-spell.t └── test-my-dependents.t /.gitignore: -------------------------------------------------------------------------------- 1 | /META.yml 2 | /MYMETA.* 3 | /Makefile 4 | /Makefile.old 5 | /MANIFEST 6 | /MANIFEST.bak 7 | /blib/ 8 | /pm_to_blib 9 | /t/recipes/* 10 | !/t/recipes/basics_genome_overloadingsubtypesandcoercion.t 11 | /.build 12 | .* 13 | !/.gitignore 14 | !/.mailmap 15 | !/.travis.yml 16 | /Moose-*/ 17 | /Moose-*.tar.gz 18 | /*.bs 19 | /xs/*.c 20 | /*.o 21 | /xs/*.o 22 | /cover_db 23 | /*.gc?? 24 | /test-mydeps-* 25 | /nytprof* 26 | /_eumm/ 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CPAN version](https://badge.fury.io/pl/Moose.svg)](http://badge.fury.io/pl/Moose) 2 | [![Build Status](https://travis-ci.org/moose/Moose.png?branch=master,stable/2.12)](https://travis-ci.org/moose/Moose) 3 | [![Coverage Status](https://coveralls.io/repos/moose/Moose/badge.png?branch=master)](https://coveralls.io/r/moose/Moose?branch=master) 4 | 5 | Moose 6 | ===== 7 | 8 | Moose is a postmodern object system for Perl 5. 9 | 10 | Moose on CPAN: [https://metacpan.org/release/Moose] 11 | -------------------------------------------------------------------------------- /author/find-dupe-test-numbers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use File::Basename qw( basename ); 7 | 8 | for my $subdir ( glob 't/*' ) { 9 | my %files; 10 | 11 | for my $file ( map { basename($_) } glob "$subdir/*.t" ) { 12 | my ($number) = $file =~ /^(\d+)/; 13 | next unless defined $number; 14 | 15 | push @{ $files{$number} }, $file; 16 | } 17 | 18 | for my $number ( grep { @{ $files{$_} } > 1 } keys %files ) { 19 | print $subdir, "\n"; 20 | print ' - ', $_, "\n" for @{ $files{$number} }; 21 | print "\n"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /benchmarks/cmop/all.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Point classes 3 | classes: 4 | - 'MOP::Point' 5 | - 'MOP::Point3D' 6 | - 'MOP::Immutable::Point' 7 | - 'MOP::Immutable::Point3D' 8 | - 'MOP::Installed::Point' 9 | - 'MOP::Installed::Point3D' 10 | - 'Plain::Point' 11 | - 'Plain::Point3D' 12 | benchmarks: 13 | - class: 'Bench::Construct' 14 | name: object construction 15 | args: 16 | y: 137 17 | - class: 'Bench::Accessor' 18 | name: accessor get 19 | construct: 20 | x: 4 21 | y: 6 22 | accessor: x 23 | - class: 'Bench::Accessor' 24 | name: accessor set 25 | construct: 26 | x: 4 27 | y: 6 28 | accessor: x 29 | accessor_args: [ 5 ] 30 | -------------------------------------------------------------------------------- /benchmarks/cmop/foo.pl: -------------------------------------------------------------------------------- 1 | #!perl -wd:NYTProf 2 | # a moose using script for profiling 3 | # Usage: perl bench/profile.pl 4 | 5 | require KiokuDB; 6 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/Bench/Construct.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | package Bench::Construct; 4 | use Moose; 5 | use Moose::Util::TypeConstraints; 6 | 7 | has class => ( 8 | isa => "Str", 9 | is => "ro", 10 | ); 11 | 12 | eval { 13 | coerce ArrayRef 14 | => from HashRef 15 | => via { [ %$_ ] }; 16 | }; 17 | 18 | has args => ( 19 | isa => "ArrayRef", 20 | is => "ro", 21 | auto_deref => 1, 22 | coerce => 1, 23 | ); 24 | 25 | sub code { 26 | my $self = shift; 27 | 28 | my $class = $self->class; 29 | my @args = $self->args; 30 | 31 | sub { my $obj = $class->new( @args ) } 32 | } 33 | 34 | __PACKAGE__; 35 | 36 | __END__ 37 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Immutable/Point.pm: -------------------------------------------------------------------------------- 1 | 2 | package MOP::Immutable::Point; 3 | 4 | use strict; 5 | use warnings; 6 | use metaclass; 7 | 8 | __PACKAGE__->meta->add_attribute('x' => (accessor => 'x', default => 10)); 9 | __PACKAGE__->meta->add_attribute('y' => (accessor => 'y')); 10 | 11 | sub clear { 12 | my $self = shift; 13 | $self->x(0); 14 | $self->y(0); 15 | } 16 | 17 | __PACKAGE__->meta->make_immutable; 18 | 19 | 1; 20 | 21 | __END__ 22 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Immutable/Point3D.pm: -------------------------------------------------------------------------------- 1 | 2 | package MOP::Immutable::Point3D; 3 | 4 | use strict; 5 | use warnings; 6 | use metaclass; 7 | 8 | use base 'MOP::Point'; 9 | 10 | __PACKAGE__->meta->add_attribute('z' => (accessor => 'z')); 11 | 12 | sub clear { 13 | my $self = shift; 14 | $self->SUPER::clear(); 15 | $self->z(0); 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 20 | 1; 21 | 22 | __END__ 23 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Installed/Point.pm: -------------------------------------------------------------------------------- 1 | 2 | use lib reverse @INC; 3 | 4 | package MOP::Installed::Point; 5 | 6 | use strict; 7 | use warnings; 8 | use metaclass; 9 | 10 | __PACKAGE__->meta->add_attribute('x' => (accessor => 'x', default => 10)); 11 | __PACKAGE__->meta->add_attribute('y' => (accessor => 'y')); 12 | 13 | sub new { 14 | my $class = shift; 15 | $class->meta->new_object(@_); 16 | } 17 | 18 | sub clear { 19 | my $self = shift; 20 | $self->x(0); 21 | $self->y(0); 22 | } 23 | 24 | 1; 25 | 26 | __END__ 27 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Installed/Point3D.pm: -------------------------------------------------------------------------------- 1 | 2 | use lib reverse @INC; 3 | 4 | package MOP::Installed::Point3D; 5 | 6 | use strict; 7 | use warnings; 8 | use metaclass; 9 | 10 | use base 'MOP::Point'; 11 | 12 | __PACKAGE__->meta->add_attribute('z' => (accessor => 'z')); 13 | 14 | sub clear { 15 | my $self = shift; 16 | $self->SUPER::clear(); 17 | $self->z(0); 18 | } 19 | 20 | 1; 21 | 22 | __END__ 23 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Point.pm: -------------------------------------------------------------------------------- 1 | 2 | package MOP::Point; 3 | 4 | use strict; 5 | use warnings; 6 | use metaclass; 7 | 8 | __PACKAGE__->meta->add_attribute('x' => (accessor => 'x', default => 10)); 9 | __PACKAGE__->meta->add_attribute('y' => (accessor => 'y')); 10 | 11 | sub new { 12 | my $class = shift; 13 | $class->meta->new_object(@_); 14 | } 15 | 16 | sub clear { 17 | my $self = shift; 18 | $self->x(0); 19 | $self->y(0); 20 | } 21 | 22 | 1; 23 | 24 | __END__ 25 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/MOP/Point3D.pm: -------------------------------------------------------------------------------- 1 | 2 | package MOP::Point3D; 3 | 4 | use strict; 5 | use warnings; 6 | use metaclass; 7 | 8 | use base 'MOP::Point'; 9 | 10 | __PACKAGE__->meta->add_attribute('z' => (accessor => 'z')); 11 | 12 | sub clear { 13 | my $self = shift; 14 | $self->SUPER::clear(); 15 | $self->z(0); 16 | } 17 | 18 | 1; 19 | 20 | __END__ 21 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/Plain/Point.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | package Plain::Point; 4 | 5 | use strict; 6 | use warnings; 7 | 8 | sub new { 9 | my ( $class, %params ) = @_; 10 | 11 | return bless { 12 | x => $params{x} || 10, 13 | y => $params{y}, 14 | }, $class; 15 | } 16 | 17 | sub x { 18 | my ( $self, @args ) = @_; 19 | 20 | if ( @args ) { 21 | $self->{x} = $args[0]; 22 | } 23 | 24 | return $self->{x}; 25 | } 26 | 27 | sub y { 28 | my ( $self, @args ) = @_; 29 | 30 | if ( @args ) { 31 | $self->{y} = $args[0]; 32 | } 33 | 34 | return $self->{y}; 35 | } 36 | 37 | sub clear { 38 | my $self = shift; 39 | @{$self}{qw/x y/} = (0, 0); 40 | } 41 | 42 | __PACKAGE__; 43 | 44 | __END__ 45 | -------------------------------------------------------------------------------- /benchmarks/cmop/lib/Plain/Point3D.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | package Plain::Point3D; 4 | 5 | use strict; 6 | use warnings; 7 | 8 | use base 'Plain::Point'; 9 | 10 | sub new { 11 | my ( $class, %params ) = @_; 12 | my $self = $class->SUPER::new( %params ); 13 | $self->{z} = $params{z}; 14 | return $self; 15 | } 16 | 17 | sub z { 18 | my ( $self, @args ) = @_; 19 | 20 | if ( @args ) { 21 | $self->{z} = $args[0]; 22 | } 23 | 24 | return $self->{z}; 25 | } 26 | 27 | sub clear { 28 | my $self = shift; 29 | $self->SUPER::clear(); 30 | $self->{z} = 0; 31 | } 32 | 33 | __PACKAGE__; 34 | 35 | __END__ 36 | -------------------------------------------------------------------------------- /benchmarks/cmop/profile.pl: -------------------------------------------------------------------------------- 1 | #!perl -w 2 | # Usage: perl bench/profile.pl (no other options including -Mblib are reqired) 3 | 4 | use strict; 5 | 6 | my $script = 'bench/foo.pl'; 7 | 8 | my $branch = do { 9 | open my $in, '.git/HEAD' or die "Cannot open .git/HEAD: $!"; 10 | my $s = scalar <$in>; 11 | chomp $s; 12 | $s =~ s{^ref: \s+ refs/heads/}{}xms; 13 | $s =~ s{/}{_}xmsg; 14 | $s; 15 | }; 16 | 17 | print "Profiling $branch ...\n"; 18 | 19 | my @cmd = ( $^X, '-Iblib/lib', '-Iblib/arch', $script ); 20 | print "> @cmd\n"; 21 | system(@cmd) == 0 or die "Cannot profile"; 22 | 23 | @cmd = ( $^X, '-S', 'nytprofhtml', '--out', "nytprof-$branch" ); 24 | print "> @cmd\n"; 25 | system(@cmd) == 0 or die "Cannot profile"; 26 | -------------------------------------------------------------------------------- /benchmarks/cmop/run_yml.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use FindBin; 7 | use lib "$FindBin::Bin/lib"; 8 | 9 | use YAML::Syck; 10 | use Bench::Run; 11 | 12 | my $data = LoadFile( shift || "$FindBin::Bin/all.yml" ); 13 | 14 | foreach my $bench ( @$data ) { 15 | print "== ", delete $bench->{name}, " ==\n\n"; 16 | Bench::Run->new( %$bench )->run; 17 | print "\n\n"; 18 | } 19 | -------------------------------------------------------------------------------- /benchmarks/simple_class.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Benchmark::Forking qw[cmpthese]; 7 | 8 | =pod 9 | 10 | This compares the burden of a basic Moose 11 | class to a basic Class::MOP class. 12 | 13 | It is worth noting that the basic Moose 14 | class will also create a type constraint 15 | as well as export many subs, so this comparison 16 | is really not fair :) 17 | 18 | =cut 19 | 20 | cmpthese(5_000, 21 | { 22 | 'w/out_moose' => sub { 23 | eval 'package Bar; use metaclass;'; 24 | }, 25 | 'w_moose' => sub { 26 | eval 'package Baz; use Moose;'; 27 | }, 28 | } 29 | ); 30 | 31 | 1; -------------------------------------------------------------------------------- /benchmarks/simple_compile.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Benchmark::Forking qw[cmpthese]; 7 | 8 | =pod 9 | 10 | This compare the overhead of Class::MOP 11 | to the overhead of Moose. 12 | 13 | The goal here is to see how much more 14 | startup cost Moose adds to Class::MOP. 15 | 16 | NOTE: 17 | This benchmark may not be all that 18 | relevant really, but it's helpful to 19 | see maybe. 20 | 21 | =cut 22 | 23 | cmpthese(5_000, 24 | { 25 | 'w/out_moose' => sub { 26 | eval 'use Class::MOP;'; 27 | }, 28 | 'w_moose' => sub { 29 | eval 'use Moose;'; 30 | }, 31 | } 32 | ); 33 | 34 | 1; -------------------------------------------------------------------------------- /inc/CheckDelta.pm: -------------------------------------------------------------------------------- 1 | package inc::CheckDelta; 2 | use Moose; 3 | 4 | with 'Dist::Zilla::Role::AfterBuild'; 5 | 6 | sub after_build { 7 | my $self = shift; 8 | 9 | return unless $ENV{DZIL_RELEASING}; 10 | 11 | my ($delta) = grep { $_->name eq 'lib/Moose/Manual/Delta.pod' } 12 | @{ $self->zilla->files }; 13 | 14 | die "Moose::Manual::Delta still contains \$NEXT" 15 | if $delta->content =~ /\$NEXT/; 16 | } 17 | 18 | 1; 19 | -------------------------------------------------------------------------------- /inc/Documentation.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package inc::Documentation; 4 | 5 | # add x_documentation metadata 6 | # see https://github.com/metacpan/metacpan-web/issues/1468#event-283925638 7 | 8 | use Moose; 9 | with 'Dist::Zilla::Role::MetaProvider'; 10 | 11 | sub mvp_multivalue_args { 'module' } 12 | 13 | has module => ( 14 | is => 'ro', isa => 'ArrayRef[Str]', 15 | required => 1, 16 | ); 17 | 18 | sub metadata 19 | { 20 | my $self = shift; 21 | return +{ x_documentation => $self->module }; 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /inc/SimpleAuthority.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package inc::SimpleAuthority; 4 | 5 | use Moose; 6 | with 'Dist::Zilla::Role::MetaProvider'; 7 | 8 | sub metadata 9 | { 10 | return +{ x_authority => 'cpan:STEVAN' }; 11 | } 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /inc/TestRelease.pm: -------------------------------------------------------------------------------- 1 | package inc::TestRelease; 2 | 3 | use Moose; 4 | 5 | extends 'Dist::Zilla::Plugin::TestRelease'; 6 | 7 | around before_release => sub { 8 | my $orig = shift; 9 | my $self = shift; 10 | 11 | local $ENV{MOOSE_TEST_MD} = 1 if not $self->zilla->is_trial; 12 | local $ENV{AUTHOR_TESTING} = 1 if not $self->zilla->is_trial; 13 | 14 | $self->$orig(@_); 15 | }; 16 | 17 | 1; 18 | -------------------------------------------------------------------------------- /lib/Moose/Cookbook/Style.pod: -------------------------------------------------------------------------------- 1 | # PODNAME: Moose::Cookbook::Style 2 | # ABSTRACT: Expanded into Moose::Manual::BestPractices, so go read that 3 | 4 | =pod 5 | 6 | =head1 DESCRIPTION 7 | 8 | The style cookbook has been replaced by 9 | L. This POD document still exists for 10 | the benefit of anyone out there who might've linked to it in the past. 11 | 12 | =cut 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AccessorMustReadWrite.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AccessorMustReadWrite; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot define an accessor name on a read-only attribute, accessors are read/write"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AddParameterizableTypeTakesParameterizableType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AddParameterizableTypeTakesParameterizableType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'type_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "Type must be a Moose::Meta::TypeConstraint::Parameterizable not ".$self->type_name; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AddRoleTakesAMooseMetaRoleInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AddRoleTakesAMooseMetaRoleInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'role_to_be_added' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "Roles must be instances of Moose::Meta::Role"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AddRoleToARoleTakesAMooseMetaRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AddRoleToARoleTakesAMooseMetaRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'role_to_be_added' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "Roles must be instances of Moose::Meta::Role"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ApplyTakesABlessedInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ApplyTakesABlessedInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'param' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "You must pass in an blessed instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AttachToClassNeedsAClassMOPClassInstanceOrASubclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AttachToClassNeedsAClassMOPClassInstanceOrASubclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must pass a Class::MOP::Class instance (or a subclass)"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AttributeExtensionIsNotSupportedInRoles.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AttributeExtensionIsNotSupportedInRoles; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'attribute_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "has '+attr' is not supported in roles"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'attribute' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AttributeNamesDoNotMatch.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AttributeNamesDoNotMatch; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has attribute_name => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | has attribute => ( 14 | is => 'ro', 15 | isa => 'Class::MOP::Attribute', 16 | required => 1, 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | "attribute_name (".$self-> attribute_name.") does not match attribute->name (".$self->attribute->name.")"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AttributeValueIsNotDefined.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AttributeValueIsNotDefined; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'method' => ( 9 | is => 'ro', 10 | isa => 'Moose::Meta::Method::Delegation', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Cannot delegate ".$self->method->name." to " 17 | .$self->method->delegate_to_method." because the value of " 18 | . $self->attribute->name . " is not defined"; 19 | } 20 | 21 | __PACKAGE__->meta->make_immutable; 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Exception/AutoDeRefNeedsArrayRefOrHashRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::AutoDeRefNeedsArrayRefOrHashRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BadOptionFormat.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BadOptionFormat; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'option_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'option_value' => ( 15 | is => 'ro', 16 | isa => 'Any', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | "bad accessor/reader/writer/predicate/clearer format, must be a HASH ref"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BothBuilderAndDefaultAreNotAllowed.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BothBuilderAndDefaultAreNotAllowed; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "Setting both default and builder is not allowed."; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BuilderDoesNotExist.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BuilderDoesNotExist; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | blessed($self->instance)." does not support builder method '".$self->attribute->builder."' for attribute '".$self->attribute->name."'"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BuilderMethodNotSupportedForAttribute.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BuilderMethodNotSupportedForAttribute; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | blessed($self->instance)." does not support builder method '". $self->attribute->builder ."' for attribute '" . $self->attribute->name . "'"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BuilderMethodNotSupportedForInlineAttribute.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BuilderMethodNotSupportedForInlineAttribute; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Class'; 7 | 8 | has 'attribute_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'builder' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | $self->class_name." does not support builder method '". $self->builder ."' for attribute '" . $self->attribute_name . "'"; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/BuilderMustBeAMethodName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::BuilderMustBeAMethodName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "builder must be a defined scalar value which is a method name"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CallingMethodOnAnImmutableInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CallingMethodOnAnImmutableInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'method_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "The '".$self->method_name."' method cannot be called on an immutable instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CallingReadOnlyMethodOnAnImmutableInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CallingReadOnlyMethodOnAnImmutableInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'method_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "The '".$self->method_name."' method is read-only when called on an immutable instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CanExtendOnlyClasses.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CanExtendOnlyClasses; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | my $role_name = $self->role_name; 11 | return "You cannot inherit from a Moose Role ($role_name)"; 12 | } 13 | 14 | __PACKAGE__->meta->make_immutable; 15 | 1; 16 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CanOnlyConsumeRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CanOnlyConsumeRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'role_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "You can only consume roles, ".$self->role_name." is not a Moose role"; 16 | } 17 | __PACKAGE__->meta->make_immutable; 18 | 1; 19 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CanOnlyWrapBlessedCode.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CanOnlyWrapBlessedCode; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'code' => ( 15 | is => 'ro', 16 | isa => 'Any', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | "Can only wrap blessed CODE"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CanReblessOnlyIntoASubclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CanReblessOnlyIntoASubclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::InstanceClass'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | my $instance_class = $self->instance_class; 11 | "You may rebless only into a subclass of ($instance_class), of which (". $self->class_name .") isn't." 12 | } 13 | 14 | __PACKAGE__->meta->make_immutable; 15 | 1; 16 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CanReblessOnlyIntoASuperclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CanReblessOnlyIntoASuperclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::InstanceClass'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You may rebless only into a superclass of (".blessed( $self->instance )."), of which (". $self->class_name .") isn't." 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAddAdditionalTypeCoercionsToUnion.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAddAdditionalTypeCoercionsToUnion; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'type_coercion_union_object' => ( 8 | is => 'ro', 9 | isa => 'Moose::Meta::TypeCoercion::Union', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | return "Cannot add additional type coercions to Union types"; 15 | } 16 | 17 | __PACKAGE__->meta->make_immutable; 18 | 1; 19 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAddAsAnAttributeToARole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAddAsAnAttributeToARole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'attribute_class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Cannot add a ".$self->attribute_class." as an attribute to a role"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotApplyBaseClassRolesToRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotApplyBaseClassRolesToRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | "You can only apply base class roles to a Moose class, not a role."; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAssignValueToReadOnlyAccessor.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAssignValueToReadOnlyAccessor; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::EitherAttributeOrAttributeName'; 7 | 8 | has 'value' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Cannot assign a value to a read-only accessor"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAugmentIfLocalMethodPresent.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAugmentIfLocalMethodPresent; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Method'; 7 | 8 | sub _build_message { 9 | "Cannot add an augment method if a local method is already present"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAugmentNoSuperMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAugmentNoSuperMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'method_name' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "You cannot augment '".$self->method_name."' because it has no super method"; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAutoDerefWithoutIsa.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAutoDerefWithoutIsa; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot auto-dereference without specifying a type constraint on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotAutoDereferenceTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotAutoDereferenceTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Can not auto de-reference the type constraint '" . $self->type_name . "'"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCalculateNativeType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCalculateNativeType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot calculate native type for " . ref $self->instance; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCallAnAbstractBaseMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCallAnAbstractBaseMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'package_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | $self->package_name. " is an abstract base class, you must provide a constructor."; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCallAnAbstractMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCallAnAbstractMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "Abstract method"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCoerceAWeakRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCoerceAWeakRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot have a weak reference to a coerced value on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCoerceAttributeWhichHasNoCoercion.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCoerceAttributeWhichHasNoCoercion; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions', 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | my $name = $self->attribute_name; 11 | my $type = $self->type_name; 12 | 13 | return "You cannot coerce an attribute ($name) unless its type ($type) has a coercion"; 14 | } 15 | 16 | __PACKAGE__->meta->make_immutable; 17 | 1; 18 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCreateHigherOrderTypeWithoutATypeParameter.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCreateHigherOrderTypeWithoutATypeParameter; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | "You cannot create a Higher Order type without a type parameter"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresent.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresent; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Method'; 7 | 8 | has 'role_being_applied_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'aliased_method_name' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | "Cannot create a method alias if a local method of the same name exists"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresentInClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresentInClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Method', 'Moose::Exception::Role::Class'; 7 | 8 | has 'aliased_method_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "Cannot create a method alias if a local method of the same name exists"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotDelegateLocalMethodIsPresent.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotDelegateLocalMethodIsPresent; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Method'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot overwrite a locally defined method (".$self->method->name.") with a delegation"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotDelegateWithoutIsa.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotDelegateWithoutIsa; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | sub _build_message { 9 | "Cannot delegate methods based on a Regexp without a type constraint (isa)"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotFindDelegateMetaclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotFindDelegateMetaclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot find delegate metaclass for attribute ".$self->attribute->name; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotFindType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotFindType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'type_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "Cannot find type '".$self->type_name."', perhaps you forgot to load it"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotFindTypeGivenToMatchOnType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotFindTypeGivenToMatchOnType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'to_match' => ( 8 | is => 'ro', 9 | isa => 'Any', 10 | required => 1 11 | ); 12 | 13 | has 'action' => ( 14 | is => 'ro', 15 | isa => 'Any', 16 | required => 1 17 | ); 18 | 19 | has 'type' => ( 20 | is => 'ro', 21 | isa => 'Any', 22 | required => 1 23 | ); 24 | 25 | sub _build_message { 26 | my $self = shift; 27 | my $type = $self->type; 28 | 29 | return "Cannot find or parse the type '$type'" 30 | } 31 | 32 | __PACKAGE__->meta->make_immutable; 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotFixMetaclassCompatibility.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotFixMetaclassCompatibility; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'superclass' => ( 9 | is => 'ro', 10 | isa => 'Object', 11 | required => 1 12 | ); 13 | 14 | has 'metaclass_type' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | my $class_name = $self->class_name; 22 | "Can't fix metaclass incompatibility for $class_name because it is not pristine."; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotInlineTypeConstraintCheck.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotInlineTypeConstraintCheck; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | 'Cannot inline a type constraint check for ' . $self->type_name; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotMakeMetaclassCompatible.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotMakeMetaclassCompatible; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'superclass_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $class_name = $self->class_name; 17 | my $superclass = $self->superclass_name; 18 | 19 | return "Can't make $class_name compatible with metaclass $superclass"; 20 | } 21 | 22 | __PACKAGE__->meta->make_immutable; 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotOverrideALocalMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotOverrideALocalMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'method_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Cannot add an override of method '".$self->method_name."' because there is a local version of '".$self->method_name."'"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotOverrideBodyOfMetaMethods.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotOverrideBodyOfMetaMethods; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "Overriding the body of meta methods is not allowed"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotOverrideLocalMethodIsPresent.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotOverrideLocalMethodIsPresent; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Method'; 7 | 8 | sub _build_message { 9 | "Cannot add an override method if a local method is already present"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotOverrideNoSuperMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotOverrideNoSuperMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'method_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'class' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "You cannot override '".$self->method_name."' because it has no super method"; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotRegisterUnnamedTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotRegisterUnnamedTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "can't register an unnamed type constraint"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CannotUseLazyBuildAndDefaultSimultaneously.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CannotUseLazyBuildAndDefaultSimultaneously; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You can not use lazy_build and default for the same attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ClassDoesNotHaveInitMeta.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ClassDoesNotHaveInitMeta; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'traits' => ( 9 | is => 'ro', 10 | isa => 'ArrayRef', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $class = $self->class_name; 17 | 18 | return "Cannot provide traits when $class does not have an init_meta() method"; 19 | } 20 | 21 | __PACKAGE__->meta->make_immutable; 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ClassDoesTheExcludedRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ClassDoesTheExcludedRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Class'; 7 | 8 | has 'excluded_role_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $excluded_role_name = $self->excluded_role_name; 17 | my $class_name = $self->class_name; 18 | return "The class $class_name does the excluded role '$excluded_role_name'"; 19 | } 20 | 21 | __PACKAGE__->meta->make_immutable; 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ClassNamesDoNotMatch.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ClassNamesDoNotMatch; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has class_name => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | has class => ( 14 | is => 'ro', 15 | isa => 'Class::MOP::Class', 16 | required => 1, 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | "class_name (".$self-> class_name.") does not match class->name (".$self->class->name.")"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CloneObjectExpectsAnInstanceOfMetaclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CloneObjectExpectsAnInstanceOfMetaclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'instance' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "You must pass an instance of the metaclass (" .$self->class_name. "), not (".$self->instance.")"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CodeBlockMustBeACodeRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CodeBlockMustBeACodeRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | "Your code block must be a CODE reference"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CoercingWithoutCoercions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CoercingWithoutCoercions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot coerce without a type coercion"; 11 | } 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CoercionAlreadyExists.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CoercionAlreadyExists; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | has 'constraint_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "A coercion action already exists for '".$self->constraint_name."'"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CoercionNeedsTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CoercionNeedsTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot have coercion without specifying a type constraint on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ConflictDetectedInCheckRoleExclusions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ConflictDetectedInCheckRoleExclusions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'excluded_role_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $role_name = $self->role_name; 17 | my $excluded_role_name = $self->excluded_role_name; 18 | return "Conflict detected: $role_name excludes role '$excluded_role_name'"; 19 | } 20 | 21 | __PACKAGE__->meta->make_immutable; 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ConflictDetectedInCheckRoleExclusionsInToClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ConflictDetectedInCheckRoleExclusionsInToClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | my $class_name = $self->class_name; 11 | my $role_name = $self->role_name; 12 | return "Conflict detected: $class_name excludes role '$role_name'"; 13 | } 14 | 15 | __PACKAGE__->meta->make_immutable; 16 | 1; 17 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ConstructClassInstanceTakesPackageName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ConstructClassInstanceTakesPackageName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You must pass a package name"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CouldNotCreateWriter.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CouldNotCreateWriter; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::EitherAttributeOrAttributeName', 'Moose::Exception::Role::Instance'; 7 | 8 | has 'error' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $error = $self->error; 17 | my $attribute_name = $self->attribute_name; 18 | 19 | return "Could not create writer for '$attribute_name' " 20 | . "because $error"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CouldNotFindTypeConstraintToCoerceFrom.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CouldNotFindTypeConstraintToCoerceFrom; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | has 'constraint_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Could not find the type constraint (".$self->constraint_name.") to coerce from"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CouldNotGenerateInlineAttributeMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CouldNotGenerateInlineAttributeMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | has 'option' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'error' => ( 15 | is => 'ro', 16 | isa => 'Str|Moose::Exception', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "Could not generate inline ".$self->option." because : ".$self->error; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CouldNotLocateTypeConstraintForUnion.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CouldNotLocateTypeConstraintForUnion; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Could not locate type constraint (".$self->type_name.") for the union"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CouldNotParseType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CouldNotParseType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'type' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | has 'position' => ( 14 | is => 'ro', 15 | isa => 'Int', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | my $type = $self->type; 22 | my $length = length($type); 23 | my $position = $self->position; 24 | 25 | return "'$type' didn't parse (parse-pos=$position" 26 | . " and str-length=$length)"; 27 | } 28 | 29 | __PACKAGE__->meta->make_immutable; 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateMOPClassTakesArrayRefOfAttributes.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateMOPClassTakesArrayRefOfAttributes; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreateMOPClass'; 7 | 8 | sub _build_message { 9 | "You must pass an ARRAY ref of attributes"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateMOPClassTakesArrayRefOfSuperclasses; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreateMOPClass'; 7 | 8 | sub _build_message { 9 | "You must pass an ARRAY ref of superclasses"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateMOPClassTakesHashRefOfMethods.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateMOPClassTakesHashRefOfMethods; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreateMOPClass'; 7 | 8 | sub _build_message { 9 | "You must pass an HASH ref of methods"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateTakesArrayRefOfRoles.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateTakesArrayRefOfRoles; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreate'; 7 | 8 | sub _build_message { 9 | "You must pass an ARRAY ref of roles"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateTakesHashRefOfAttributes.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateTakesHashRefOfAttributes; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreate'; 7 | 8 | sub _build_message { 9 | "You must pass a HASH ref of attributes"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/CreateTakesHashRefOfMethods.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::CreateTakesHashRefOfMethods; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::RoleForCreate'; 7 | 8 | sub _build_message { 9 | "You must pass a HASH ref of methods"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/DelegationToAClassWhichIsNotLoaded.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::DelegationToAClassWhichIsNotLoaded; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'class_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The ".$self->attribute->name." attribute is trying to delegate to a class which has not been loaded - ".$self->class_name; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/DelegationToARoleWhichIsNotLoaded.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::DelegationToARoleWhichIsNotLoaded; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'role_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The ".$self->attribute->name." attribute is trying to delegate to a role which has not been loaded - ".$self->role_name; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/DelegationToATypeWhichIsNotAClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::DelegationToATypeWhichIsNotAClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "The ".$self->attribute->name." attribute is trying to delegate to a type (".$self->attribute->type_constraint->name.") that is not backed by a class"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/DoesRequiresRoleName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::DoesRequiresRoleName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must supply a role name to does()"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::EnumCalledWithAnArrayRefAndAdditionalArgs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'array' => ( 8 | is => 'ro', 9 | isa => 'ArrayRef', 10 | required => 1 11 | ); 12 | 13 | has 'args' => ( 14 | is => 'ro', 15 | isa => 'ArrayRef', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | "enum called with an array reference and additional arguments. Did you mean to parenthesize the enum call's parameters?"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/EnumValuesMustBeString.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::EnumValuesMustBeString; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'value' => ( 15 | is => 'ro', 16 | isa => 'Any', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "Enum values must be strings, not ".( defined $self->value ? "'".$self->value."'" : "undef" ); 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ExtendsMissingArgs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ExtendsMissingArgs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "Must derive at least one class"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/HandlesMustBeAHashRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::HandlesMustBeAHashRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | has 'given_handles' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The 'handles' option must be a HASH reference, not ".$self->given_handles; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/IllegalInheritedOptions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::IllegalInheritedOptions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'illegal_options' => ( 9 | is => 'ro', 10 | traits => ['Array'], 11 | handles => { 12 | _join_options => 'join', 13 | }, 14 | required => 1, 15 | ); 16 | 17 | sub _build_message { 18 | my $self = shift; 19 | "Illegal inherited options => (".$self->_join_options(', ').")"; 20 | } 21 | 22 | __PACKAGE__->meta->make_immutable; 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InitMetaRequiresClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InitMetaRequiresClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | sub _build_message { 9 | "Cannot call init_meta without specifying a for_class"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InitializeTakesUnBlessedPackageName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InitializeTakesUnBlessedPackageName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'package_name' => ( 8 | is => 'ro', 9 | isa => 'Any', 10 | required => 1, 11 | ); 12 | 13 | sub _build_message { 14 | "You must pass a package name and it cannot be blessed"; 15 | } 16 | 17 | __PACKAGE__->meta->make_immutable; 18 | 1; 19 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InstanceBlessedIntoWrongClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InstanceBlessedIntoWrongClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Objects passed as the __INSTANCE__ parameter must already be blessed into the correct class, but ".$self->instance." is not a " . $self->class_name; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InstanceMustBeABlessedReference.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InstanceMustBeABlessedReference; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class'; 7 | 8 | has 'instance' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The __INSTANCE__ parameter must be a blessed reference, not ". $self->instance; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidBaseTypeGivenToCreateParameterizedTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidBaseTypeGivenToCreateParameterizedTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Could not locate the base type (".$self->type_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidHandleValue.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidHandleValue; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | has 'handle_value' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "All values passed to handles must be strings or ARRAY references, not ".$self->handle_value; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidHasProvidedInARole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidHasProvidedInARole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'attribute_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "Usage: has 'name' => ( key => value, ... )"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidNameForType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidNameForType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | $self->name." contains invalid characters for a type name. Names can contain alphanumeric characters, ':', and '.'"; 16 | } 17 | 1; 18 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidOverloadOperator.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidOverloadOperator; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has operator => ( 8 | is => 'ro', 9 | isa => 'Defined', 10 | required => 1, 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | 'The operator parameter you passed to the Moose::Meta::Overload constructor (' 16 | . $self->operator() 17 | . ') was not a valid overloading operator'; 18 | } 19 | 20 | __PACKAGE__->meta->make_immutable; 21 | 1; 22 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidRoleApplication.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidRoleApplication; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'application' => ( 9 | is => 'ro', 10 | isa => "Any", 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | "Role applications must be instances of Moose::Meta::Role::Application::ToClass"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'registry_object' => ( 8 | is => 'ro', 9 | isa => 'Moose::Meta::TypeConstraint::Registry', 10 | required => 1 11 | ); 12 | 13 | has 'type' => ( 14 | is => 'ro', 15 | isa => 'Any', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | return "No type supplied / type is not a valid type constraint"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidTypeGivenToCreateParameterizedTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidTypeGivenToCreateParameterizedTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Could not parse type name (".$self->type_name.") correctly"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/InvalidValueForIs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::InvalidValueForIs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "I do not understand this option (is => ".$self->params->{is}.") on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/IsaDoesNotDoTheRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::IsaDoesNotDoTheRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot have an isa option and a does option if the isa does not do the does on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/IsaLacksDoesMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::IsaLacksDoesMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Cannot have an isa option which cannot ->does() on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/LazyAttributeNeedsADefault.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::LazyAttributeNeedsADefault; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::EitherAttributeOrAttributeName'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot have a lazy attribute (".$self->attribute_name.") without specifying a default value for it"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Legacy.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Legacy; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | __PACKAGE__->meta->make_immutable; 8 | 1; 9 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MOPAttributeNewNeedsAttributeName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MOPAttributeNewNeedsAttributeName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must provide a name for the attribute"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MatchActionMustBeACodeRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MatchActionMustBeACodeRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | has 'to_match' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | has 'action' => ( 15 | is => 'ro', 16 | isa => 'Any', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | my $action = $self->action; 23 | 24 | return "Match action must be a CODE ref, not $action"; 25 | } 26 | 27 | __PACKAGE__->meta->make_immutable; 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MessageParameterMustBeCodeRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MessageParameterMustBeCodeRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "The 'message' parameter must be a coderef"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MetaclassIsNotASubclassOfGivenMetaclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MetaclassIsNotASubclassOfGivenMetaclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | use Moose::Util 'find_meta'; 9 | 10 | has 'metaclass' => ( 11 | is => 'ro', 12 | isa => 'Str', 13 | required => 1 14 | ); 15 | 16 | sub _build_message { 17 | my $self = shift; 18 | my $class = find_meta( $self->class_name ); 19 | $self->class_name." already has a metaclass, but it does not inherit ".$self->metaclass." ($class)."; 20 | } 21 | 22 | __PACKAGE__->meta->make_immutable; 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MetaclassMustBeASubclassOfMooseMetaClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "The Metaclass ".$self->class_name." must be a subclass of Moose::Meta::Class." 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MetaclassMustBeASubclassOfMooseMetaRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "The Metaclass ".$self->role_name." must be a subclass of Moose::Meta::Role." 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MetaclassMustBeDerivedFromClassMOPClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'class_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "The metaclass (".$self->class_name.") must be derived from Class::MOP::Class"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MetaclassNotLoaded.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MetaclassNotLoaded; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "The Metaclass ".$self->class_name." must be loaded. (Perhaps you forgot to 'use ".$self->class_name."'?)"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodExpectedAMetaclassObject.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodExpectedAMetaclassObject; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'class' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | has 'metaclass' => ( 14 | is => 'ro', 15 | isa => 'Any', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | "The is_needed method expected a metaclass object as its arugment"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodExpectsFewerArgs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodExpectsFewerArgs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'method_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | has 'maximum_args' => ( 14 | is => 'ro', 15 | isa => 'Int', 16 | required => 1, 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | my $max = $self->maximum_args; 22 | "Cannot call ".$self->method_name." with ". 23 | ( $max ? "more than $max" : 'any'). " argument".( $max == 1 ? '' : 's' ); 24 | } 25 | 26 | __PACKAGE__->meta->make_immutable; 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodExpectsMoreArgs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodExpectsMoreArgs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'method_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | has 'minimum_args' => ( 14 | is => 'ro', 15 | isa => 'Int', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | "Cannot call ".$self->method_name." without at least ".$self->minimum_args." argument".($self->minimum_args == 1 ? '' : 's'); 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodModifierNeedsMethodName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodModifierNeedsMethodName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must pass in a method name"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodNameNotFoundInInheritanceHierarchy; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | has 'method_name' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The method '".$self->method_name."' was not found in the inheritance hierarchy for ".$self->class_name; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MethodNameNotGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MethodNameNotGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must define a method name to find"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustDefineAMethodName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustDefineAMethodName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | "You must define a method name"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustDefineAnAttributeName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustDefineAnAttributeName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must define an attribute name"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustDefineAnOverloadOperator.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustDefineAnOverloadOperator; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Instance'; 7 | 8 | sub _build_message { 9 | "You must define an overload operator"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustHaveAtLeastOneValueToEnumerate.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustHaveAtLeastOneValueToEnumerate; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must have at least one value to enumerate through"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustPassAHashOfOptions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustPassAHashOfOptions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must pass a hash of options"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustPassAMooseMetaRoleInstanceOrSubclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustPassAMooseMetaRoleInstanceOrSubclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'class' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | has 'role' => ( 14 | is => 'ro', 15 | isa => 'Any', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | "You must pass a Moose::Meta::Role instance (or a subclass)"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustPassAPackageNameOrAnExistingClassMOPPackageInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustPassAPackageNameOrAnExistingClassMOPPackageInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must pass a package name or an existing Class::MOP::Package instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustPassEvenNumberOfArguments.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustPassEvenNumberOfArguments; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'args' => ( 8 | is => 'ro', 9 | isa => 'ArrayRef', 10 | required => 1 11 | ); 12 | 13 | has 'method_name' => ( 14 | is => 'ro', 15 | isa => 'Str', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | "You must pass an even number of arguments to ".$self->method_name; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustPassEvenNumberOfAttributeOptions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustPassEvenNumberOfAttributeOptions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'options' => ( 8 | is => 'ro', 9 | isa => 'ArrayRef', 10 | required => 1 11 | ); 12 | 13 | has 'attribute_name' => ( 14 | is => 'ro', 15 | isa => 'Str', 16 | required => 1, 17 | ); 18 | 19 | sub _build_message { 20 | return 'You must pass an even number of attribute options'; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustProvideANameForTheAttribute.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustProvideANameForTheAttribute; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must provide a name for the attribute"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSpecifyAtleastOneMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSpecifyAtleastOneMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | "Must specify at least one method"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSpecifyAtleastOneRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSpecifyAtleastOneRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | "Must specify at least one role"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSpecifyAtleastOneRoleToApplicant.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSpecifyAtleastOneRoleToApplicant; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'applicant' => ( 8 | is => 'ro', 9 | isa => 'Any', 10 | required => 1, 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "Must specify at least one role to apply to ".$self->applicant; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyAClassMOPAttributeInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyAClassMOPAttributeInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must supply an attribute which is a 'Class::MOP::Attribute' instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyADelegateToMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyADelegateToMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must supply a delegate_to_method which is a method name or a CODE reference"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyAMetaclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyAMetaclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "You must pass a metaclass instance if you want to inline"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyAMooseMetaAttributeInstance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyAMooseMetaAttributeInstance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must supply an attribute which is a 'Moose::Meta::Attribute' instance"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyAnAccessorTypeToConstructWith.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyAnAccessorTypeToConstructWith; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must supply an accessor_type to construct with"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyAnAttributeToConstructWith.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyAnAttributeToConstructWith; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "You must supply an attribute to construct with"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyArrayRefAsCurriedArguments.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyArrayRefAsCurriedArguments; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must supply a curried_arguments which is an ARRAY reference"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/MustSupplyPackageNameAndName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::MustSupplyPackageNameAndName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "You must supply the package_name and name parameters"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NeitherAttributeNorAttributeNameIsGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NeitherAttributeNorAttributeNameIsGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You need to give attribute or attribute_name or both"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NeitherClassNorClassNameIsGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NeitherClassNorClassNameIsGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You need to give class or class_name or both"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NeitherRoleNorRoleNameIsGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NeitherRoleNorRoleNameIsGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You need to give role or role_name or both"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NeitherTypeNorTypeNameIsGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NeitherTypeNorTypeNameIsGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You need to give type or type_name or both"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoAttributeFoundInSuperClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoAttributeFoundInSuperClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Could not find an attribute by the name of '".$self->attribute_name."' to inherit from in ".$self->class_name; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoBodyToInitializeInAnAbstractBaseClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoBodyToInitializeInAnAbstractBaseClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'package_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | my $self = shift; 15 | "No body to initialize, " .$self->package_name. " is an abstract base class"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoCasesMatched.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoCasesMatched; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'to_match' => ( 8 | is => 'ro', 9 | isa => 'Any', 10 | required => 1 11 | ); 12 | 13 | has 'cases_to_be_matched' => ( 14 | is => 'ro', 15 | isa => 'ArrayRef', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | my $to_match = $self->to_match; 22 | 23 | return "No cases matched for $to_match"; 24 | } 25 | 26 | __PACKAGE__->meta->make_immutable; 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoConstraintCheckForTypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoConstraintCheckForTypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Could not compile type constraint '".$self->type_name."' because no constraint check"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoDestructorClassSpecified.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoDestructorClassSpecified; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; 7 | 8 | sub _build_message { 9 | "The 'inline_destructor' option is present, but no destructor class was specified"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoImmutableTraitSpecifiedForClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoImmutableTraitSpecifiedForClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; 7 | 8 | use Moose::Util 'find_meta'; 9 | 10 | sub _build_message { 11 | my $self = shift; 12 | my $class = find_meta( $self->class_name ); 13 | "no immutable trait specified for $class"; 14 | } 15 | 16 | __PACKAGE__->meta->make_immutable; 17 | 1; 18 | -------------------------------------------------------------------------------- /lib/Moose/Exception/NoParentGivenToSubtype.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::NoParentGivenToSubtype; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | sub _build_message { 14 | "A subtype cannot consist solely of a name, it must have a parent"; 15 | } 16 | 17 | __PACKAGE__->meta->make_immutable; 18 | 1; 19 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OnlyInstancesCanBeCloned.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OnlyInstancesCanBeCloned; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'instance' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "You can only clone instances, (".$self->instance.") is not a blessed instance"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OperatorIsRequired.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OperatorIsRequired; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "operator is required"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresAMetaClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresAMetaClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'If you provide an associated_metaclass parameter to the Moose::Meta::Overload constructor it must be a Class::MOP::Module object'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresAMetaMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresAMetaMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'If you provide a method parameter to the Moose::Meta::Overload constructor it must be a Class::MOP::Method object'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresAMetaOverload.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresAMetaOverload; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'If you provide an original_overload parameter to the Moose::Meta::Overload constructor it must be a Moose::Meta::Overload object'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresAMethodNameOrCoderef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresAMethodNameOrCoderef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'You must provide a method_name or coderef parameter when constructing a Moose::Meta::Overload object'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresAnOperator.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresAnOperator; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'You must provide an operator parameter when constructing a Moose::Meta::Overload object'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/OverloadRequiresNamesForCoderef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::OverloadRequiresNamesForCoderef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | my $self = shift; 9 | 'If you provide a coderef parameter to the Moose::Meta::Overload constructor you must also provide coderef_package and coderef_name parameters'; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/PackageDoesNotUseMooseExporter.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::PackageDoesNotUseMooseExporter; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'package' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1 11 | ); 12 | 13 | has 'is_loaded' => ( 14 | is => 'ro', 15 | isa => 'Bool', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | my $package = $self->package; 22 | return "Package in also ($package) does not seem to " 23 | . "use Moose::Exporter" 24 | . ( $self->is_loaded ? "" : " (is it loaded?)" ); 25 | } 26 | 27 | __PACKAGE__->meta->make_immutable; 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Moose/Exception/PackageNameAndNameParamsNotGivenToWrap.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::PackageNameAndNameParamsNotGivenToWrap; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'code' => ( 9 | is => 'ro', 10 | isa => 'CodeRef', 11 | required => 1 12 | ); 13 | 14 | has 'class' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | "You must supply the package_name and name parameters"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/PackagesAndModulesAreNotCachable.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::PackagesAndModulesAreNotCachable; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'is_module' => ( 9 | is => 'ro', 10 | isa => 'Bool', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $is_module = $self->is_module; 17 | 18 | if( $is_module ) { 19 | return "Modules are not cacheable"; 20 | } else { 21 | return "Packages are not cacheable"; 22 | } 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/ReferencesAreNotAllowedAsDefault.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::ReferencesAreNotAllowedAsDefault; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'attribute_name' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "References are not allowed as default values, you must wrap the default of '". 23 | $self->attribute_name."' in a CODE reference (ex: sub { [] } and not [])"; 24 | } 25 | 26 | __PACKAGE__->meta->make_immutable; 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RequiredAttributeLacksInitialization.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RequiredAttributeLacksInitialization; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | "A required attribute must have either 'init_arg', 'builder', or 'default'"; 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RequiredAttributeNeedsADefault.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RequiredAttributeNeedsADefault; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You cannot have a required attribute (".$self->attribute_name.") without a default, builder, or an init_arg"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/Attribute.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::Attribute; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'attribute' => ( 7 | is => 'ro', 8 | isa => 'Class::MOP::Attribute', 9 | predicate => 'is_attribute_set' 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/AttributeName.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::AttributeName; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'attribute_name' => ( 7 | is => 'ro', 8 | isa => 'Str', 9 | required => 1 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/Class.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::Class; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'class_name' => ( 7 | is => 'ro', 8 | isa => 'Str', 9 | required => 1, 10 | documentation => "This attribute can be used for fetching metaclass instance:\n". 11 | " my \$metaclass_instance = Moose::Util::find_meta( \$exception->class_name );\n", 12 | ); 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/Instance.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::Instance; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'instance' => ( 7 | is => 'ro', 8 | isa => 'Object', 9 | required => 1, 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/InstanceClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::InstanceClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'instance_class' => ( 7 | is => 'ro', 8 | isa => 'Str', 9 | required => 1, 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/InvalidAttributeOptions.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::InvalidAttributeOptions; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | with 'Moose::Exception::Role::ParamsHash'; 6 | 7 | has 'attribute_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/Method.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::Method; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'method' => ( 7 | is => 'ro', 8 | isa => 'Moose::Meta::Method', 9 | required => 1, 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/ParamsHash.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::ParamsHash; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'params' => ( 7 | is => 'ro', 8 | isa => 'HashRef', 9 | required => 1, 10 | ); 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/Role.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::Role; 2 | our $VERSION = '2.2208'; 3 | 4 | # use Moose::Util 'throw_exception'; 5 | use Moose::Role; 6 | 7 | has 'role_name' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | documentation => "This attribute can be used for fetching the class's metaclass instance:\n". 12 | " my \$metaclass_instance = Moose::Util::find_meta( \$exception->role_name );\n", 13 | 14 | ); 15 | 16 | 1; 17 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/RoleForCreate.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::RoleForCreate; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | with 'Moose::Exception::Role::ParamsHash'; 6 | 7 | has 'attribute_class' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/RoleForCreateMOPClass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::RoleForCreateMOPClass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | with 'Moose::Exception::Role::ParamsHash'; 6 | 7 | has 'class' => ( 8 | is => 'ro', 9 | isa => 'Str', 10 | required => 1, 11 | ); 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/Role/TypeConstraint.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::Role::TypeConstraint; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose::Role; 5 | 6 | has 'type_name' => ( 7 | is => 'ro', 8 | isa => 'Str', 9 | required => 1, 10 | documentation => "This attribute can be used for fetching type constraint(Moose::Meta::TypeConstraint):\n". 11 | " my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->type_name );\n", 12 | ); 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RoleNameRequired.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RoleNameRequired; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Class'; 7 | 8 | sub _build_message { 9 | "You must supply a role name to look for"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RoleNameRequiredForMooseMetaRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RoleNameRequiredForMooseMetaRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | sub _build_message { 9 | "You must supply a role name to look for"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesDoNotSupportAugment.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesDoNotSupportAugment; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "Roles cannot support 'augment'"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesDoNotSupportExtends.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesDoNotSupportExtends; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "Roles do not support 'extends' (you can use 'with' to specialize a role)"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesDoNotSupportInner.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesDoNotSupportInner; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "Roles cannot support 'inner'"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesDoNotSupportRegexReferencesForMethodModifiers.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesDoNotSupportRegexReferencesForMethodModifiers; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Role'; 7 | 8 | has 'modifier_type' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Roles do not currently support regex references for ".$self->modifier_type." method modifiers"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesInCreateTakesAnArrayRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesInCreateTakesAnArrayRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "You must pass an ARRAY ref of roles"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/RolesListMustBeInstancesOfMooseMetaRole.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::RolesListMustBeInstancesOfMooseMetaRole; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'class' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | has 'role' => ( 15 | is => 'ro', 16 | isa => 'Any', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "The list of roles must be instances of Moose::Meta::Role, not ".$self->role; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/SingleParamsToNewMustBeHashRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::SingleParamsToNewMustBeHashRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "Single parameters to new() must be a HASH ref"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/TriggerMustBeACodeRef.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::TriggerMustBeACodeRef; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::InvalidAttributeOptions'; 7 | 8 | sub _build_message { 9 | my $self = shift; 10 | "Trigger must be a CODE ref on attribute (".$self->attribute_name.")"; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::TypeParameterMustBeMooseMetaType; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::TypeConstraint'; 7 | 8 | sub _build_message { 9 | "The type parameter must be a Moose meta type"; 10 | } 11 | 12 | __PACKAGE__->meta->make_immutable; 13 | 1; 14 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UnableToCanonicalizeHandles.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UnableToCanonicalizeHandles; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'handles' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Unable to canonicalize the 'handles' option with ".$self->handles; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UnableToCanonicalizeNonRolePackage.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UnableToCanonicalizeNonRolePackage; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'handles' => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1, 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "Unable to canonicalize the 'handles' option with ".$self->handles." because its metaclass is not a Moose::Meta::Role"; 17 | } 18 | 19 | __PACKAGE__->meta->make_immutable; 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UnableToRecognizeDelegateMetaclass.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UnableToRecognizeDelegateMetaclass; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::Attribute'; 7 | 8 | has 'delegate_metaclass' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | my $meta = $self->delegate_metaclass; 17 | 18 | return "Unable to recognize the delegate metaclass '$meta'"; 19 | } 20 | 21 | __PACKAGE__->meta->make_immutable; 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UndefinedHashKeysPassedToMethod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UndefinedHashKeysPassedToMethod; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'hash_keys' => ( 8 | is => 'ro', 9 | isa => 'ArrayRef', 10 | required => 1 11 | ); 12 | 13 | has 'method_name' => ( 14 | is => 'ro', 15 | isa => 'Str', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | my $self = shift; 21 | "Hash keys passed to ".$self->method_name." must be defined"; 22 | } 23 | 24 | __PACKAGE__->meta->make_immutable; 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UnionCalledWithAnArrayRefAndAdditionalArgs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UnionCalledWithAnArrayRefAndAdditionalArgs; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | has 'array' => ( 8 | is => 'ro', 9 | isa => 'ArrayRef', 10 | required => 1 11 | ); 12 | 13 | has 'args' => ( 14 | is => 'ro', 15 | isa => 'ArrayRef', 16 | required => 1 17 | ); 18 | 19 | sub _build_message { 20 | "union called with an array reference and additional arguments"; 21 | } 22 | 23 | __PACKAGE__->meta->make_immutable; 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Exception/UnionTakesAtleastTwoTypeNames.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::UnionTakesAtleastTwoTypeNames; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | 7 | sub _build_message { 8 | "You must pass in at least 2 type names to make a union"; 9 | } 10 | 11 | __PACKAGE__->meta->make_immutable; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Moose/Exception/WrapTakesACodeRefToBless.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::WrapTakesACodeRefToBless; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has 'code' => ( 9 | is => 'ro', 10 | isa => 'Any', 11 | required => 1 12 | ); 13 | 14 | has 'class' => ( 15 | is => 'ro', 16 | isa => 'Str', 17 | required => 1 18 | ); 19 | 20 | sub _build_message { 21 | my $self = shift; 22 | "You must supply a CODE reference to bless, not (" . ( $self->code ? $self->code : 'undef' ) . ")"; 23 | } 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Exception/WrongTypeConstraintGiven.pm: -------------------------------------------------------------------------------- 1 | package Moose::Exception::WrongTypeConstraintGiven; 2 | our $VERSION = '2.2208'; 3 | 4 | use Moose; 5 | extends 'Moose::Exception'; 6 | with 'Moose::Exception::Role::ParamsHash'; 7 | 8 | has [qw/required_type given_type attribute_name/] => ( 9 | is => 'ro', 10 | isa => 'Str', 11 | required => 1 12 | ); 13 | 14 | sub _build_message { 15 | my $self = shift; 16 | "The type constraint for ".$self->attribute_name." must be a subtype of " 17 | .$self->required_type." but it's a ".$self->given_type; 18 | } 19 | 20 | __PACKAGE__->meta->make_immutable; 21 | 1; 22 | -------------------------------------------------------------------------------- /lib/Moose/Intro.pod: -------------------------------------------------------------------------------- 1 | # PODNAME: Moose::Intro 2 | # ABSTRACT: Expanded into Moose::Manual, so go read that 3 | =pod 4 | 5 | =head1 DESCRIPTION 6 | 7 | The intro has been replaced by L. This POD document 8 | still exists for the benefit of anyone out there who might've linked 9 | to it in the past. 10 | 11 | =cut 12 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/Writer.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::Writer; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer', 10 | 'Moose::Meta::Method::Accessor::Native::Array', 11 | 'Moose::Meta::Method::Accessor::Native::Collection'; 12 | 13 | sub _inline_coerce_new_values { 14 | my $self = shift; 15 | $self->Moose::Meta::Method::Accessor::Native::Collection::_inline_coerce_new_values(@_); 16 | } 17 | 18 | sub _new_members { '@_' } 19 | 20 | sub _copy_old_value { 21 | my $self = shift; 22 | my ($slot_access) = @_; 23 | 24 | return '[ @{(' . $slot_access . ')} ]'; 25 | } 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/clear.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::clear; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Array::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _adds_members { 0 } 14 | 15 | sub _potential_value { '[]' } 16 | 17 | sub _inline_optimized_set_new_value { 18 | my $self = shift; 19 | my ($inv, $new, $slot_access) = @_; 20 | 21 | return $slot_access . ' = [];'; 22 | } 23 | 24 | sub _return_value { '' } 25 | 26 | no Moose::Role; 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/count.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::count; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'scalar @{ (' . $slot_access . ') }'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/elements.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::elements; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return '@{ (' . $slot_access . ') }'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/get.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::get; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Class::MOP::MiniTrait; 8 | 9 | use Moose::Role; 10 | 11 | with 'Moose::Meta::Method::Accessor::Native::Reader', 12 | 'Moose::Meta::Method::Accessor::Native::Array'; 13 | 14 | sub _minimum_arguments { 1 } 15 | 16 | sub _maximum_arguments { 1 } 17 | 18 | sub _inline_check_arguments { 19 | my $self = shift; 20 | 21 | return $self->_inline_check_var_is_valid_index('$_[0]'); 22 | } 23 | 24 | sub _return_value { 25 | my $self = shift; 26 | my ($slot_access) = @_; 27 | 28 | return $slot_access . '->[ $_[0] ]'; 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/is_empty.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::is_empty; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return '@{ (' . $slot_access . ') } ? 0 : 1'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/shallow_clone.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::shallow_clone; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Params::Util (); 8 | 9 | use Moose::Role; 10 | 11 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 12 | 13 | sub _minimum_arguments { 0 } 14 | 15 | sub _maximum_arguments { 0 } 16 | 17 | sub _return_value { 18 | my $self = shift; 19 | my ($slot_access) = @_; 20 | 21 | return '[ @{ (' . $slot_access . ') } ]'; 22 | } 23 | 24 | no Moose::Role; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/shuffle.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::shuffle; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use List::Util (); 8 | 9 | use Moose::Role; 10 | 11 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 12 | 13 | sub _maximum_arguments { 0 } 14 | 15 | sub _return_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return 'List::Util::shuffle @{ (' . $slot_access . ') }'; 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Array/uniq.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Array::uniq; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use List::Util 1.45 (); 8 | 9 | use Moose::Role; 10 | 11 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 12 | 13 | sub _maximum_arguments { 0 } 14 | 15 | sub _return_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return 'List::Util::uniq @{ (' . $slot_access . ') }'; 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Bool/not.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Bool::not; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return '!' . $slot_access; 18 | } 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Bool::set; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _potential_value { 1 } 14 | 15 | sub _inline_optimized_set_new_value { 16 | my $self = shift; 17 | my ($inv, $new, $slot_access) = @_; 18 | 19 | return $slot_access . ' = 1;'; 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Bool::toggle; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _potential_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return $slot_access . ' ? 0 : 1'; 18 | } 19 | 20 | sub _inline_optimized_set_new_value { 21 | my $self = shift; 22 | my ($inv, $new, $slot_access) = @_; 23 | 24 | return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;'; 25 | } 26 | 27 | no Moose::Role; 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Bool::unset; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _potential_value { 0 } 14 | 15 | sub _inline_optimized_set_new_value { 16 | my $self = shift; 17 | my ($inv, $new, $slot_access) = @_; 18 | 19 | return $slot_access . ' = 0;'; 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Code/execute.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Code::execute; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _return_value { 12 | my $self = shift; 13 | my ($slot_access) = @_; 14 | 15 | return $slot_access . '->(@_)'; 16 | } 17 | 18 | no Moose::Role; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Code/execute_method.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Code::execute_method; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _return_value { 12 | my $self = shift; 13 | my ($slot_access) = @_; 14 | 15 | return $slot_access . '->($self, @_)'; 16 | } 17 | 18 | no Moose::Role; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Counter/Writer.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Counter::Writer; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _constraint_must_be_checked { 12 | my $self = shift; 13 | 14 | my $attr = $self->associated_attribute; 15 | 16 | return $attr->has_type_constraint 17 | && ($attr->type_constraint->name =~ /^(?:Num|Int)$/ 18 | || ($attr->should_coerce && $attr->type_constraint->has_coercion) 19 | ); 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Counter/dec.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Counter::dec; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 0 } 12 | sub _maximum_arguments { 1 } 13 | 14 | sub _potential_value { 15 | my $self = shift; 16 | my ($slot_access) = @_; 17 | 18 | return $slot_access . ' - (defined $_[0] ? $_[0] : 1)'; 19 | } 20 | 21 | sub _inline_optimized_set_new_value { 22 | my $self = shift; 23 | my ($inv, $new, $slot_access) = @_; 24 | 25 | return $slot_access . ' -= defined $_[0] ? $_[0] : 1;'; 26 | } 27 | 28 | no Moose::Role; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Counter/inc.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Counter::inc; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 0 } 12 | sub _maximum_arguments { 1 } 13 | 14 | sub _potential_value { 15 | my $self = shift; 16 | my ($slot_access) = @_; 17 | 18 | return $slot_access . ' + (defined $_[0] ? $_[0] : 1)'; 19 | } 20 | 21 | sub _inline_optimized_set_new_value { 22 | my $self = shift; 23 | my ($inv, $new, $slot_access) = @_; 24 | 25 | return $slot_access . ' += defined $_[0] ? $_[0] : 1;'; 26 | } 27 | 28 | no Moose::Role; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Counter/set.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Counter::set; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | sub _maximum_arguments { 1 } 13 | 14 | sub _potential_value { '$_[0]' } 15 | 16 | sub _inline_optimized_set_new_value { 17 | my $self = shift; 18 | my ($inv, $new, $slot_access) = @_; 19 | 20 | return $slot_access . ' = $_[0];'; 21 | } 22 | 23 | no Moose::Role; 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/count.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::count; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'scalar keys %{ (' . $slot_access . ') }'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/defined.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::defined; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader', 10 | 'Moose::Meta::Method::Accessor::Native::Hash'; 11 | 12 | sub _minimum_arguments { 1 } 13 | 14 | sub _maximum_arguments { 1 } 15 | 16 | sub _inline_check_arguments { 17 | my $self = shift; 18 | 19 | return $self->_inline_check_var_is_valid_key('$_[0]'); 20 | } 21 | 22 | sub _return_value { 23 | my $self = shift; 24 | my ($slot_access) = @_; 25 | 26 | return 'defined ' . $slot_access . '->{ $_[0] }'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/elements.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::elements; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'map { $_, ' . $slot_access . '->{$_} } ' 18 | . 'keys %{ (' . $slot_access . ') }'; 19 | } 20 | 21 | no Moose::Role; 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/exists.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::exists; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader', 10 | 'Moose::Meta::Method::Accessor::Native::Hash'; 11 | 12 | sub _minimum_arguments { 1 } 13 | 14 | sub _maximum_arguments { 1 } 15 | 16 | sub _inline_check_arguments { 17 | my $self = shift; 18 | 19 | return $self->_inline_check_var_is_valid_key('$_[0]'); 20 | } 21 | 22 | sub _return_value { 23 | my $self = shift; 24 | my ($slot_access) = shift; 25 | 26 | return 'exists ' . $slot_access . '->{ $_[0] }'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/is_empty.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::is_empty; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'scalar keys %{ (' . $slot_access . ') } ? 0 : 1'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/keys.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::keys; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'keys %{ (' . $slot_access . ') }'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/kv.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::kv; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'map { [ $_, ' . $slot_access . '->{$_} ] } ' 18 | . 'keys %{ (' . $slot_access . ') }'; 19 | } 20 | 21 | no Moose::Role; 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/shallow_clone.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::shallow_clone; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Params::Util (); 8 | 9 | use Moose::Role; 10 | 11 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 12 | 13 | sub _minimum_arguments { 0 } 14 | 15 | sub _maximum_arguments { 0 } 16 | 17 | sub _return_value { 18 | my $self = shift; 19 | my ($slot_access) = @_; 20 | 21 | return '{ %{ (' . $slot_access . ') } }'; 22 | } 23 | 24 | no Moose::Role; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Hash/values.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Hash::values; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'values %{ (' . $slot_access . ') }'; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/abs.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::abs; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _potential_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'abs(' . $slot_access . ')'; 18 | } 19 | 20 | sub _inline_optimized_set_new_value { 21 | my $self = shift; 22 | my ($inv, $new, $slot_access) = @_; 23 | 24 | return $slot_access . ' = abs(' . $slot_access . ');'; 25 | } 26 | 27 | no Moose::Role; 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/add.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::add; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return $slot_access . ' + $_[0]'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' += $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/div.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::div; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return $slot_access . ' / $_[0]'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' /= $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/mod.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::mod; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return $slot_access . ' % $_[0]'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' %= $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/mul.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::mul; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return $slot_access . ' * $_[0]'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' *= $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/set.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::set; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | sub _maximum_arguments { 1 } 13 | 14 | sub _potential_value { '$_[0]' } 15 | 16 | sub _inline_optimized_set_new_value { 17 | my $self = shift; 18 | my ($inv, $new, $slot_access) = @_; 19 | 20 | return $slot_access . ' = $_[0];'; 21 | } 22 | 23 | no Moose::Role; 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/Number/sub.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::Number::sub; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return $slot_access . ' - $_[0]'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' -= $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/String/append.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::String::append; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return '( ' . $slot_access . ' . $_[0] )'; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' .= $_[0];'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/String/clear.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::String::clear; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _potential_value { '""' } 14 | 15 | sub _inline_optimized_set_new_value { 16 | my $self = shift; 17 | my ($inv, $new, $slot_access) = @_; 18 | 19 | return $slot_access . ' = "";'; 20 | } 21 | 22 | no Moose::Role; 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/String/length.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::String::length; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Reader'; 10 | 11 | sub _maximum_arguments { 0 } 12 | 13 | sub _return_value { 14 | my $self = shift; 15 | my ($slot_access) = @_; 16 | 17 | return 'length ' . $slot_access; 18 | } 19 | 20 | no Moose::Role; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Moose/Meta/Method/Accessor/Native/String/prepend.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Method::Accessor::Native::String::prepend; 2 | our $VERSION = '2.2208'; 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use Moose::Role; 8 | 9 | with 'Moose::Meta::Method::Accessor::Native::Writer'; 10 | 11 | sub _minimum_arguments { 1 } 12 | 13 | sub _maximum_arguments { 1 } 14 | 15 | sub _potential_value { 16 | my $self = shift; 17 | my ($slot_access) = @_; 18 | 19 | return '$_[0] . ' . $slot_access; 20 | } 21 | 22 | sub _inline_optimized_set_new_value { 23 | my $self = shift; 24 | my ($inv, $new, $slot_access) = @_; 25 | 26 | return $slot_access . ' = $_[0] . ' . $slot_access . ';'; 27 | } 28 | 29 | no Moose::Role; 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Moose/Unsweetened.pod: -------------------------------------------------------------------------------- 1 | # PODNAME: Moose::Unsweetened 2 | # ABSTRACT: Moved to Moose::Manual::Unsweetened, so go read that 3 | 4 | =pod 5 | 6 | =head1 DESCRIPTION 7 | 8 | This document has been moved to L. This 9 | POD document still exists for the benefit of anyone out there who 10 | might've linked to it in the past. 11 | 12 | =cut 13 | -------------------------------------------------------------------------------- /perltidyrc: -------------------------------------------------------------------------------- 1 | -l=78 2 | -i=4 3 | -ci=4 4 | -se 5 | -b 6 | -bar 7 | -boc 8 | -vt=0 9 | -vtc=0 10 | -cti=0 11 | -pt=1 12 | -bt=1 13 | -sbt=1 14 | -bbt=1 15 | -nolq 16 | -npro 17 | -nsfs 18 | --blank-lines-before-packages=0 19 | --opening-hash-brace-right 20 | --no-outdent-long-comments 21 | --iterations=2 22 | -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" 23 | -------------------------------------------------------------------------------- /t/000_load.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | BEGIN { 7 | use_ok('Moose'); 8 | } 9 | 10 | done_testing; 11 | -------------------------------------------------------------------------------- /t/attributes/accessor_inlining.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | my $called; 6 | { 7 | package Foo::Meta::Instance; 8 | use Moose::Role; 9 | 10 | sub is_inlinable { 0 } 11 | 12 | after get_slot_value => sub { $called++ }; 13 | } 14 | 15 | { 16 | package Foo; 17 | use Moose; 18 | Moose::Util::MetaRole::apply_metaroles( 19 | for => __PACKAGE__, 20 | class_metaroles => { 21 | instance => ['Foo::Meta::Instance'], 22 | }, 23 | ); 24 | 25 | has foo => (is => 'ro'); 26 | } 27 | 28 | my $foo = Foo->new(foo => 1); 29 | is($foo->foo, 1, "got the right value"); 30 | is($called, 1, "reader was called"); 31 | 32 | done_testing; 33 | -------------------------------------------------------------------------------- /t/attributes/attribute_without_any_methods.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | use Moose (); 7 | use Moose::Meta::Class; 8 | 9 | my $meta = Moose::Meta::Class->create('Banana'); 10 | 11 | my $warn; 12 | $SIG{__WARN__} = sub { $warn = "@_" }; 13 | 14 | $meta->add_attribute('foo'); 15 | like $warn, qr/Attribute \(foo\) of class Banana has no associated methods/, 16 | 'correct error message'; 17 | 18 | $warn = ''; 19 | $meta->add_attribute('bar', is => 'bare'); 20 | is $warn, '', 'add attribute with no methods and is => "bare"'; 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/attributes/default_undef.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | use Test::Moose; 5 | 6 | { 7 | package Foo; 8 | use Moose; 9 | 10 | has foo => ( 11 | is => 'ro', 12 | isa => 'Maybe[Int]', 13 | default => undef, 14 | predicate => 'has_foo', 15 | ); 16 | } 17 | 18 | with_immutable { 19 | is(Foo->new->foo, undef); 20 | ok(Foo->new->has_foo); 21 | } 'Foo'; 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/attributes/lazy_no_default.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | { 8 | package Foo; 9 | use Moose; 10 | 11 | ::like( 12 | ::exception{ has foo => ( 13 | is => 'ro', 14 | lazy => 1, 15 | ); 16 | }, 17 | qr/\QYou cannot have a lazy attribute (foo) without specifying a default value for it/, 18 | 'lazy without a default or builder throws an error' 19 | ); 20 | } 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/attributes/no_init_arg.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | 7 | 8 | { 9 | package Foo; 10 | use Moose; 11 | 12 | eval { 13 | has 'foo' => ( 14 | is => "rw", 15 | init_arg => undef, 16 | ); 17 | }; 18 | ::ok(!$@, '... created the attr okay'); 19 | } 20 | 21 | { 22 | my $foo = Foo->new( foo => "bar" ); 23 | isa_ok($foo, 'Foo'); 24 | 25 | is( $foo->foo, undef, "field is not set via init arg" ); 26 | 27 | $foo->foo("blah"); 28 | 29 | is( $foo->foo, "blah", "field is set via setter" ); 30 | } 31 | 32 | done_testing; 33 | -------------------------------------------------------------------------------- /t/basics/deprecations.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | use Moose (); 7 | use Moose::Util::TypeConstraints; 8 | 9 | { 10 | my $warnings; 11 | local $SIG{__WARN__} = sub { $warnings .= $_[0] }; 12 | enum Foo => qw(Bar Baz Quux); 13 | like($warnings, qr/Passing a list of values to enum is deprecated\. Enum values should be wrapped in an arrayref\./); 14 | } 15 | 16 | { 17 | my $warnings; 18 | local $SIG{__WARN__} = sub { $warnings .= $_[0] }; 19 | duck_type Bar => qw(baz quux); 20 | like($warnings, qr/Passing a list of values to duck_type is deprecated\. The method names should be wrapped in an arrayref\./); 21 | } 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/basics/error_handling.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | # This tests the error handling in Moose::Object only 8 | 9 | { 10 | package Foo; 11 | use Moose; 12 | } 13 | 14 | like( exception { Foo->new('bad') }, qr/^\QSingle parameters to new() must be a HASH ref/, 'A single non-hashref arg to a constructor throws an error' ); 15 | like( exception { Foo->new(undef) }, qr/^\QSingle parameters to new() must be a HASH ref/, 'A single non-hashref arg to a constructor throws an error' ); 16 | 17 | like( exception { Foo->does() }, qr/^\QYou must supply a role name to does()/, 'Cannot call does() without a role name' ); 18 | 19 | done_testing; 20 | -------------------------------------------------------------------------------- /t/basics/global-destruction-helper.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | 7 | { 8 | package Foo; 9 | use Moose; 10 | 11 | sub DEMOLISH { 12 | my $self = shift; 13 | my ($igd) = @_; 14 | 15 | print $igd; 16 | } 17 | } 18 | 19 | { 20 | package Bar; 21 | use Moose; 22 | 23 | sub DEMOLISH { 24 | my $self = shift; 25 | my ($igd) = @_; 26 | 27 | print $igd; 28 | } 29 | 30 | __PACKAGE__->meta->make_immutable; 31 | } 32 | 33 | our $foo = Foo->new; 34 | our $bar = Bar->new; 35 | -------------------------------------------------------------------------------- /t/basics/load_into_main.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | is( exception { 8 | eval 'use Moose'; 9 | }, undef, "export to main" ); 10 | 11 | isa_ok( main->meta, "Moose::Meta::Class" ); 12 | 13 | isa_ok( main->new, "main"); 14 | isa_ok( main->new, "Moose::Object" ); 15 | 16 | done_testing; 17 | -------------------------------------------------------------------------------- /t/basics/universal_methods_wrappable.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Fatal; 5 | use Test::More; 6 | 7 | { 8 | 9 | package FakeBar; 10 | use Moose::Role; 11 | 12 | around isa => sub { 13 | my ( $orig, $self, $v ) = @_; 14 | return 1 if $v eq 'Bar'; 15 | return $orig->( $self, $v ); 16 | }; 17 | 18 | package Foo; 19 | use Moose; 20 | 21 | use Test::More; 22 | 23 | ::is( ::exception { with 'FakeBar' }, undef, 'applied role' ); 24 | 25 | my $foo = Foo->new; 26 | ::isa_ok( $foo, 'Bar' ); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/bugs/Moose_Object_error.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use lib 't/lib'; 5 | 6 | use Test::More; 7 | 8 | use_ok('MyMooseObject'); 9 | 10 | done_testing; 11 | -------------------------------------------------------------------------------- /t/bugs/coerce_without_coercion.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | use Test::Moose; 7 | 8 | { 9 | package Foo; 10 | 11 | use Moose; 12 | 13 | ::like( 14 | ::exception { 15 | has x => ( 16 | is => 'rw', 17 | isa => 'HashRef', 18 | coerce => 1, 19 | ) 20 | }, 21 | qr/You cannot coerce an attribute \(x\) unless its type \(HashRef\) has a coercion/, 22 | "can't set coerce on an attribute whose type constraint has no coercion" 23 | ); 24 | } 25 | 26 | done_testing; 27 | -------------------------------------------------------------------------------- /t/bugs/constructor_object_overload.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | { 6 | package Foo; 7 | 8 | use Moose; 9 | 10 | use overload '""' => sub {''}; 11 | 12 | sub bug { 'plenty' } 13 | 14 | __PACKAGE__->meta->make_immutable; 15 | } 16 | 17 | ok(Foo->new()->bug(), 'call constructor on object reference with overloading'); 18 | 19 | done_testing; 20 | -------------------------------------------------------------------------------- /t/bugs/create_anon_recursion.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | BEGIN { 8 | plan skip_all => "preloading things makes this test meaningless" 9 | if exists $INC{'Moose.pm'}; 10 | } 11 | 12 | use Moose::Meta::Class; 13 | 14 | $SIG{__WARN__} = sub { die if shift =~ /recurs/ }; 15 | 16 | TODO: 17 | { 18 | local $TODO 19 | = 'Loading Moose::Meta::Class without loading Moose.pm causes weird problems'; 20 | 21 | my $meta; 22 | is( exception { 23 | $meta = Moose::Meta::Class->create_anon_class( 24 | superclasses => [ 'Moose::Object', ], 25 | ); 26 | }, undef, 'Class is created successfully' ); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/bugs/delete_sub_stash.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | use Moose (); 6 | 7 | { 8 | package Foo; 9 | sub bar { 'BAR' } 10 | } 11 | 12 | my $method = \&Foo::bar; 13 | 14 | { 15 | no strict 'refs'; 16 | delete ${'::'}{'Foo::'}; 17 | } 18 | 19 | my $meta = Moose::Meta::Class->create('Bar'); 20 | $meta->add_method(bar => $method); 21 | is(Bar->bar, 'BAR'); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/bugs/inheriting_from_roles.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | 8 | { 9 | package My::Role; 10 | use Moose::Role; 11 | } 12 | { 13 | package My::Class; 14 | use Moose; 15 | 16 | ::like( ::exception { 17 | extends 'My::Role'; 18 | }, qr/You cannot inherit from a Moose Role \(My\:\:Role\)/, '... this croaks correctly' ); 19 | } 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/bugs/inline_reader_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | 8 | =pod 9 | 10 | This was a bug, but it is fixed now. This 11 | test makes sure it does not creep back in. 12 | 13 | =cut 14 | 15 | { 16 | package Foo; 17 | use Moose; 18 | 19 | ::is( ::exception { 20 | has 'bar' => ( 21 | is => 'ro', 22 | isa => 'Int', 23 | lazy => 1, 24 | default => 10, 25 | ); 26 | }, undef, '... this didnt die' ); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/bugs/moo_delegation.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Needs 'Moo', 'Test::Warnings'; 5 | use Test::More; 6 | 7 | use Test::Warnings qw( warnings :no_end_test ); 8 | 9 | { 10 | package Foo; 11 | 12 | use Moo; 13 | 14 | has foo => ( 15 | is => 'ro', 16 | handles => ['bar'], 17 | ); 18 | } 19 | 20 | { 21 | package Bar; 22 | 23 | use Moose; 24 | 25 | ::is_deeply( 26 | [ ::warnings { extends 'Foo' } ], 27 | [], 28 | 'no warnings when extending Moo class that has a delegation' 29 | ); 30 | } 31 | 32 | done_testing(); 33 | -------------------------------------------------------------------------------- /t/bugs/native_trait_handles_bad_value.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | { 8 | 9 | package Bug; 10 | use Moose; 11 | 12 | ::like( 13 | ::exception{ has member => ( 14 | is => 'ro', 15 | isa => 'HashRef', 16 | traits => ['Hash'], 17 | handles => { 18 | method => sub { } 19 | }, 20 | ); 21 | }, 22 | qr/\QAll values passed to handles must be strings or ARRAY references, not CODE/, 23 | 'bad value in handles throws a useful error' 24 | ); 25 | } 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/bugs/reader_precedence_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | { 7 | package Foo; 8 | use Moose; 9 | has 'foo' => ( is => 'ro', reader => 'get_foo' ); 10 | } 11 | 12 | { 13 | my $foo = Foo->new(foo => 10); 14 | my $reader = $foo->meta->get_attribute('foo')->reader; 15 | is($reader, 'get_foo', 16 | 'reader => "get_foo" has correct presedence'); 17 | can_ok($foo, 'get_foo'); 18 | is($foo->$reader, 10, "Reader works as expected"); 19 | } 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/bugs/subclass_use_base_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | =pod 7 | 8 | This just makes sure that the Bar gets 9 | a metaclass initialized for it correctly. 10 | 11 | =cut 12 | 13 | { 14 | package Foo; 15 | use Moose; 16 | 17 | package Bar; 18 | use strict; 19 | use warnings; 20 | 21 | use parent -norequire => 'Foo'; 22 | } 23 | 24 | my $bar = Bar->new; 25 | isa_ok($bar, 'Bar'); 26 | isa_ok($bar, 'Foo'); 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /t/bugs/subtype_conflict_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use lib 't/lib'; 5 | 6 | use Test::More; 7 | 8 | use_ok('MyMooseA'); 9 | use_ok('MyMooseB'); 10 | 11 | done_testing; 12 | -------------------------------------------------------------------------------- /t/bugs/subtype_quote_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | =pod 7 | 8 | This is a test for a bug found by Purge on #moose: 9 | The code: 10 | 11 | subtype Stuff 12 | => as Object 13 | => where { ... } 14 | 15 | will break if the Object:: namespace exists. So the 16 | solution is to quote 'Object', like so: 17 | 18 | subtype Stuff 19 | => as 'Object' 20 | => where { ... } 21 | 22 | Moose 0.03 did this, now it doesn't, so all should 23 | be well from now on. 24 | 25 | =cut 26 | 27 | { package Object::Test; } 28 | 29 | { 30 | package Foo; 31 | ::use_ok('Moose'); 32 | } 33 | 34 | done_testing; 35 | -------------------------------------------------------------------------------- /t/cmop/anon_class_leak.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Needs 'Test::LeakTrace'; # skip all if not installed 5 | use Test::More; 6 | use Test::LeakTrace; 7 | 8 | BEGIN { 9 | plan skip_all => 'Leak tests fail under Devel::Cover' if $INC{'Devel/Cover.pm'}; 10 | } 11 | 12 | use Class::MOP; 13 | 14 | # 5.10.0 has a bug on weaken($hash_ref) which leaks an AV. 15 | my $expected = ( "$]" == 5.010_000 ? 1 : 0 ); 16 | 17 | leaks_cmp_ok { 18 | Class::MOP::Class->create_anon_class(); 19 | } 20 | '<=', $expected, 'create_anon_class()'; 21 | 22 | leaks_cmp_ok { 23 | Class::MOP::Class->create_anon_class( superclasses => [qw(Exporter)] ); 24 | } 25 | '<=', $expected, 'create_anon_class(superclass => [...])'; 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/cmop/class_is_pristine.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Class::MOP; 5 | use Test::More; 6 | 7 | { 8 | package Foo; 9 | 10 | sub foo { } 11 | sub bar { } 12 | } 13 | 14 | my $meta = Class::MOP::Class->initialize('Foo'); 15 | ok( $meta->is_pristine, 'Foo is still pristine' ); 16 | 17 | $meta->add_method( baz => sub { } ); 18 | ok( $meta->is_pristine, 'Foo is still pristine after add_method' ); 19 | 20 | $meta->add_attribute( name => 'attr', reader => 'get_attr' ); 21 | ok( ! $meta->is_pristine, 'Foo is not pristine after add_attribute' ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/cmop/constant_codeinfo.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | use Class::MOP; 6 | 7 | { 8 | package Foo; 9 | use constant FOO => 'bar'; 10 | } 11 | 12 | my $meta = Class::MOP::Class->initialize('Foo'); 13 | 14 | my $syms = $meta->get_all_package_symbols('CODE'); 15 | is(ref $syms->{FOO}, 'CODE', 'get constant symbol'); 16 | 17 | undef $syms; 18 | 19 | $syms = $meta->get_all_package_symbols('CODE'); 20 | is(ref $syms->{FOO}, 'CODE', 'constant symbol still there, although we dropped our reference'); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/cmop/inline_and_dollar_at.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | use Class::MOP; 5 | 6 | 7 | { 8 | package Foo; 9 | 10 | my $meta = Class::MOP::Class->initialize(__PACKAGE__); 11 | 12 | $@ = 'dollar at'; 13 | 14 | $meta->make_immutable; 15 | 16 | ::is( $@, 'dollar at', '$@ is untouched after immutablization' ); 17 | } 18 | 19 | done_testing; 20 | -------------------------------------------------------------------------------- /t/cmop/lib/MyMetaClass.pm: -------------------------------------------------------------------------------- 1 | package MyMetaClass; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use parent 'Class::MOP::Class'; 7 | 8 | sub mymetaclass_attributes{ 9 | my $self = shift; 10 | return grep { $_->isa("MyMetaClass::Attribute") } 11 | $self->get_all_attributes; 12 | } 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /t/cmop/lib/MyMetaClass/Attribute.pm: -------------------------------------------------------------------------------- 1 | package MyMetaClass::Attribute; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use parent 'Class::MOP::Attribute'; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/cmop/lib/MyMetaClass/Instance.pm: -------------------------------------------------------------------------------- 1 | package MyMetaClass::Instance; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use parent 'Class::MOP::Instance'; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/cmop/lib/MyMetaClass/Method.pm: -------------------------------------------------------------------------------- 1 | package MyMetaClass::Method; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use parent 'Class::MOP::Method'; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/cmop/lib/MyMetaClass/Random.pm: -------------------------------------------------------------------------------- 1 | package MyMetaClass::Random; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /t/cmop/lib/SyntaxError.pm: -------------------------------------------------------------------------------- 1 | package SyntaxError; 2 | use strict; 3 | use warnings; 4 | 5 | # this syntax error is intentional! 6 | 7 | { 8 | 9 | 1; 10 | -------------------------------------------------------------------------------- /t/cmop/null_stash.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | use Class::MOP; 6 | my $non = Class::MOP::Class->initialize('Non::Existent::Package'); 7 | $non->get_method('foo'); 8 | 9 | pass("empty stashes don't segfault"); 10 | 11 | done_testing; 12 | -------------------------------------------------------------------------------- /t/exceptions/class-mop-method-meta.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose(); 8 | 9 | { 10 | my $exception = exception { 11 | Class::MOP::Method::Meta->wrap("Foo", ( body => 'foo' )); 12 | }; 13 | 14 | like( 15 | $exception, 16 | qr/\QOverriding the body of meta methods is not allowed/, 17 | "body is given to Class::MOP::Method::Meta->wrap"); 18 | 19 | isa_ok( 20 | $exception, 21 | "Moose::Exception::CannotOverrideBodyOfMetaMethods", 22 | "body is given to Class::MOP::Method::Meta->wrap"); 23 | } 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/exceptions/class-mop-method-wrapped.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose(); 8 | 9 | { 10 | my $exception = exception { 11 | Class::MOP::Method::Wrapped->wrap("Foo"); 12 | }; 13 | 14 | like( 15 | $exception, 16 | qr/\QCan only wrap blessed CODE/, 17 | "no CODE is given to wrap"); 18 | 19 | isa_ok( 20 | $exception, 21 | "Moose::Exception::CanOnlyWrapBlessedCode", 22 | "no CODE is given to wrap"); 23 | } 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/exceptions/class-mop-module.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose(); 8 | 9 | { 10 | my $exception = exception { 11 | Class::MOP::Module->create_anon(cache => 1); 12 | }; 13 | 14 | like( 15 | $exception, 16 | qr/Modules are not cacheable/, 17 | "can't cache anon packages"); 18 | 19 | isa_ok( 20 | $exception, 21 | "Moose::Exception::PackagesAndModulesAreNotCachable", 22 | "can't cache anon packages"); 23 | } 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/exceptions/cmop.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Class::MOP; 8 | 9 | { 10 | my $exception = exception { 11 | Class::MOP::Mixin->_throw_exception(Legacy => message => 'oh hai'); 12 | }; 13 | ok( 14 | $exception->isa('Moose::Exception::Legacy'), 15 | 'threw the right type', 16 | ); 17 | is($exception->message, 'oh hai', 'got the message attribute'); 18 | } 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/exceptions/frame-leak.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Needs 'Test::Memory::Cycle'; 5 | use Test::More; 6 | use Test::Fatal; 7 | use Test::Memory::Cycle; 8 | 9 | BEGIN { 10 | plan skip_all => 'Leak tests fail under Devel::Cover' if $INC{'Devel/Cover.pm'}; 11 | } 12 | 13 | { 14 | package Foo; 15 | use Moose; 16 | has myattr => ( is => 'ro', required => 1 ); 17 | } 18 | 19 | memory_cycle_ok( 20 | exception { Foo->new() }, 21 | 'exception objects do not leak arguments into Devel::StackTrace objects', 22 | ); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/exceptions/moose-meta-class-immutable-trait.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose(); 8 | 9 | { 10 | my $exception = exception { 11 | package Foo; 12 | use Moose; 13 | 14 | __PACKAGE__->meta->make_immutable; 15 | Foo->meta->does_role; 16 | }; 17 | 18 | like( 19 | $exception, 20 | qr/You must supply a role name to look for/, 21 | "no role_name supplied to does_role"); 22 | 23 | isa_ok( 24 | $exception, 25 | "Moose::Exception::RoleNameRequired", 26 | "no role_name supplied to does_role"); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/exceptions/moose-meta-method-augmented.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose(); 8 | 9 | { 10 | my $exception = exception { 11 | package Foo; 12 | use Moose; 13 | 14 | augment 'foo' => sub {}; 15 | }; 16 | 17 | like( 18 | $exception, 19 | qr/You cannot augment 'foo' because it has no super method/, 20 | "'Foo' has no super class"); 21 | 22 | isa_ok( 23 | $exception, 24 | "Moose::Exception::CannotAugmentNoSuperMethod", 25 | "'Foo' has no super class"); 26 | 27 | is( 28 | $exception->method_name, 29 | 'foo', 30 | "'Foo' has no super class"); 31 | } 32 | 33 | done_testing; 34 | -------------------------------------------------------------------------------- /t/exceptions/moose-meta-typeconstraint-registry.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose; 8 | 9 | { 10 | my $tr = Moose::Meta::TypeConstraint::Registry->new(); 11 | 12 | my $exception = exception { 13 | $tr->add_type_constraint('xyz'); 14 | }; 15 | 16 | like( 17 | $exception, 18 | qr!No type supplied / type is not a valid type constraint!, 19 | "'xyz' is not a Moose::Meta::TypeConstraint"); 20 | 21 | isa_ok( 22 | $exception, 23 | 'Moose::Exception::InvalidTypeConstraint', 24 | "'xyz' is not a Moose::Meta::TypeConstraint"); 25 | } 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/immutable/constructor_is_wrapped.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Needs 'Test::Output'; # skip all if not installed 5 | use Test::More; 6 | 7 | use Test::Output; 8 | 9 | { 10 | package ModdedNew; 11 | use Moose; 12 | 13 | before 'new' => sub { }; 14 | } 15 | 16 | { 17 | package Foo; 18 | use Moose; 19 | 20 | extends 'ModdedNew'; 21 | 22 | ::stderr_like( 23 | sub { Foo->meta->make_immutable }, 24 | qr/\QNot inlining 'new' for Foo since it has method modifiers which would be lost if it were inlined/, 25 | 'got a warning that Foo may not have an inlined constructor' 26 | ); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/immutable/immutable_destroy.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | { 6 | package FooBar; 7 | use Moose; 8 | 9 | has 'name' => ( is => 'ro' ); 10 | 11 | sub DESTROY { shift->name } 12 | 13 | local $SIG{__WARN__} = sub {}; 14 | __PACKAGE__->meta->make_immutable; 15 | } 16 | 17 | my $f = FooBar->new( name => 'SUSAN' ); 18 | 19 | is( $f->DESTROY, 'SUSAN', 'Did moose overload DESTROY?' ); 20 | 21 | done_testing; 22 | -------------------------------------------------------------------------------- /t/immutable/immutable_meta_class.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | 8 | { 9 | package My::Meta; 10 | 11 | use Moose; 12 | 13 | extends 'Moose::Meta::Class'; 14 | 15 | has 'meta_size' => ( 16 | is => 'rw', 17 | isa => 'Int', 18 | ); 19 | } 20 | 21 | is( exception { 22 | My::Meta->meta()->make_immutable(debug => 0) 23 | }, undef, '... can make a meta class immutable' ); 24 | 25 | done_testing; 26 | -------------------------------------------------------------------------------- /t/lib/Bar.pm: -------------------------------------------------------------------------------- 1 | package Bar; 2 | use Moose; 3 | use Moose::Util::TypeConstraints; 4 | 5 | type Baz => where { 1 }; 6 | 7 | subtype Bling => as Baz => where { 1 }; 8 | 9 | 1; -------------------------------------------------------------------------------- /t/lib/Bar7/Meta/Trait.pm: -------------------------------------------------------------------------------- 1 | package Bar7::Meta::Trait; 2 | use Moose::Role; 3 | 4 | around _immutable_options => sub { }; 5 | 6 | no Moose::Role; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/lib/Bar7/Meta/Trait2.pm: -------------------------------------------------------------------------------- 1 | package Bar7::Meta::Trait2; 2 | use Moose::Role; 3 | 4 | has foo => ( 5 | traits => ['Array'], 6 | handles => { 7 | push_foo => 'push', 8 | }, 9 | ); 10 | 11 | no Moose::Role; 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /t/lib/Foo.pm: -------------------------------------------------------------------------------- 1 | package Foo; 2 | use Moose; 3 | 4 | has 'bar' => (is => 'rw'); 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /t/lib/Moose/Meta/Attribute/Custom/Bar.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Attribute::Custom::Bar; 2 | 3 | sub register_implementation { 'My::Bar' } 4 | 5 | 6 | package My::Bar; 7 | 8 | use Moose::Role; 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /t/lib/Moose/Meta/Attribute/Custom/Foo.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Attribute::Custom::Foo; 2 | 3 | use Moose::Role; 4 | 5 | 1; 6 | -------------------------------------------------------------------------------- /t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Attribute::Custom::Trait::Bar; 2 | 3 | sub register_implementation { 'My::Trait::Bar' } 4 | 5 | 6 | package My::Trait::Bar; 7 | 8 | use Moose::Role; 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm: -------------------------------------------------------------------------------- 1 | package Moose::Meta::Attribute::Custom::Trait::Foo; 2 | 3 | use Moose::Role; 4 | 5 | 1; 6 | -------------------------------------------------------------------------------- /t/lib/MyExporter.pm: -------------------------------------------------------------------------------- 1 | package MyExporter; 2 | use Moose::Exporter; 3 | use Test::More; 4 | 5 | Moose::Exporter->setup_import_methods( 6 | with_meta => [qw(with_prototype)], 7 | as_is => [qw(as_is_prototype)], 8 | ); 9 | 10 | sub with_prototype (&) { 11 | my ($class, $code) = @_; 12 | isa_ok($code, 'CODE', 'with_prototype received a coderef'); 13 | $code->(); 14 | } 15 | 16 | sub as_is_prototype (&) { 17 | my ($code) = @_; 18 | isa_ok($code, 'CODE', 'as_is_prototype received a coderef'); 19 | $code->(); 20 | } 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /t/lib/MyMetaclassRole.pm: -------------------------------------------------------------------------------- 1 | package MyMetaclassRole; 2 | use Moose::Role; 3 | 4 | 1; 5 | -------------------------------------------------------------------------------- /t/lib/MyMooseA.pm: -------------------------------------------------------------------------------- 1 | package MyMooseA; 2 | 3 | use Moose; 4 | 5 | has 'b' => (is => 'rw', isa => 'MyMooseB'); 6 | 7 | 1; -------------------------------------------------------------------------------- /t/lib/MyMooseB.pm: -------------------------------------------------------------------------------- 1 | package MyMooseB; 2 | 3 | use Moose; 4 | 5 | 1; -------------------------------------------------------------------------------- /t/lib/MyMooseObject.pm: -------------------------------------------------------------------------------- 1 | package MyMooseObject; 2 | 3 | use strict; 4 | use warnings; 5 | use parent 'Moose::Object'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/NoInlineAttribute.pm: -------------------------------------------------------------------------------- 1 | package NoInlineAttribute; 2 | 3 | use Moose::Meta::Class; 4 | use Moose::Role; 5 | 6 | around accessor_metaclass => sub { 7 | my $orig = shift; 8 | my $self = shift; 9 | 10 | my $class = $self->$orig(); 11 | 12 | return Moose::Meta::Class->create_anon_class( 13 | superclasses => [$class], 14 | roles => ['NoInlineAccessor'], 15 | cache => 1, 16 | )->name; 17 | }; 18 | 19 | no Moose::Role; 20 | 21 | { 22 | package NoInlineAccessor; 23 | 24 | use Moose::Role; 25 | 26 | sub is_inline { 0 } 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /t/lib/Overloading/ClassConsumesRoleConsumesOverloads.pm: -------------------------------------------------------------------------------- 1 | package Overloading::ClassConsumesRoleConsumesOverloads; 2 | 3 | use Moose; 4 | 5 | with 'Overloading::RoleConsumesOverloads'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/ClassWithCombiningRole.pm: -------------------------------------------------------------------------------- 1 | package Overloading::ClassWithCombiningRole; 2 | 3 | use Moose; 4 | 5 | with 'Overloading::CombiningRole'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/ClassWithOneRole.pm: -------------------------------------------------------------------------------- 1 | package Overloading::ClassWithOneRole; 2 | 3 | use Moose; 4 | 5 | with 'Overloading::RoleWithOverloads'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/CombiningClass.pm: -------------------------------------------------------------------------------- 1 | package Overloading::CombiningClass; 2 | 3 | use Moose; 4 | 5 | with 'Overloading::RoleWithOverloads', 'Overloading::RoleWithoutOverloads'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/CombiningRole.pm: -------------------------------------------------------------------------------- 1 | package Overloading::CombiningRole; 2 | 3 | use Moose::Role; 4 | 5 | with 'Overloading::RoleWithOverloads', 'Overloading::RoleWithoutOverloads'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/RoleConsumesOverloads.pm: -------------------------------------------------------------------------------- 1 | package Overloading::RoleConsumesOverloads; 2 | 3 | use Moose::Role; 4 | 5 | with 'Overloading::RoleWithOverloads'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Overloading/RoleWithOverloads.pm: -------------------------------------------------------------------------------- 1 | package Overloading::RoleWithOverloads; 2 | 3 | use Moose::Role; 4 | 5 | use overload 6 | q{""} => 'as_string', 7 | fallback => 1; 8 | 9 | has message => ( 10 | is => 'rw', 11 | isa => 'Str', 12 | ); 13 | 14 | sub as_string { shift->message } 15 | 16 | 1; 17 | -------------------------------------------------------------------------------- /t/lib/Overloading/RoleWithoutOverloads.pm: -------------------------------------------------------------------------------- 1 | package Overloading::RoleWithoutOverloads; 2 | 3 | use Moose::Role; 4 | 5 | 1; 6 | -------------------------------------------------------------------------------- /t/lib/Real/Package.pm: -------------------------------------------------------------------------------- 1 | package Real::Package; 2 | use strict; 3 | use warnings; 4 | 5 | sub foo { } 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/lib/Role/BreakOnLoad.pm: -------------------------------------------------------------------------------- 1 | package Role::BreakOnLoad; 2 | use Moose::Role; 3 | 4 | sub meth1 { } 5 | 6 | this role has a syntax error and should crash on load. 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/lib/Role/Child.pm: -------------------------------------------------------------------------------- 1 | package Role::Child; 2 | use Moose::Role; 3 | 4 | with 'Role::Parent' => { -alias => { meth1 => 'aliased_meth1', } }; 5 | 6 | sub meth1 { } 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/lib/Role/Interface.pm: -------------------------------------------------------------------------------- 1 | package Role::Interface; 2 | use Moose::Role; 3 | 4 | requires "meth2"; 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /t/lib/Role/Parent.pm: -------------------------------------------------------------------------------- 1 | package Role::Parent; 2 | use Moose::Role; 3 | 4 | sub meth2 { } 5 | sub meth1 { } 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /t/metaclasses/custom_attr_meta_as_role.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | is( exception { 8 | package MooseX::Attribute::Test; 9 | use Moose::Role; 10 | }, undef, 'creating custom attribute "metarole" is okay' ); 11 | 12 | is( exception { 13 | package Moose::Meta::Attribute::Custom::Test; 14 | use Moose; 15 | 16 | extends 'Moose::Meta::Attribute'; 17 | with 'MooseX::Attribute::Test'; 18 | }, undef, 'custom attribute metaclass extending role is okay' ); 19 | 20 | done_testing; 21 | -------------------------------------------------------------------------------- /t/metaclasses/export_with_prototype.t: -------------------------------------------------------------------------------- 1 | use lib "t/lib"; 2 | package MyExporter::User; 3 | use MyExporter; 4 | 5 | use Test::More; 6 | use Test::Fatal; 7 | 8 | is( exception { 9 | with_prototype { 10 | my $caller = caller(0); 11 | is($caller, 'MyExporter', "With_caller prototype code gets called from MyMooseX"); 12 | }; 13 | }, undef, "check function with prototype" ); 14 | 15 | is( exception { 16 | as_is_prototype { 17 | my $caller = caller(0); 18 | is($caller, 'MyExporter', "As-is prototype code gets called from MyMooseX"); 19 | }; 20 | }, undef, "check function with prototype" ); 21 | 22 | done_testing; 23 | -------------------------------------------------------------------------------- /t/metaclasses/exporter_also_with_trait.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | use Test::Moose; 5 | 6 | BEGIN { 7 | package My::Meta::Role; 8 | use Moose::Role; 9 | } 10 | 11 | BEGIN { 12 | package My::Exporter; 13 | use Moose::Exporter; 14 | 15 | Moose::Exporter->setup_import_methods( 16 | also => ['Moose'], 17 | class_metaroles => { 18 | class => ['My::Meta::Role'], 19 | }, 20 | ); 21 | $INC{'My/Exporter.pm'} = __FILE__; 22 | } 23 | 24 | { 25 | package My::Class; 26 | use My::Exporter; 27 | } 28 | 29 | { 30 | my $meta = My::Class->meta; 31 | isa_ok($meta, 'Moose::Meta::Class'); 32 | does_ok($meta, 'My::Meta::Role'); 33 | } 34 | 35 | done_testing; 36 | -------------------------------------------------------------------------------- /t/metaclasses/moose_nonmoose_moose_chain_init_meta.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | { 4 | package ParentClass; 5 | use Moose; 6 | } 7 | { 8 | package SomeClass; 9 | use parent -norequire => 'ParentClass'; 10 | } 11 | { 12 | package SubClassUseBase; 13 | use parent -norequire => 'SomeClass'; 14 | use Moose; 15 | } 16 | 17 | use Test::More; 18 | use Test::Fatal; 19 | 20 | is( exception { 21 | Moose->init_meta(for_class => 'SomeClass'); 22 | }, undef, 'Moose class => use parent => Moose Class, then Moose->init_meta on middle class ok' ); 23 | 24 | done_testing; 25 | -------------------------------------------------------------------------------- /t/metaclasses/new_metaclass.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | do { 6 | package My::Meta::Class; 7 | use Moose; 8 | BEGIN { extends 'Moose::Meta::Class' }; 9 | 10 | package Moose::Meta::Class::Custom::MyMetaClass; 11 | sub register_implementation { 'My::Meta::Class' } 12 | }; 13 | 14 | do { 15 | package My::Class; 16 | use Moose -metaclass => 'My::Meta::Class'; 17 | }; 18 | 19 | do { 20 | package My::Class::Aliased; 21 | use Moose -metaclass => 'MyMetaClass'; 22 | }; 23 | 24 | is(My::Class->meta->meta->name, 'My::Meta::Class'); 25 | is(My::Class::Aliased->meta->meta->name, 'My::Meta::Class'); 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/metaclasses/new_object_BUILD.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | my $called; 6 | { 7 | package Foo; 8 | use Moose; 9 | 10 | sub BUILD { $called++ } 11 | } 12 | 13 | Foo->new; 14 | is($called, 1, "BUILD called from ->new"); 15 | $called = 0; 16 | Foo->meta->new_object; 17 | is($called, 1, "BUILD called from ->meta->new_object"); 18 | Foo->new({__no_BUILD__ => 1}); 19 | is($called, 1, "BUILD not called from ->new with __no_BUILD__"); 20 | Foo->meta->new_object({__no_BUILD__ => 1}); 21 | is($called, 1, "BUILD not called from ->meta->new_object with __no_BUILD__"); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/metaclasses/use_base_of_moose.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | { 7 | package NoOpTrait; 8 | use Moose::Role; 9 | } 10 | 11 | { 12 | package Parent; 13 | use Moose -traits => 'NoOpTrait'; 14 | 15 | has attr => ( 16 | is => 'rw', 17 | isa => 'Str', 18 | ); 19 | } 20 | 21 | { 22 | package Child; 23 | use parent -norequire => 'Parent'; 24 | } 25 | 26 | is(Child->meta->name, 'Child', "correct metaclass name"); 27 | 28 | my $child = Child->new(attr => "ibute"); 29 | ok($child, "constructor works"); 30 | 31 | is($child->attr, "ibute", "getter inherited properly"); 32 | 33 | $child->attr("ition"); 34 | is($child->attr, "ition", "setter inherited properly"); 35 | 36 | done_testing; 37 | -------------------------------------------------------------------------------- /t/moose_util/method_mod_args.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | use Moose::Util qw( add_method_modifier ); 7 | 8 | my $COUNT = 0; 9 | { 10 | package Foo; 11 | use Moose; 12 | 13 | sub foo { } 14 | sub bar { } 15 | } 16 | 17 | is( exception { 18 | add_method_modifier('Foo', 'before', [ ['foo', 'bar'], sub { $COUNT++ } ]); 19 | }, undef, 'method modifier with an arrayref' ); 20 | 21 | isnt( exception { 22 | add_method_modifier('Foo', 'before', [ {'foo' => 'bar'}, sub { $COUNT++ } ]); 23 | }, undef, 'method modifier with a hashref' ); 24 | 25 | my $foo = Foo->new; 26 | $foo->foo; 27 | $foo->bar; 28 | is($COUNT, 2, "checking that the modifiers were installed."); 29 | 30 | 31 | done_testing; 32 | -------------------------------------------------------------------------------- /t/roles/create_role_subclass.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | use Moose (); 5 | 6 | do { 7 | package My::Meta::Role; 8 | use Moose; 9 | extends 'Moose::Meta::Role'; 10 | 11 | has test_serial => ( 12 | is => 'ro', 13 | isa => 'Int', 14 | default => 1, 15 | ); 16 | 17 | no Moose; 18 | }; 19 | 20 | my $role = My::Meta::Role->create_anon_role; 21 | is($role->test_serial, 1, "default value for the serial attribute"); 22 | 23 | my $nine_role = My::Meta::Role->create_anon_role(test_serial => 9); 24 | is($nine_role->test_serial, 9, "parameter value for the serial attribute"); 25 | 26 | done_testing; 27 | -------------------------------------------------------------------------------- /t/roles/empty_method_modifiers_meta_bug.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | # test role and class 7 | package SomeRole; 8 | use Moose::Role; 9 | 10 | requires 'foo'; 11 | 12 | package SomeClass; 13 | use Moose; 14 | has 'foo' => (is => 'rw'); 15 | with 'SomeRole'; 16 | 17 | package main; 18 | 19 | #my $c = SomeClass->new; 20 | #isa_ok( $c, 'SomeClass'); 21 | 22 | for my $modifier_type (qw[ before around after ]) { 23 | my $get_func = "get_${modifier_type}_method_modifiers"; 24 | my @mms = eval{ SomeRole->meta->$get_func('foo') }; 25 | is($@, '', "$get_func for no method mods does not die"); 26 | is(scalar(@mms),0,'is an empty list'); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/roles/new_meta_role.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | do { 6 | package My::Meta::Role; 7 | use Moose; 8 | BEGIN { extends 'Moose::Meta::Role' }; 9 | }; 10 | 11 | do { 12 | package My::Role; 13 | use Moose::Role -metaclass => 'My::Meta::Role'; 14 | }; 15 | 16 | is(My::Role->meta->meta->name, 'My::Meta::Role'); 17 | 18 | done_testing; 19 | -------------------------------------------------------------------------------- /t/roles/overloading_to_instance.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use if $ENV{AUTHOR_TESTING}, 'Test::Warnings'; 6 | use overload (); 7 | 8 | use lib 't/lib'; 9 | 10 | use OverloadingTests; 11 | use Overloading::RoleWithOverloads; 12 | 13 | { 14 | package MyClass; 15 | use Moose; 16 | } 17 | 18 | my $object = MyClass->new; 19 | Overloading::RoleWithOverloads->meta->apply($object); 20 | 21 | OverloadingTests::test_overloading_for_package($_) 22 | for 'Overloading::RoleWithOverloads', ref $object; 23 | 24 | $object->message('foo'); 25 | 26 | OverloadingTests::test_overloading_for_object( 27 | $object, 28 | 'object with Overloading::RoleWithOverloads applied to instance' 29 | ); 30 | 31 | done_testing(); 32 | -------------------------------------------------------------------------------- /t/roles/role_attribute_conflict.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | { 8 | package My::Role1; 9 | use Moose::Role; 10 | 11 | has foo => ( 12 | is => 'ro', 13 | ); 14 | 15 | } 16 | 17 | { 18 | package My::Role2; 19 | use Moose::Role; 20 | 21 | has foo => ( 22 | is => 'ro', 23 | ); 24 | 25 | ::like( ::exception { with 'My::Role1' }, qr/attribute conflict.+My::Role2.+foo/, 'attribute conflict when composing one role into another' ); 26 | } 27 | 28 | done_testing; 29 | -------------------------------------------------------------------------------- /t/roles/roles_applied_in_create.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | use Moose::Meta::Class; 7 | use Moose::Util; 8 | 9 | use lib 't/lib'; 10 | 11 | 12 | # Note that this test passed (pre svn #5543) if we inlined the role 13 | # definitions in this file, as it was very timing sensitive. 14 | is( exception { 15 | my $builder_meta = Moose::Meta::Class->create( 16 | 'YATTA' => ( 17 | superclass => 'Moose::Meta::Class', 18 | roles => [qw( Role::Interface Role::Child )], 19 | ) 20 | ); 21 | }, undef, 'Create a new class with several roles' ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/test_moose/test_moose.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | BEGIN { 7 | use_ok('Test::Moose'); 8 | } 9 | 10 | done_testing; 11 | -------------------------------------------------------------------------------- /t/test_moose/test_moose_meta_ok.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Builder::Tester; 5 | use Test::More; 6 | 7 | use Test::Moose; 8 | 9 | { 10 | package Foo; 11 | use Moose; 12 | } 13 | 14 | { 15 | package Bar; 16 | } 17 | 18 | test_out('ok 1 - ... meta_ok(Foo) passes'); 19 | 20 | meta_ok('Foo', '... meta_ok(Foo) passes'); 21 | 22 | test_out ('not ok 2 - ... meta_ok(Bar) fails'); 23 | test_fail (+2); 24 | 25 | meta_ok('Bar', '... meta_ok(Bar) fails'); 26 | 27 | test_test ('meta_ok'); 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/test_moose/with_immutable.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::Builder::Tester; 5 | use Test::More; 6 | 7 | use Test::Moose; 8 | 9 | { 10 | package Foo; 11 | use Moose; 12 | } 13 | 14 | { 15 | package Bar; 16 | use Moose; 17 | } 18 | 19 | package main; 20 | 21 | test_out("ok 1", "not ok 2"); 22 | test_fail(+2); 23 | my $ret = with_immutable { 24 | ok(Foo->meta->is_mutable); 25 | } qw(Foo); 26 | test_test('with_immutable failure'); 27 | ok(!$ret, "one of our tests failed"); 28 | 29 | test_out("ok 1", "ok 2"); 30 | $ret = with_immutable { 31 | ok(Bar->meta->find_method_by_name('new')); 32 | } qw(Bar); 33 | test_test('with_immutable success'); 34 | ok($ret, "all tests succeeded"); 35 | 36 | done_testing; 37 | -------------------------------------------------------------------------------- /t/todo_tests/wrong-inner.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | # see RT#89397 7 | 8 | { 9 | package A; 10 | use Moose; 11 | sub run { 12 | my $self = shift; 13 | inner(); 14 | $self->cleanup; 15 | } 16 | sub cleanup { 17 | inner(); 18 | } 19 | } 20 | 21 | { 22 | package B; 23 | our $run; 24 | use Moose; 25 | extends 'A'; 26 | augment run => sub { 27 | my $self = shift; 28 | $run++; 29 | }; 30 | } 31 | 32 | B->new->run(); 33 | 34 | local $TODO = 'wtf is going on here??'; 35 | is($B::run, 1, 'B::run is only called once'); 36 | 37 | done_testing; 38 | -------------------------------------------------------------------------------- /t/type_constraints/define_type_twice_throws.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Fatal; 6 | 7 | use Moose::Util::TypeConstraints; 8 | 9 | { 10 | package Some::Class; 11 | use Moose::Util::TypeConstraints; 12 | 13 | subtype 'MySubType' => as 'Int' => where { 1 }; 14 | } 15 | 16 | like( exception { 17 | package Some::Other::Class; 18 | use Moose::Util::TypeConstraints; 19 | 20 | subtype 'MySubType' => as 'Int' => where { 1 }; 21 | }, qr/cannot be created again/, 'Trying to create same type twice throws' ); 22 | 23 | done_testing; 24 | -------------------------------------------------------------------------------- /t/type_constraints/throw_error.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | use Moose::Util::TypeConstraints; 7 | 8 | 9 | eval { Moose::Util::TypeConstraints::create_type_constraint_union() }; 10 | 11 | like( $@, qr/\QYou must pass in at least 2 type names to make a union/, 12 | 'can throw a proper error without Moose being loaded by the caller' ); 13 | 14 | done_testing; 15 | -------------------------------------------------------------------------------- /t/type_constraints/util_type_constraints_export.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | 6 | { 7 | package Foo; 8 | 9 | use Moose::Util::TypeConstraints; 10 | 11 | eval { 12 | type MyRef => where { ref($_) }; 13 | }; 14 | ::ok( !$@, '... successfully exported &type to Foo package' ); 15 | 16 | eval { 17 | subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' }; 18 | }; 19 | ::ok( !$@, '... successfully exported &subtype to Foo package' ); 20 | 21 | Moose::Util::TypeConstraints->export_type_constraints_as_functions(); 22 | 23 | ::ok( MyRef( {} ), '... Ref worked correctly' ); 24 | ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' ); 25 | } 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /t/type_constraints/util_type_reloading.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use lib 't/lib'; 5 | 6 | use Test::More; 7 | 8 | 9 | $SIG{__WARN__} = sub { 0 }; 10 | 11 | eval { require Foo; }; 12 | ok(!$@, '... loaded Foo successfully') || diag $@; 13 | 14 | delete $INC{'Foo.pm'}; 15 | 16 | eval { require Foo; }; 17 | ok(!$@, '... re-loaded Foo successfully') || diag $@; 18 | 19 | eval { require Bar; }; 20 | ok(!$@, '... loaded Bar successfully') || diag $@; 21 | 22 | delete $INC{'Bar.pm'}; 23 | 24 | eval { require Bar; }; 25 | ok(!$@, '... re-loaded Bar successfully') || diag $@; 26 | 27 | done_testing; 28 | -------------------------------------------------------------------------------- /weaver.ini: -------------------------------------------------------------------------------- 1 | [@Default] 2 | 3 | ; preserve custom licences in a few files 4 | [AllowOverride / OverrideLegal] 5 | header_re = ^COPYRIGHT 6 | match_anywhere = 1 7 | -------------------------------------------------------------------------------- /xs/Attribute.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Attribute PACKAGE = Class::MOP::Attribute 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Attribute, associated_class); 9 | INSTALL_SIMPLE_READER(Attribute, associated_methods); 10 | -------------------------------------------------------------------------------- /xs/Class.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Class PACKAGE = Class::MOP::Class 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Class, instance_metaclass); 9 | INSTALL_SIMPLE_READER(Class, immutable_trait); 10 | INSTALL_SIMPLE_READER(Class, constructor_class); 11 | INSTALL_SIMPLE_READER(Class, constructor_name); 12 | INSTALL_SIMPLE_READER(Class, destructor_class); 13 | -------------------------------------------------------------------------------- /xs/Generated.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Method::Generated PACKAGE = Class::MOP::Method::Generated 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Method::Generated, is_inline); 9 | INSTALL_SIMPLE_READER(Method::Generated, definition_context); 10 | -------------------------------------------------------------------------------- /xs/HasAttributes.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Mixin::HasAttributes PACKAGE = Class::MOP::Mixin::HasAttributes 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Mixin::HasAttributes, attribute_metaclass); 9 | INSTALL_SIMPLE_READER_WITH_KEY(Mixin::HasAttributes, _attribute_map, attributes); 10 | -------------------------------------------------------------------------------- /xs/Inlined.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Method::Inlined PACKAGE = Class::MOP::Method::Inlined 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Method::Inlined, _expected_method_class); 9 | -------------------------------------------------------------------------------- /xs/Instance.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Instance PACKAGE = Class::MOP::Instance 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Instance, associated_metaclass); 9 | -------------------------------------------------------------------------------- /xs/MOP.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | #include "ppport.h" 3 | 4 | MODULE = Class::MOP PACKAGE = Class::MOP 5 | 6 | PROTOTYPES: DISABLE 7 | 8 | # use prototype here to be compatible with get_code_info from Sub::Identify 9 | void 10 | get_code_info(coderef) 11 | SV *coderef 12 | PROTOTYPE: $ 13 | PREINIT: 14 | char *pkg = NULL; 15 | char *name = NULL; 16 | PPCODE: 17 | SvGETMAGIC(coderef); 18 | if (mop_get_code_info(coderef, &pkg, &name)) { 19 | EXTEND(SP, 2); 20 | mPUSHs(newSVpv(pkg, 0)); 21 | mPUSHs(newSVpv(name, 0)); 22 | } 23 | -------------------------------------------------------------------------------- /xs/Method.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Method PACKAGE = Class::MOP::Method 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER(Method, name); 9 | INSTALL_SIMPLE_READER(Method, package_name); 10 | INSTALL_SIMPLE_READER(Method, body); 11 | 12 | bool 13 | is_stub(self) 14 | SV *self 15 | 16 | PREINIT: 17 | CV *const body = (CV *)SvRV( HeVAL( hv_fetch_ent((HV *)SvRV(self), KEY_FOR(body), 0, HASH_FOR(body)) ) ); 18 | 19 | CODE: 20 | RETVAL = !( CvISXSUB(body) || CvROOT(body) ); 21 | 22 | OUTPUT: 23 | RETVAL 24 | -------------------------------------------------------------------------------- /xs/Package.xs: -------------------------------------------------------------------------------- 1 | #include "mop.h" 2 | 3 | MODULE = Class::MOP::Package PACKAGE = Class::MOP::Package 4 | 5 | PROTOTYPES: DISABLE 6 | 7 | BOOT: 8 | INSTALL_SIMPLE_READER_WITH_KEY(Package, name, package); 9 | -------------------------------------------------------------------------------- /xs/typemap: -------------------------------------------------------------------------------- 1 | type_filter_t T_TYPE_FILTER 2 | 3 | INPUT 4 | 5 | T_TYPE_FILTER 6 | { 7 | const char *__tMp = SvPV_nolen($arg); 8 | switch (*__tMp) { 9 | case 'C': $var = TYPE_FILTER_CODE; break; 10 | case 'A': $var = TYPE_FILTER_ARRAY; break; 11 | case 'I': $var = TYPE_FILTER_IO; break; 12 | case 'H': $var = TYPE_FILTER_HASH; break; 13 | case 'S': $var = TYPE_FILTER_SCALAR; break; 14 | default: 15 | croak(\"Unknown type %s\\n\", __tMp); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xt/author/authority.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | BEGIN { 6 | plan skip_all => 'this test requires a built dist' 7 | unless -f 'MANIFEST' && -f 'META.json'; 8 | } 9 | 10 | use Moose (); 11 | 12 | # this is used in Moo::sification 13 | ok(defined $Moose::AUTHORITY, '$AUTHORITY is set in the main module'); 14 | 15 | done_testing; 16 | -------------------------------------------------------------------------------- /xt/author/debugger-duck_type.t: -------------------------------------------------------------------------------- 1 | 2 | use Test::More skip_all => 'now failing? :/'; 3 | 4 | use FindBin qw/ $Bin /; 5 | 6 | BEGIN { 7 | #line 1 8 | #!/usr/bin/perl -d 9 | 10 | push @DB::typeahead, "c", "q"; 11 | 12 | # try to shut it up at least a little bit 13 | open my $out, ">", \my $out_buf; 14 | $DB::OUT = $out; 15 | open my $in, "<", \my $in_buf; 16 | $DB::IN = $in; 17 | } 18 | 19 | require "$Bin/../../t/type_constraints/duck_types.t"; 20 | --------------------------------------------------------------------------------