NAME
Class::Std::Fast - faster but less secure than Class::Std
VERSION
This document describes Class::Std::Fast 0.01
SYNOPSIS
package MyClass;
use Class::Std::Fast;
1;
package main;
MyClass->new();
DESCRIPTION
Class::Std::Fast allows you to use the beautifull API of Class::Std in a faster way than Class::Std does.
You can get the objects ident via scalarifiyng your object.
Getting the objects ident is still possible via the ident method, but it's faster to scalarify your object.
SUBROUTINES/METHODS
new
The constructor acts like Class::Std's constructor. If your Class used Class::Std::Fast with a performance level greater than 1 all BUILD and START methods are ignored.
package FastObject;
use Class::Std::Fast;
1;
my $fast_obj = FastObject->new();
# or if you don't need any BUILD, START or DEMOLISH methods
package FasterObject;
use Class::Std::Fast qw(2);
1;
my $faster_obj = FasterObject->new();
ident
If you use Class::Std::Fast you shouldn't use this method. It's only existant for downward compatibility.
# insted of
my $ident = ident $self;
# use
my $ident = ${$self};
Method for accessing Class::Std::Fast's internals
Class::Std::Fast exposes some of it's internals to allow the construction of Class::Std::Fast based objects from outside the auto-generated constructors.
You should never use these methods for doing anything else. In fact you should not use these methods at all, unless you know what you're doing.
ID
Returns an ID for the next object to construct.
If you ever need to override the constructor created by Class::Std::Fast, be sure to use Class::Std::Fast::ID as the source for the ID to assign to your blessed scalar.
More precisely, you should construct your object like this:
my $self = bless \do { my $foo = Class::Std::Fast::ID } , $class;
Every other method of constructing Class::Std::Fast - based objects will lead to data corruption (duplicate object IDs).
ID_GENERATOR_REF
Returns a reference to the ID counter scalar.
The current value is the next object ID !
You should never use this method unless you're trying to create Class::Std::Fast objects from outside Class::Std::Fast (and possibly outside perl).
In case you do (like when creating perl objects in XS code), be sure to post-increment the ID counter after creating an object, which you may do from C with
sv_inc( SvRV(id_counter_ref) )
DIAGNOSTICS
see Class::Std
CONFIGURATION AND ENVIRONMENT
DEPENDENCIES
version
Class::Std
Carp
INCOMPATIBILITIES
see Class::Std
BUGS AND LIMITATIONS
You can't use the :SCALARIFY attribute for your Objects.
We use an increment for building identifiers and not Scalar::Util::refaddr like Class::Std.
Inheriting from non-Class::Std::Fast modules does not work
You cannot inherit from non-Class::Std::Fast classes, not even if you overwrite the default constructor. To be more precise, you cannot inherit from classes which use something different from numeric blessed scalar references as their objects. Even so inheriting from similarly contructed classes like Object::InsideOut could work, you would have to make sure that object IDs cannot be duplicated. It is therefore strongly discouraged to build classes with Class::Std::Fast derived from non-Class::Std::Fast classes.
If you really need to inherit from non-Class::Std::Fast modules, make sure you use Class::Std::Fast::ID as described above for creating objects.
No runtime initialization with "use Class::Std::Fast qw(2);"
When eval'ing Class::Std::Fast based classes with extra optimization enabled, make sure the last line is
Class::Std::Fast::initialize();
In contrast to Class::Std, Class::Std::Fast performs no run-time initialization when optimization >1 is enabled, so your code has to do it itself.
CUMULATIVE, PRIVATE, RESTRICTED and anticumulative methods won't work if you leave out this line.
RCS INFORMATIONS
- Last changed by
-
$Author: ac0v $
- Id
-
$Id: Fast.pm 169 2007-11-10 17:58:23Z ac0v $
- Revision
-
$Revision: 169 $
- Date
-
$Date: 2007-11-10 18:58:23 +0100 (Sat, 10 Nov 2007) $
- HeadURL
-
$HeadURL: http://svn.hyper-framework.org/Hyper/Class-Std-Fast/branches/2007-11-10/lib/Class/Std/Fast.pm $
AUTHORS
Andreas 'ac0v' Specht <ACID@cpan.org>
Martin Kutter <martin.kutter@fen-net.de>
LICENSE AND COPYRIGHT
Copyright (c) 2007, Andreas 'ac0v' Specht <ACID@cpan.org>
. All rights reserved.