The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Object::Utility

ABSTRACT

Data-Object Utility Functions

SYNOPSIS

  use Data::Object::Utility;

  my $array = Data::Object::Utility::Deduce []; # Data::Object::Array
  my $value = Data::Object::Utility::Detract $array; # [,...]

DESCRIPTION

This package provides a suite of utility functions designed to be used internally across core packages.

LIBRARIES

This package uses type constraints defined by:

Data::Object::Library

FUNCTIONS

This package implements the following functions.

deduce

  Deduce(Any $arg1) : Any

The Deduce function returns a data type object instance based upon the deduced type of data provided.

Deduce example
  # given ...

  Data::Object::Utility::Deduce(...);

deduceblessed

  DeduceBlessed(Any $arg1) : Int

The DeduceBlessed function returns truthy if the argument is blessed.

DeduceBlessed example
  # given ...

  Data::Object::Utility::DeduceBlessed(...);

deducedeep

  DeduceDeep(Any $arg1) : Any

The DeduceDeep function returns a data type object. If the data provided is complex, this function traverses the data converting all nested data to objects. Note: Blessed objects are not traversed.

DeduceDeep example
  # given ...

  Data::Object::Utility::DeduceDeep(...);

deducedefined

  DeduceDefined(Any $arg1) : Int

The DeduceDefined function returns truthy if the argument is defined.

DeduceDefined example
  # given ...

  Data::Object::Utility::DeduceDefined(...);

deducenumberlike

  DeduceNumberlike(Any $arg1) : Int

The DeduceNumberlike function returns truthy if the argument is numberlike.

DeduceNumberlike example
  # given ...

  Data::Object::Utility::DeduceNumberlike(...);

deducereferences

  DeduceReferences(Any $arg1) : Int

The DeduceReferences function returns a data object based on the type of argument reference provided.

DeduceReferences example
  # given ...

  Data::Object::Utility::DeduceReferences(...);

deducestringlike

  DeduceStringLike(Any $arg1) : Int

The DeduceStringLike function returns truthy if the argument is stringlike.

DeduceStringLike example
  # given ...

  Data::Object::Utility::DeduceStringLike(...);

detract

  Detract(Any $arg1) : Any

The Detract function returns a value of native type, based upon the underlying reference of the data type object provided.

Detract example
  # given ...

  Data::Object::Utility::Detract(...);

detractdeep

  DetractDeep(Any $arg1) : Any

The DetractDeep function returns a value of native type. If the data provided is complex, this function traverses the data converting all nested data type objects into native values using the objects underlying reference. Note: Blessed objects are not traversed.

DetractDeep example
  # given ...

  Data::Object::Utility::DetractDeep(...);

namefile

  NameFile(Str $arg1) : Str

The NameFile function returns the file representation for a given string.

NameFile example
  # given ...

  Data::Object::Utility::NameFile(...);

namelabel

  NameLabel(Str $arg1) : Str

The NameLabel function returns the label representation for a given string.

NameLabel example
  # given ...

  Data::Object::Utility::NameLabel(...);

namepackage

  NamePackage(Str $arg1) : Str

The NamePackage function returns the package representation for a give string.

NamePackage example
  # given ...

  Data::Object::Utility::NamePackage(...);

namepath

  NamePath(Str $arg1) : Str

The NamePath function returns the path representation for a given string.

NamePath example
  # given ...

  Data::Object::Utility::NamePath(...);

namespace

  Namespace(Str $arg1) : Str

The Namespace function registers a type library with a namespace in the registry so that typed operations know where to look for type context-specific constraints.

Namespace example
  # given ...

  Data::Object::Utility::Namespace(...);

registry

  Registry() : Object

The Registry function returns the global Data::Object::Registry object, which holds mappings between namespaces and type registries.

Registry example
  # given ...

  Data::Object::Utility::Registry(...);

reify

  Reify(Str $namespace, Str $expression) : Maybe[Object]

The Reify function returns a type constraint for a given namespace and expression.

Reify example
  # given ...

  Data::Object::Utility::Reify(...);

