On 28 February 2016 at 21:59, rakesh sharma wrote:
> According to docs bless returns the reference to self.
That just means that if you do:
my $x = {};
my $y = bless $x, "THING";
$y and $x will both be the same thing, a {} blessed into "Thing"
Its just more convenien
On Sun, 28 Feb 2016 08:59:20 +
rakesh sharma wrote:
>
> HI all
>
> I am using object oriented perl and saw return self as well as bless
> being used According to docs bless returns the reference to self. Why
> should we use both statements in the new method
>
&
Can you share the code?
I believe the bless is returning the reference to self, which is captured
in a variable with name self and that variable is returned from new method.
Does that explains it?
Thanks
Kiran.
On 28 Feb 2016 9:00 am, "rakesh sharma" wrote:
>
>
> HI all
HI all
I am using object oriented perl and saw return self as well as bless being used
According to docs bless returns the reference to self. Why should we use both
statements in the new method
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
On 01/13/2012 07:25 PM, Parag Kalra wrote:
my $obj = FooBar->new;
$obj->{'new_key'} = 'some_value'
Now I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
1. FooBar may or may not be implemented as a hashref.
w I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
My aim to use this data structure across the script and FooBar through the
object -$obj once added.
This could cause problems if a new version of FooBar starts using
new_key. Instead, creat
δΊ 2012-1-14 11:25, Parag Kalra ει:
use FooBar;
my $obj = FooBar->new;
Do something
...
$obj->{'new_key'} = 'some_value'
Now I am not sure if that is the correct way of inserting a new data
structure into an already bless reference
I don't thin
ay of inserting a new data
structure into an already bless reference
My aim to use this data structure across the script and FooBar through the
object -$obj once added.
Hi Ken!
Ken Perl <[EMAIL PROTECTED]> wrote:
>
> what does the statement mean?
>
> bless $self, $class;
Thar is what a perl monk says to a his students when he sneezes during a
lesson and no one says "Gazunteit".
-dave
--
To unsubscribe, e-mail: [EMAIL PROTEC
Also check out
perldoc perltoot
perldoc perltooc
-Original Message-
From: Kirill Ponomarew [mailto:[EMAIL PROTECTED]
Sent: Friday, February 17, 2006 12:30 AM
To: Ken Perl
Cc: Perl Beginners List
Subject: Re: bless $self, $class;
On Fri, Feb 17, 2006 at 04:26:33PM +0800, Ken Perl
On 2/17/06, Ken Perl <[EMAIL PROTECTED]> wrote:
> what does the statement mean?
>
> bless $self, $class;
snip
This is how you make objects in Perl. The bless function adds some
meta data to the variable that is blessed telling it that it is now of
class $class. You will usually
what does the statement mean?
bless $self, $class;
--
perl -e 'print unpack(u,"62V5N\"FME;G\!Ehttp://learn.perl.org/> <http://learn.perl.org/first-response>
On Fri, Feb 17, 2006 at 04:26:33PM +0800, Ken Perl wrote:
> what does the statement mean?
>
> bless $self, $class;
http://www.perl.com/doc/manual/html/pod/perlfunc/bless.html
-Kirill
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECT
On Feb 20, 2004, at 11:29 PM, R. Joseph Newton wrote:
Jacob Chapa wrote:
what does bless do?
It gives the hash reference offered as the first argument access to
the methods
of the package named by the second argument. there is more, but this
is an
alright place to start.
The effect is to
Jacob Chapa wrote:
> what does bless do?
It gives the hash reference offered as the first argument access to the methods
of the package named by the second argument. there is more, but this is an
alright place to start.
The effect is to turn the hash reference into an object refere
Randy W. Sims wrote:
>
> On 02/20/04 01:35, Jacob Chapa wrote:
>
> > what does bless do?
>
> It depends on how much you know. ;-)
>
> Basically it takes a reference to a perl type and tags it as an object,
> so that in addition to being a reference to a type, i
= \%ahash;
$href->{key} = 'value';
print $href->{key};
print HR;
my $blessed_ref = bless $href;
print $blessed_ref->{key};
print HR;
sub say_hello { print "Hello, World!\n"; }
$blessed_ref->say_hello();
print HR;
use Data::Dumper;
print Dumper($blessed_ref)
On 02/20/04 01:35, Jacob Chapa wrote:
what does bless do?
It depends on how much you know. ;-)
Basically it takes a reference to a perl type and tags it as an object,
so that in addition to being a reference to a type, it now has special
properties: primarily that it can have subroutines
=pod
Jacob Chapa wrote:
what does bless do?
=cut
$object = {};# hash reference
# bless $object into Data::Encoder class
bless($object, "Data::Encoder");
bless($object); # bless $object into current package
$obj = [3,5];
print ref($obj), " ", $obj->[1], "\n&qu
what does bless do?
-jake
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
On Tuesday, September 16, 2003, at 09:26 PM, sfryer wrote:
So ... what is the correct "strict" way to "bless $talking, Horse"?
bless $talking, "Horse";
George
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Sep 16, sfryer said:
>use strict;
> bless $talking, Horse; # <<<< this is the source of the problem
Quote 'Horse'.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.
the error message it generates.
> perl -w
use strict;
my $name= "Mr. Ed";
my $talking = \$name;
bless $talking, Horse; # <<<< this is the source of the problem
print Horse->speak,
$talking->name, " says ", $talking->
Nigel Wetters wrote:
> On Wed, 2002-12-11 at 13:55, Ruth Albocher wrote:
> > I need to "cast" a scalar reference (SCALAR0x) into a reference to
> > an object that I can use. (in other words, bless it).
> > How can I do it?
>
> my $object = bless $sca
On Wed, 2002-12-11 at 13:55, Ruth Albocher wrote:
> I need to "cast" a scalar reference (SCALAR0x) into a reference to
> an object that I can use. (in other words, bless it).
> How can I do it?
my $object = bless $scalar_reference, 'Your::Class';
--
Nig
Hi all.
I need to "cast" a scalar reference (SCALAR0x) into a reference to
an object that I can use. (in other words, bless it).
How can I do it?
thanks,
ruthie
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Peter and Jenda,
Thank you both for your information and pointers, I appreciated
them.
I actually ended up doing something slightly different; I wanted
to make method calls use identical syntax, whether they were going to the
APC::Event or the Tie::DBI, so what I ended up doing
At 02:19 AM 3/14/02 +0100, Jenda Krynicky wrote:
> > 3) If I bless %self out of the "Tie::Hash" space and into the
> > "APC::Event" space, are the "Tie::Hash" functions going to stop
> > working? (I assume so.)
>
>You can't bless a ha
E
> };
>
>
> my $class =ref $proto# Are we being called as a class or
> || $proto# instance method?
> || 'APC::Event';
>
> bless \%self, $class;
> }
I think this should be OK.
&g
=> 1, # Allow INSERT and UPDATE,
# but not DELETE
};
my $class =ref $proto# Are we being called as a class or
|| $proto# instance method?
|| 'APC::Event';
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Baby Lakshmi) wrote:
> I really dont understand the functionality and advantages of using bless.
bless() "tags" a reference with a package name, effectively turning
it into an object. without bless you don't
On Sep 17, baby lakshmi said:
>should we have to use the bless fuction in the constructor alone we can
>use the created object ($foo) to invoke the function. isnt it??? so whatz
>the real advandage of using bless function??? and why we need to bless that
>particular ob
Hello Jeff,
Thank you for ur reply.
> >package Animal;
> >sub named {
> > my $class = shift;
> > my $name = shift;
> > bless \$name, $class;
> >}
> >sub eat{
> > my $class = shift;
> > $class = ref($class) || $class;
&g
On Sep 14, baby lakshmi said:
>package Animal;
>sub named {
> my $class = shift;
> my $name = shift;
> bless \$name, $class;
>}
>sub eat{
> my $class = shift;
> $class = ref($class) || $class;
> my $food = shift;
> print "$class eats
hello friends,
i have a doubt in the concept of blessing.
package Animal;
sub named {
my $class = shift;
my $name = shift;
bless \$name, $class;
}
sub eat{
my $class = shift;
$class = ref($class) || $class;
my $food = shift;
print "$class eats $food\n&qu
Thanks for all your replies, the backticks work!
Ed
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
36 matches
Mail list logo