# class IO::Spec::Cygwin

Platform specific operations on file and directory paths for Cygwin

## method join

Defined as:

Same as IO::Spec::Win32.join, except replaces backslashes with slashes in the final result.

## method rel2abs

Defined as:

Same as IO::Spec::Win32.rel2abs, except replaces backslashes with slashes in the final result.

## method split

Defined as:

Same as IO::Spec::Win32.split, except replaces backslashes with slashes in all the values of the final result.

## method splitpath

Defined as:

Same as IO::Spec::Win32.splitpath, except replaces backslashes with slashes in all the values of the final result.

## method tmpdir

Defined as:

Attempts to locate a system's temporary directory by checking several typical directories and environmental variables. Uses current directory if no suitable directories are found.

# Routines supplied by class IO::Spec::Unix

IO::Spec::Cygwin inherits from class IO::Spec::Unix, which provides the following methods:

## (IO::Spec::Unix) method abs2rel

Defined as:

Returns a string that represents $path, but relative to $base path. Both $path and $base may be relative paths $bar defaults to $*CWD

## (IO::Spec::Unix) method basename

Defined as:

Takes a path as a string and returns a possibly-empty portion after the last slash:

## (IO::Spec::Unix) method canonpath

Defined as:

Returns a string that is a canonical representation of $path. If :$parent is set to true, will also clean up references to parent directories. NOTE: the routine does not access the filesystem, so no symlinks are followed.

## (IO::Spec::Unix) method catdir

Defined as:

Concatenates multiple path fragments and returns the canonical representation of the resultant path as a string. The @parts are Str objects and are allowed to contain path separators.

## (IO::Spec::Unix) method catfile

Alias for catdir.

## (IO::Spec::Unix) method catpath

Defined as:

Takes two path fragments and concatenates them, adding or removing a path separator, if necessary. The first argument is ignored (it exists to maintain consistent interface with other IO::Spec types for systems that have volumes).

## (IO::Spec::Unix) method curdir

Defined as:

Returns a string representing the current directory:

## (IO::Spec::Unix) method curupdir

Defined as:

Returns a none Junction of strings representing the current directory and the "one directory up":

## (IO::Spec::Unix) method devnull

Defined as:

Returns the string "/dev/null" representing the "Null device":

## (IO::Spec::Unix) method dir-sep

Defined as:

Returns the string "/" representing canonical directory separator character.

## (IO::Spec::Unix) method extension

NOTE: Most users would want to use the higher-level routine IO::Path.extension instead of this lower-level version.

Defined as:

Takes a string representing a base name and returns the characters after the last dot ("."), or empty string if no dots are present. The routine makes no attempt to detect path separators and will return everything after the last dot.

Defined as:

## (IO::Spec::Unix) method rootdir

Defined as:

Returns string '/', representing root directory.

Defined as:

## (IO::Spec::Unix) method splitpath

Defined as:

Splits the given $path into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile named argument is set to True, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.

## (IO::Spec::Unix) method tmpdir

Defined as:

Attempts to locate a system's temporary directory by checking several typical directories and environmental variables. Uses current directory if no suitable directories are found.

## (IO::Spec::Unix) method updir

Defined as:

Returns a string representing the directory one up from current:

# Routines supplied by class Any

IO::Spec::Cygwin inherits from class Any, which provides the following methods:

Defined as:

Usage:

## (Any) method deepmap

Defined as:

deepmap will apply &block to each element and return a new List with the return values of &block, unless the element does the Iterable role. For those elements deepmap will descend recursively into the sublist.

## (Any) method duckmap

Defined as:

duckmap will apply &block on each element and return a new list with defined return values of the block. For undefined return values, duckmap will try to descend into the element if that element implements Iterable.

## (Any) method nodemap

Defined as:

nodemap will apply &block to each element and return a new List with the return values of &block. In contrast to deepmap it will not descend recursively into sublists if it finds elements which does the Iterable role.

The examples above would have produced the exact same results if we had used map instead of nodemap. The difference between the two lies in the fact that map flattens out slips while nodemap doesn't.

## (Any) method flat

Defined as:

Interprets the invocant as a list, flattens non-containerized Iterables into a flat list, and returns that list. Keep in mind Map and Hash types are Iterable and so will be flattened into lists of pairs.

