10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Could you please help me to get last reference date in Unix, in Unix we maintain SAS7BDAT files.
Is there any command or script to get the info,
Thank you. (2 Replies)
Discussion started by: subbarao12
2 Replies
2. Shell Programming and Scripting
Guys,
May i know how can we de reference the code reference variable.?
my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";};
print $a->(4,5);
How can we print the whole function ?
Please suggest me regarding this.
Thanks for your time :)
Cheers,
Ranga :) (0 Replies)
Discussion started by: rangarasan
0 Replies
3. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
The problem is a function which i typed although it kept saying that it is a undefined reference still. other... (1 Reply)
Discussion started by: mgyeah
1 Replies
4. Programming
Ive just started programming in C and am confused with the output of the code
void main()
{
int a=10;
int b=20;
swapr(a++,b++);
printf("%d %d",a,b);
}
swapr (int *x,int *y)
{
x+=2;
y+=3;
}
the output of the code is 11,21 which is confusing. first its... (3 Replies)
Discussion started by: ra2000
3 Replies
5. Shell Programming and Scripting
Hi all,
I have a reference named $test. it points to the data structure as follows
'test' =>
},
... (1 Reply)
Discussion started by: Damon sine
1 Replies
6. Programming
Hi All,
Which one do you think is better as the C reference book: C in a Nutshell (O'Reilly, 2005) or C Primer Plus 5th ed. (Sams, 2004)?
I knew both of them should be great, but I certainly do not want to buy both. Any suggestion? Thanks! (6 Replies)
Discussion started by: zx1106
6 Replies
7. Shell Programming and Scripting
Hi!
I need to determin the most efficient way to do something (rather simple, I thought).
I'm currently echo(ing) a series of menu options, and reading the command input as the number associated with the entry. What I need to do is when the option 1 is selected, that it references a list and... (18 Replies)
Discussion started by: cchaloux
18 Replies
8. HP-UX
I'm having to write 'C' programs for a group of HP-UX 11.X systems. While I have found many 'C' reference books which I like, none of them reference using 'C' in the UNIX environment.
Anyone have any good recommendations for books about 'C' programming under UNIX?
Thanks.
Chris (0 Replies)
Discussion started by: chrisc@nwark.ne
0 Replies
9. Shell Programming and Scripting
I might know the answer to this, but I just want to see if any of you know any work arounds before I go and re-write the whole thing.
I have a script as follow:
$ cat testing
#! /usr/bin/ksh
f ()
{
echo "Type \"y\" \c"
read value
if ;
then
... (1 Reply)
Discussion started by: fidodido
1 Replies
10. Programming
Can any one explain how the statement '2' in the following statements is a legal one.
int & ref = 3; // Illegal statement - Compiler error.
const int& ref=3 ; // Compile and executes properly.
Thanks in Advance,
Arun (1 Reply)
Discussion started by: arun.viswanath
1 Replies
POE::Filter::Reference(3pm) User Contributed Perl Documentation POE::Filter::Reference(3pm)
NAME
POE::Filter::Reference - freeze and thaw arbitrary Perl data
SYNOPSIS
#!perl
use YAML;
use POE qw(Wheel::ReadWrite Filter::Reference);
POE::Session->create(
inline_states => {
_start => sub {
pipe(my($read, $write)) or die $!;
$_[HEAP]{io} = POE::Wheel::ReadWrite->new(
InputHandle => $read,
OutputHandle => $write,
Filter => POE::Filter::Reference->new(),
InputEvent => "got_perl_data",
);
$_[HEAP]{io}->put(
{ key_1 => 111, key_2 => 222 }
);
},
got_perl_data => sub {
print "Got data:
", YAML::Dump($_[ARG0]);
print "Bye!
";
delete $_[HEAP]{io};
}
}
);
POE::Kernel->run();
exit;
DESCRIPTION
POE::Filter::Reference allows programs to send and receive arbitrary Perl data structures without worrying about a line protocol. Its
put() method serializes Perl data into a byte stream suitable for transmission. get_one() parses the data structures back out of such a
stream.
By default, POE::Filter::Reference uses Storable to do its magic. A different serializer may be specified at construction time.
PUBLIC FILTER METHODS
POE::Filter::Reference deviates from the standard POE::Filter API in the following ways.
new [SERIALIZER [, COMPRESSION [, NO_FATALS]]]
new() creates and initializes a POE::Filter::Reference object. It will use Storable as its default SERIALIZER if none other is specified.
If COMPRESSION is true, Compress::Zlib will be called upon to reduce the size of serialized data. It will also decompress the incoming
stream data.
If NO_FATALS is true, messages will be thawed inside a block eval. By default, however, thaw() is allowed to die normally. If an error
occurs while NO_FATALS is in effect, POE::Filter::Reference will return a string containing the contents of $@ at the time the eval failed.
So when using NO_FATALS, it's important to check whether input is really a reference:
sub got_reference {
my $message = $_[ARG0];
if (ref $message) {
print "Got data:
", YAML::Dump($message);
}
else {
warn "Input decode error: $message
";
}
}
Any class that supports nfreeze() (or freeze()) and thaw() may be used as a SERIALIZER. If a SERIALIZER implements both nfreeze() and
freeze(), then the "network" version will be used.
SERIALIZER may be a class name:
# Use Storable explicitly, specified by package name.
my $filter = POE::Filter::Reference->new("Storable");
# Use YAML instead. Compress its output, as it may be verbose.
my $filter = POE::Filter::Reference->new("YAML", 1);
SERIALIZER may also be an object:
# Use an object.
my $serializer = Data::Serializer::Something->new();
my $filter = POE::Filter::Reference->new($serializer);
If SERIALIZER is omitted or undef, the Reference filter will try to use Storable, FreezeThaw, and YAML in that order.
POE::Filter::Reference will die if it cannot find one of these serializers, but this rarely happens now that Storable and YAML are bundled
with Perl.
# A choose-your-own-serializer adventure!
# We'll still deal with compressed data, however.
my $filter = POE::Filter::Reference->new(undef, 1);
POE::Filter::Reference will try to compress frozen strings and uncompress them before thawing if COMPRESSION is true. It uses
Compress::Zlib for this. POE::Filter::Reference doesn't need Compress::Zlib if COMPRESSION is false.
new() will try to load any classes it needs.
SERIALIZER API
Here's what POE::Filter::Reference expects of its serializers.
thaw SERIALIZED
thaw() is required. It accepts two parameters: $self and a scalar containing a SERIALIZED byte stream representing a single Perl data
structure. It returns a reconstituted Perl data structure.
sub thaw {
my ($self, $stream) = @_;
my $reference = $self->_deserialization_magic($stream);
return $reference;
}
nfreeze REFERENCE
Either nfreeze() or freeze() is required. They behave identically, except that nfreeze() is guaranteed to be portable across networks and
between machine architectures.
These freezers accept two parameters: $self and a REFERENCE to Perl data. They return a serialized version of the REFERENCEd data.
sub nfreeze {
my ($self, $reference) = @_;
my $stream = $self->_serialization_magic($reference);
return $stream;
}
freeze REFERENCE
freeze() is an alternative form of nfreeze(). It has the same call signature as nfreeze(), but it doesn't guarantee that serialized data
will be portable across machine architectures.
If you must choose between implementing freeze() and nfreeze() for use with POE::Filter::Reference, go with nfreeze().
SEE ALSO
Please see POE::Filter for documentation regarding the base interface.
The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.
BUGS
Not so much bugs as caveats:
It's important to use identical serializers on each end of a connection. Even different versions of the same serializer can break data in
transit.
Most (if not all) serializers will re-bless data at the destination, but many of them will not load the necessary classes to make those
blessings work. Make sure the same classes and versions are available on either end of the wire.
AUTHORS & COPYRIGHTS
The Reference filter was contributed by Artur Bergman, with changes by Philip Gwyn.
Please see POE for more information about authors and contributors.
perl v5.14.2 2012-05-15 POE::Filter::Reference(3pm)