home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_e6879c70ffcbb8cc088f43dfe2ba3796
< prev
next >
Wrap
Text File
|
2000-03-23
|
6KB
|
144 lines
<HTML>
<HEAD>
<TITLE>POE::Filter::Reference - POE Freeze/Thaw Protocol Abstraction</TITLE>
<LINK REL="stylesheet" HREF="../../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> POE::Filter::Reference - POE Freeze/Thaw Protocol Abstraction</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<LI><A HREF="#public filter methods">PUBLIC FILTER METHODS</A></LI>
<LI><A HREF="#see also">SEE ALSO</A></LI>
<LI><A HREF="#bugs">BUGS</A></LI>
<LI><A HREF="#authors & copyrights">AUTHORS & COPYRIGHTS</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>POE::Filter::Reference - POE Freeze/Thaw Protocol Abstraction</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
$filter = new POE::Filter::Reference();
$arrayref_of_perl_references =
$filter->get($arrayref_of_raw_chunks_from_driver);
$arrayref_of_serialized_perl_references =
$filter->put($arrayref_of_perl_references);</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>The ``put'' half of this filter freezes referenced Perl structures into
serialized versions for sending. The ``get'' half of this filter thaws
serialized Perl structures back into references. This provides a
handy way to ship data between processes and systems.</P>
<P>Serializers should recognize that POE::Filter::Reference is used to
ship data between systems with different byte orders.</P>
<P>
<HR>
<H1><A NAME="public filter methods">PUBLIC FILTER METHODS</A></H1>
<UL>
<LI>
POE::Filter::Reference::new( ... )
<P>The <CODE>new()</CODE> method creates and initializes the reference filter. It
accepts optional parameters to specify a serializer and the use of
compression. The serializer may be a package or an object; the
compression flag is a Perl ``boolean'' value.</P>
<P>A package serializer must have a <CODE>thaw()</CODE> function, and it must have
either a <CODE>freeze()</CODE> or <CODE>nfreeze()</CODE> function. If it has both <CODE>freeze()</CODE> and
nfreeze(), then Filter::Reference will use <CODE>nfreeze()</CODE> for portability.
These functions match Storable and FreezeThaw's call signatures.</P>
<P>An object serializer must have a <CODE>thaw()</CODE> method. It also must have
either a <CODE>freeze()</CODE> or <CODE>nfreeze()</CODE> method. If it has both <CODE>freeze()</CODE> and
nfreeze(), then Filter::Reference will use <CODE>nfreeze()</CODE> for portability.
The <CODE>thaw()</CODE> method accepts $self and a scalar; it should return a
reference to the reconstituted data. The <CODE>freeze()</CODE> and <CODE>nfreeze()</CODE>
methods receive $self and a reference; they should return a scalar
with the reference's serialized representation.</P>
<P>If the serializer parameter is undef, a default one will be used.
This lets programs specify compression without having to worry about
naming a serializer.</P>
<P>For example:</P>
<PRE>
# Use the default filter (either Storable or FreezeThaw).
my $filter = new POE::Filter::Reference();</PRE>
<PRE>
# Use Storable explicitly, specified by package name.
my $filter = new POE::Filter::Reference('Storable');</PRE>
<PRE>
# Use an object.
my $filter = new POE::Filter::Reference($object);</PRE>
<PRE>
# Use an object, with compression.
my $filter = new POE::Filter::Reference($object, 1);</PRE>
<PRE>
# Use the default serializer, with compression.
my $filter = new POE::Filter::Reference(undef, 1);</PRE>
<P>The <CODE>new()</CODE> method will try to require any packages it needs.</P>
<P>The default behavior is to try Storable first, FreezeThaw second, and
fail if neither is present. This is rapidly becoming moot because of
the PM_PREREQ entry in Makefile.PL, which makes CPAN and ``make'' carp
about requirements even when they aren't required.</P>
<P></P>
<LI>
POE::Filter::Reference::get($frozen_data)
<P>The <CODE>get()</CODE> method thaws streamed, frozen data into references.
References will be blessed, if necessary. If the reference points to
an object, be sure the receiving end has use'd it before calling its
methods.</P>
<P></P>
<LI>
POE::Filter::Reference::put($reference)
<P>The <CODE>put()</CODE> method freezes references and returns their serialized,
streamable representations.</P>
<P></P></UL>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P>POE::Filter; POE::Filter::HTTPD; POE::Filter::Line;
POE::Filter::Stream</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>Oh, probably some.</P>
<P>
<HR>
<H1><A NAME="authors & copyrights">AUTHORS & COPYRIGHTS</A></H1>
<P>The Reference filter was contributed by Arturn Bergman, with changes
by Philip Gwyn.</P>
<P>Please see the POE manpage for more information about authors and
contributors.</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> POE::Filter::Reference - POE Freeze/Thaw Protocol Abstraction</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>