typearray

  TypeArray(ArrayRef $arg1) : ArrayObject

The TypeArray function returns a Data::Object::Array instance which wraps the provided data type and can be used to perform operations on the data.

TypeArray example
  # given ...

  Data::Object::Utility::TypeArray(...);

typecode

  TypeCode(CodeRef $arg1) : CodeObject

The TypeCode function returns a Data::Object::Code instance which wraps the provided data type and can be used to perform operations on the data.

TypeCode example
  # given ...

  Data::Object::Utility::TypeCode(...);

typedata

  TypeData(Str $arg1) : Object

The TypeData function returns a Data::Object::Data instance which parses pod-ish data in files and packages.

TypeData example
  # given ...

  Data::Object::Utility::TypeData(...);

typedispatch

  TypeDispatch(Str $arg1) : Object

The TypeDispatch function return a Data::Object::Dispatch object which is a handle that let's you call into other packages.

TypeDispatch example
  # given ...

  Data::Object::Utility::TypeDispatch(...);

typeexception

  TypeException(Any @args) : Object

The TypeException function returns a Data::Object::Exception instance which can be thrown.

TypeException example
  # given ...

  Data::Object::Utility::TypeException(...);

typefloat

  TypeFloat(Str $arg1) : FloatObject

The TypeFloat function returns a Data::Object::Float instance which wraps the provided data type and can be used to perform operations on the data.

TypeFloat example
  # given ...

  Data::Object::Utility::TypeFloat(...);

typehash

  TypeHash(HashRef $arg1) : HashObject

The TypeHash function returns a Data::Object::Hash instance which wraps the provided data type and can be used to perform operations on the data.

TypeHash example
  # given ...

  Data::Object::Utility::TypeHash(...);

typename

  TypeName(Any $arg1) : Str

The TypeName function returns a data type description for the type of data provided, represented as a string in capital letters.

TypeName example
  # given ...

  Data::Object::Utility::TypeName(...);

typenumber

  TypeNumber(Num $arg1) : NumObject

The TypeNumber function returns a Data::Object::Number instance which wraps the provided data type and can be used to perform operations on the data.

TypeNumber example
  # given ...

  Data::Object::Utility::TypeNumber(...);

typeregexp

  TypeRegexp(RegexpRef $arg1) : RegexpObject

The TypeRegexp function returns a Data::Object::Regexp instance which wraps the provided data type and can be used to perform operations on the data.

TypeRegexp example
  # given ...

  Data::Object::Utility::TypeRegexp(...);

typescalar

  TypeScalar(Any $arg1) : ScalarObject

The TypeScalar function returns a Data::Object::Scalar instance which wraps the provided data type and can be used to perform operations on the data.

TypeScalar example
  # given ...

  Data::Object::Utility::TypeScalar(...);

typespace

  TypeSpace(Str $arg1) : Object

The TypeSpace function returns a Data::Object::Space instance which provides methods for operating on package and namespaces.

TypeSpace example
  # given ...

  Data::Object::Utility::TypeSpace(...);

typestring

  TypeString(Str $arg1) : StrObject

The TypeString function returns a Data::Object::String instance which wraps the provided data type and can be used to perform operations on the data.

TypeString example
  # given ...

  Data::Object::Utility::TypeString(...);

typeundef

  TypeUndef(Undef $arg1) : UndefObject

The TypeUndef function returns a Data::Object::Undef instance which wraps the provided data type and can be used to perform operations on the data.

TypeUndef example
  # given ...

  Data::Object::Utility::TypeUndef(...);

CREDITS

Al Newkirk, +319

Anthony Brummett, +10

Adam Hopkins, +2

José Joaquín Atria, +1

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated here, https://github.com/iamalnewkirk/do/blob/master/LICENSE.

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues

SEE ALSO

To get the most out of this distribution, consider reading the following:

Do

Data::Object

Data::Object::Class

Data::Object::ClassHas

Data::Object::Role

Data::Object::RoleHas

Data::Object::Library