Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

symbol(3pm) [mojave man page]

Symbol(3pm)						 Perl Programmers Reference Guide					       Symbol(3pm)

NAME
Symbol - manipulate Perl symbols and their names SYNOPSIS
use Symbol; $sym = gensym; open($sym, "filename"); $_ = <$sym>; # etc. ungensym $sym; # no effect # replace *FOO{IO} handle but not $FOO, %FOO, etc. *FOO = geniosym; print qualify("x"), " "; # "main::x" print qualify("x", "FOO"), " "; # "FOO::x" print qualify("BAR::x"), " "; # "BAR::x" print qualify("BAR::x", "FOO"), " "; # "BAR::x" print qualify("STDOUT", "FOO"), " "; # "main::STDOUT" (global) print qualify(*x), " "; # returns *x print qualify(*x, "FOO"), " "; # returns *x use strict refs; print { qualify_to_ref $fh } "foo! "; $ref = qualify_to_ref $name, $pkg; use Symbol qw(delete_package); delete_package('Foo::Bar'); print "deleted " unless exists $Foo::{'Bar::'}; DESCRIPTION
"Symbol::gensym" creates an anonymous glob and returns a reference to it. Such a glob reference can be used as a file or directory handle. For backward compatibility with older implementations that didn't support anonymous globs, "Symbol::ungensym" is also provided. But it doesn't do anything. "Symbol::geniosym" creates an anonymous IO handle. This can be assigned into an existing glob without affecting the non-IO portions of the glob. "Symbol::qualify" turns unqualified symbol names into qualified variable names (e.g. "myvar" -> "MyPackage::myvar"). If it is given a second parameter, "qualify" uses it as the default package; otherwise, it uses the package of its caller. Regardless, global variable names (e.g. "STDOUT", "ENV", "SIG") are always qualified with "main::". Qualification applies only to symbol names (strings). References are left unchanged under the assumption that they are glob references, which are qualified by their nature. "Symbol::qualify_to_ref" is just like "Symbol::qualify" except that it returns a glob ref rather than a symbol name, so you can use the result even if "use strict 'refs'" is in effect. "Symbol::delete_package" wipes out a whole package namespace. Note this routine is not exported by default--you may want to import it explicitly. BUGS
"Symbol::delete_package" is a bit too powerful. It undefines every symbol that lives in the specified package. Since perl, for performance reasons, does not perform a symbol table lookup each time a function is called or a global variable is accessed, some code that has already been loaded and that makes use of symbols in package "Foo" may stop working after you delete "Foo", even if you reload the "Foo" module afterwards. perl v5.18.2 2013-11-04 Symbol(3pm)

Check Out this Related Man Page

PPI::Token::Symbol(3)					User Contributed Perl Documentation				     PPI::Token::Symbol(3)

NAME
PPI::Token::Symbol - A token class for variables and other symbols INHERITANCE
PPI::Token::Symbol isa PPI::Token isa PPI::Element DESCRIPTION
The "PPI::Token::Symbol" class is used to cover all tokens that represent variables and other things that start with a sigil. METHODS
This class has several methods beyond what is provided by its PPI::Token and PPI::Element parent classes. Most methods are provided to help work out what the object is actually pointing at, rather than what it might appear to be pointing at. canonical The "canonical" method returns a normalized, canonical version of the symbol. For example, it converts "$ ::foo'bar::baz" to $main::foo::bar::baz. This does not fully resolve the symbol, but merely removes syntax variations. symbol The "symbol" method returns the ACTUAL symbol this token refers to. A token of $foo might actually be referring to @foo, if it is found in the form $foo[1]. This method attempts to resolve these issues to determine the actual symbol. Returns the symbol as a string. raw_type The "raw_type" method returns the apparent type of the symbol in the form of its sigil. Returns the sigil as a string. symbol_type The "symbol_type" method returns the actual type of the symbol in the form of its sigil. Returns the sigil as a string. SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 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.16.2 2011-02-25 PPI::Token::Symbol(3)
Man Page

Featured Tech Videos