Note that Arrays containerize their elements by default, and so flat will not flatten them. You can use hyper method call to call .List method on all the inner Iterables and so de-containerize them, so that flat can flatten them:

For more fine-tuned options, see deepmap, duckmap, and signature destructuring

## (Any) method eager

Defined as:

Interprets the invocant as a List, evaluates it eagerly, and returns that List.

## (Any) method elems

Defined as:

Interprets the invocant as a list, and returns the number of elements in the list.

## (Any) method end

Interprets the invocant as a list, and returns the last index of that list.

## (Any) method pairup

Defined as:

Interprets the invocant as a list, and constructs a list of pairs from it, in the same way that assignment to a Hash does. That is, it takes two consecutive elements and constructs a pair from them, unless the item in the key position already is a pair (in which case the pair is passed is passed through, and the next list item, if any, is considered to be a key again).

## (Any) sub exit

Defined as:

Exits the current process with return code $status or zero if no value has been specified. The exit value ($status), when different from zero, has to be opportunely evaluated from the process that catches it (e.g., a shell).

exit does prevent the LEAVE phaser to be executed.

exit should be used as last resort only to signal the parent process about an exit code different from zero, and should not be used to terminate exceptionally a method or a sub: use exceptions instead.

## (Any) sub item

Defined as:

Forces given object to be evaluated in item context and returns the value of it.

You can also use $ as item contextualizer. ## (Any) method Array Defined as: Coerce the invocant to Array. ## (Any) method List Defined as: Coerce the invocant to List. ## (Any) method Hash Defined as: Coerce the invocant to Hash. ## (Any) method hash Defined as: Coerce the invocant to Hash. ## (Any) method Slip Defined as: Coerce the invocant to Slip. ## (Any) method Map Defined as: Coerce the invocant to Map. ## (Any) method Bag Defined as: Coerce the invocant to Bag, whereby Positionals are treated as lists of values. ## (Any) method BagHash Defined as: Coerce the invocant to BagHash, whereby Positionals are treated as lists of values. ## (Any) method Set Defined as: Coerce the invocant to Set, whereby Positionals are treated as lists of values. ## (Any) method SetHash Defined as: Coerce the invocant to SetHash, whereby Positionals are treated as lists of values. ## (Any) method Mix Defined as: Coerce the invocant to Mix, whereby Positionals are treated as lists of values. ## (Any) method MixHash Defined as: Coerce the invocant to MixHash, whereby Positionals are treated as lists of values. ## (Any) method Supply Defined as: Coerce the invocant first to a List and then to a Supply. ## (Any) method min Defined As: Coerces to Iterable and returns the numerically smallest element. If a Callable positional argument is provided, each value is passed into the filter, and its return value is compared instead of the original value. The original value is still the one returned from min. ## (Any) method max Defined As: Coerces to Iterable and returns the numerically largest element. If a Callable positional argument is provided, each value is passed into the filter, and its return value is compared instead of the original value. The original value is still the one returned from max. ## (Any) method minmax Defined As: Returns a Range from the smallest to the largest element. If a Callable positional argument is provided, each value is passed into the filter, and its return value is compared instead of the original value. The original values are still used in the returned Range. ## (Any) method minpairs Defined As: Calls .pairs and returns a Seq with all of the Pairs with minimum values, as judged by the cmp operator: ## (Any) method maxpairs Defined As: Calls .pairs and returns a Seq with all of the Pairs with maximum values, as judged by the cmp operator: ## (Any) method keys Defined As: For defined Any returns its keys, otherwise returns an empty list. ## (Any) method flatmap Defined As: Treats the Any as 1-item list and uses List.flatmap on it. ## (Any) method roll Defined As: Treats the Any as 1-item list and uses List.roll on it. ## (Any) method pick Defined As: Treats the Any as 1-item list and uses List.pick on it. ## (Any) method skip Defined As: Creates a Seq from 1-item list's iterator and uses Seq.skip on it. ## (Any) method prepend Defined As: Initializes Any variable as empty Array and calls Array.prepend on it. ## (Any) method unshift Defined As: Initializes Any variable as empty Array and calls Array.unshift on it. ## (Any) method first Defined As: Treats the Any as a 1-item list and uses List.first on it. ## (Any) method unique Defined As: Treats the Any as a 1-item list and uses List.unique on it. ## (Any) method repeated Defined As: Treats the Any as a 1-item list and uses List.repeated on it. ## (Any) method squish Defined As: Treats the Any as a 1-item list and uses List.squish on it. ## (Any) method reduce Defined As: TODO ## (Any) method permutations Defined As: Treats the Any as a 1-item list and uses List.permutations on it. ## (Any) method categorize Defined As: Treats the Any as a 1-item list and uses List.categorize on it. ## (Any) method classify Defined As: Treats the Any as a 1-item list and uses List.classify on it. ## (Any) method produce Defined As: TODO ## (Any) method pairs Defined As: Returns an empty List. ## (Any) method antipairs Defined As: Returns an empty List. ## (Any) method kv Defined As: Returns an empty List. ## (Any) method toggle Defined as: Iterates over the invocant, producing a Seq, toggling whether the received values are propagated to the result on and off, depending on the results of calling Callables in @conditions: Imagine a switch that's either on or off (True or False), and values are produced if it's on. By default, the initial state of that switch is in "on" position, unless :$off is set to a true value, in which case the initial state will be "off".

