Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.330.117 Times

Scalar::Util 1.19

  Date Added: August 12, 2010  |  Visits: 729

Scalar::Util

Report Broken Link
Printer Friendly Version


Product Homepage
Download (97 downloads)



Scalar::Util is a selection of general-utility scalar subroutines. SYNOPSIS use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted weaken isvstring looks_like_number set_prototype); Scalar::Util contains a selection of subroutines that people have expressed would be nice to have in the perl core, but the usage would not really be high enough to warrant the use of a keyword, and the size so small such that being individual extensions would be wasteful. By default Scalar::Util does not export any subroutines. The subroutines defined are blessed EXPR If EXPR evaluates to a blessed reference the name of the package that it is blessed into is returned. Otherwise undef is returned. $scalar = "foo"; $class = blessed $scalar; # undef $ref = []; $class = blessed $ref; # undef $obj = bless [], "Foo"; $class = blessed $obj; # "Foo" dualvar NUM, STRING Returns a scalar that has the value NUM in a numeric context and the value STRING in a string context. $foo = dualvar 10, "Hello"; $num = $foo + 2; # 12 $str = $foo . " world"; # Hello world isvstring EXPR If EXPR is a scalar which was coded as a vstring the result is true. $vs = v49.46.48; $fmt = isvstring($vs) ? "%vd" : "%s"; #true printf($fmt,$vs); isweak EXPR If EXPR is a scalar which is a weak reference the result is true. $ref = $foo; $weak = isweak($ref); # false weaken($ref); $weak = isweak($ref); # true NOTE: Copying a weak reference creates a normal, strong, reference. $copy = $ref; $weak = isweak($ref); # false looks_like_number EXPR Returns true if perl thinks EXPR is a number. See "looks_like_number" in perlapi. openhandle FH Returns FH if FH may be used as a filehandle and is open, or FH is a tied handle. Otherwise undef is returned. $fh = openhandle(*STDIN); # *STDIN $fh = openhandle(*STDIN); # *STDIN $fh = openhandle(*NOTOPEN); # undef $fh = openhandle("scalar"); # undef readonly SCALAR Returns true if SCALAR is readonly. sub foo { readonly($_[0]) } $readonly = foo($bar); # false $readonly = foo(0); # true refaddr EXPR If EXPR evaluates to a reference the internal memory address of the referenced value is returned. Otherwise undef is returned. $addr = refaddr "string"; # undef $addr = refaddr $var; # eg 12345678 $addr = refaddr []; # eg 23456784 $obj = bless {}, "Foo"; $addr = refaddr $obj; # eg 88123488 reftype EXPR If EXPR evaluates to a reference the type of the variable referenced is returned. Otherwise undef is returned. $type = reftype "string"; # undef $type = reftype $var; # SCALAR $type = reftype []; # ARRAY $obj = bless {}, "Foo"; $type = reftype $obj; # HASH set_prototype CODEREF, PROTOTYPE Sets the prototype of the given function, or deletes it if PROTOTYPE is undef. Returns the CODEREF. set_prototype &foo, $$; tainted EXPR Return true if the result of EXPR is tainted $taint = tainted("constant"); # false $taint = tainted($ENV{PWD}); # true if running under -T weaken REF REF will be turned into a weak reference. This means that it will not hold a reference count on the object it references. Also when the reference count on that object reaches zero, REF will be set to undef. This is useful for keeping copies of references , but you dont want to prevent the object being DESTROY-ed at its usual time. { my $var; $ref = $var; weaken($ref); # Make $ref a weak reference } # $ref is now undef Note that if you take a copy of a scalar with a weakened reference, the copy will be a strong reference. my $var; my $foo = $var; weaken($foo); # Make $foo a weak reference my $bar = $foo; # $bar is now a strong reference This may be less obvious in other situations, such as grep(), for instance when grepping through a list of weakened references to objects that may have been destroyed already: @object = grep { defined } @object; This will indeed remove all references to destroyed objects, but the remaining references to objects will be strong, causing the remaining objects to never be destroyed because there is now always a strong reference to them in the @object array..

Requirements: No special requirements
Platforms: Linux
Keyword: Expr Fh Foo If Expr Libraries Ref Reference Scalar Scalarutil Stdin True Undef Weak Reference Will Be
Users rating: 0/10

License: Freeware Size: 43.01 KB
USER REVIEWS
More Reviews or Write Review


SCALAR::UTIL RELATED
Libraries  -  Stream::Reader 0.09
Stream::Reader is a stream reader Perl class. SYNOPSIS # Input stream can be reference to TYPEGLOB or SCALAR, output stream # can be the same types or undefined # Constructor $stream = Stream::Reader->new( *IN, { Limit => $limit, BuffSize...
6.14 KB  
Modules  -  Referer Theme 1.0
If a visitor clicks on a link from the client site, they will be assigned a theme for a certain time. Other visitors coming from different referers will have different themes and are unaffected.Installation - Unpack in your modules folder (usually...
 
Modules  -  Comment Subscribe 1.0
If you write a comment to a node , the follow up comments will be sent to the email you provided in the comment. Also if you don't want email notification you can unsubscribe using the link listed in your email. There are two methods for...
 
Libraries  -  File::Format::RIFF 1.0.1
File::Format::RIFF is a Perl module to Resource Interchange File Format/RIFF files. SYNOPSIS use File::Format::RIFF; open( IN, file ) or die "Could not open file: $!"; my ( $riff1 ) = File::Format::RIFF->read( *IN ); close( IN );...
9.22 KB  
Libraries  -  B::Deparse 5.8.8
B::Deparse is a Perl compiler backend to produce perl code. SYNOPSIS perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sLETTERS][,-xLEVEL] prog.pl B::Deparse is a backend module for the Perl compiler that generates perl source code, based on...
12.2 MB  
Libraries  -  Audio::TagLib::Tag 1.42
Audio::TagLib::Tag is a simple, generic interface to common audio meta data fields. This is an attempt to abstract away the difference in the meta data formats of various audio codecs and tagging schemes. As such it is generally a subset of what...
1.4 MB  
Libraries  -  Blatte::Parser 0.9.4
Blatte::Parser is a Perl module that contains a parser for Blatte syntax. SYNOPSIS use Blatte::Parser; $parser = new Blatte::Parser(); $perl_expr = $parser->parse(INPUT); or $parsed_expr = $parser->expr(INPUT); if...
31.74 KB  
Libraries  -  Data::Dumper 2.121
Data::Dumper module contains stringified perl data structures, suitable for both printing and eval. SYNOPSIS use Data::Dumper; # simple procedural interface print Dumper($foo, $bar); # extended usage with names print...
31.74 KB  
Libraries  -  Geo::Lookup::ByTime 0.0.2
Geo::Lookup::ByTime is a Perl module to lookup location by time. SYNOPSIS use Geo::Lookup::ByTime; $lookup = Geo::Lookup::ByTime->new( @points ); my $pt = $lookup->nearest( $tm ); Given a set of timestamped locations guess the location at...
15.36 KB  
Libraries  -  Log::Localized 0.05
Log::Localized is a Perl module to localize your logging. SYNOPSIS What you most probably want to do is something like: package Foo; use Log::Localized; sub bar { # this message will be displayed if method bars verbosity is >= 1...
19.46 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 4.0.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB