Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

perl5i::signature(3pm) [debian man page]

Signature(3pm)						User Contributed Perl Documentation					    Signature(3pm)

NAME
perl5i::Signature - Representing what parameters a subroutine accepts SYNOPSIS
func hello( $greeting, $place ) { say "$greeting, $place" } my $code = &hello; my $signature = $code->signature; say $signature->num_positional_params; # 2 say $signature->is_method; # false DESCRIPTION
A Signature is a representation of what parameters a subroutine accepts. Each subroutine defined with "func" or "method" will have a signature associated with it. You can get at it by calling the "signature" method on the code reference. See "Signature Introspection" in perl5i for more details. Subroutines declared with Perl's built in "sub" will have no signature. METHODS
params my $params = $sig->params; An array ref of the parameters a subroutine takes in the order it takes them. Currently they are just strings. In the future they will be string overloaded objects. positional_params my $params = $sig->positional_params; Like "$sig->params" but it is just the positional parameters. In the future there will be named parameters. num_positional_params my $num_positional_params = $sig->num_positional_params; The number of named parameters the subroutine takes. In the future there will be named parameters. For the purposes of determining how many arguments a function takes, it is most useful to look just at the positional ones. This is mostly an optimization for "$sig->positional_params->size". as_string my $params = $sig->as_string; The original signature string. invocant my $invocant = $sig->invocant; The invocant is the object or class a method is called on. "invocant" will return the parameter which contains this, by default it is $self on a method, and nothing a regular subroutine. is_method my $is_method = $sig->is_method; Returns if the subroutine was declared as a method. OVERLOADING
Signature objects are string overloaded to return "as_string". They are also always true to avoid objects taking no parameters from being confused with subroutines with no signatures. perl v5.14.2 2012-06-14 Signature(3pm)

Check Out this Related Man Page

Object::Signature::File(3pm)				User Contributed Perl Documentation			      Object::Signature::File(3pm)

NAME
Object::Signature::File - Extended signature API for storing objects in file DESCRIPTION
Whereas the basic Object::Signature class provides for only a raw cryptographic signature, Object::Signature::File extends the signature method to add specialised information for objects that want some control over how they are stored as files. For example, some objects may want the cached object to have a matching file extension (for example a gif image) so that web-accessible cache path could be used in a web page. The image would then be sent out to the browser with the correct mime type. METHODS
signature_ext The "signature_ext" method indicates the preferable file extension for the content of the object, if applicable. If the method returns a string, it indicates the object should be stored in a file with a specific extension. If the method returns a null string, it indicates that the file should be stored with no extension. If the method return "undef" (the default value), it indicates no preference for the extension the file. signature_name This signature_name method is the least-useful part of this extended API, and is rarely used. It is included mostly for completeness. If the method returns a string, it indicates the name part of a file name that the object should be stored in, if possible. If the method return a null string, it explicitly indicates there is no file name or a file name is not possible. If the method returns "undef" (the default value), it indicates no preference for the name of the file. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2004 - 2007 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.3 2011-06-13 Object::Signature::File(3pm)
Man Page