A Callable from the head of @conditions is taken (if any are available) and it becomes the current tester. Each value from the original sequence is tested by calling the tester Callable with that value. The state of our imaginary switch is set to the return value from the tester: if it's truthy, set switch to "on", otherwise set it to "off".

Whenever the switch is toggled (i.e. switched from "off" to "on" or from "on" to "off"), the current tester Callable is replaced by the next Callable in @conditions, if available, which will be used to test any further values. If no more tester Callables are available, the switch will remain in its current state until the end of iteration.

## (Any) method append

Defined As:

Initializes Any variable as empty Array and calls Array.append on it.

## (Any) method values

Defined As:

Returns an empty List.

Defined As:

TODO

Defined As:

TODO

# Routines supplied by class Mu

IO::Spec::Cygwin inherits from class Mu, which provides the following methods:

## (Mu) routine defined

Returns False on the type object, and True otherwise.

Very few types (like Failure) override defined to return False even for instances:

## (Mu) routine isa

Returns True if the invocant is an instance of class $type, a subset type or a derived class (through inheritance) of $type.

A more idiomatic way to do this is to use the smartmatch operator ~~ instead.

## (Mu) method ACCEPTS

ACCEPTS is the method that smart matching with the infix ~~ operator and given/when invokes on the right-hand side (the matcher).

The Mu:U multi performs a type check. Returns True if \$other conforms to the invocant (which is always a type object or failure).

Note that there is no multi for defined invocants; this is to allow autothreading of junctions, which happens as a fallback mechanism when no direct candidate is available to dispatch to.

## (Mu) method WHICH

Returns an object of type ObjAt which uniquely identifies the object. Value types override this method which makes sure that two equivalent objects return the same return value from WHICH.

## (Mu) method WHERE

Returns an Int representing the memory address of the object.

## (Mu) method WHY

Returns the attached Pod::Block::Declarator.

For instance:

See Pod declarator blocks for details about attaching Pod to variables, classes, functions, methods, etc.

## (Mu) trait is export

Marks a type as being exported, that is, available to external users.

A user of a module or class automatically gets all the symbols imported that are marked as is export.

See Exporting and Selective Importing Modules for more details.

## (Mu) method return

The method return will stop execution of a subroutine or method, run all relevant phasers and provide invocant as a return value to the caller. If a return type constraint is provided it will be checked unless the return value is Nil. A control exception is raised and can be caught with CONTROL.

## (Mu) method return-rw

Same as method return except that return-rw returns a writable container to the invocant (see more details here: return-rw).

## (Mu) method emit

Emits the invocant into the enclosing supply or react block.

## (Mu) method take

Returns the invocant in the enclosing gather block.

## (Mu) routine take

Takes the given item and passes it to the enclosing gather block.

## (Mu) routine take-rw

Returns the given item to the enclosing gather block, without introducing a new container.

## (Mu) method so

Returns a Bool value representing the logical non-negation of an expression. One can use this method similarly to the English sentence: "If that is so, then do this thing". For instance,

## (Mu) method not

Returns a Bool value representing the logical negation of an expression. Thus it is the opposite of so.

Since there is also a prefix version of not, the above code reads better like so: