Re: Function to print Object properties

2011-01-07 Thread Alan Haggai Alavi
Hi Parag, On Friday 07 January 2011 07:55:38 Parag Kalra wrote: > Anyways I want to know is there any function or a way that would > reveal all the properties of the object. Introspect the symbol table hash (stash): use strict; use warnings; use Data::Dumper; use Foo::Bar; my $fob = Foo::Bar->

Re: Function to print Object properties

2011-01-06 Thread Peter Scott
On Thu, 06 Jan 2011 21:31:11 -0500, Shawn H Corey wrote: > On 11-01-06 09:25 PM, Parag Kalra wrote: >> For example if I have a package say Foo::Bar. Now assume that there is >> a object called $fob and pretend that I don't know that its an instance >> of Foo::Bar > > print ref( $fob ), "\n"; > >

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Awesome. Thanks Alan and Shawn Cheers, Parag On Thu, Jan 6, 2011 at 6:52 PM, Alan Haggai Alavi wrote: > Hi Parag, > > On Friday 07 January 2011 07:55:38 Parag Kalra wrote: >> Anyways I want to know is there any function or a way that would >> reveal all the properties of the object. > > Intr

Re: Function to print Object properties

2011-01-06 Thread Shawn H Corey
On 11-01-06 09:46 PM, Parag Kalra wrote: Thanks it worked.:) Cheers, Parag You can also print the whole thing out with Data::Dumper use Data::Dumper; if( ref( $fob ) ){ print '$fob ', Dumper $fob; } -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of under

Re: Function to print Object properties

2011-01-06 Thread Parag Kalra
Thanks it worked. :) Cheers, Parag On Thu, Jan 6, 2011 at 6:31 PM, Shawn H Corey wrote: > On 11-01-06 09:25 PM, Parag Kalra wrote: >> >> For example if I have a package say Foo::Bar. Now assume that there is >> a object called $fob and pretend that I don't know that its an >> instance of Foo::

Re: Function to print Object properties

2011-01-06 Thread Shawn H Corey
On 11-01-06 09:25 PM, Parag Kalra wrote: For example if I have a package say Foo::Bar. Now assume that there is a object called $fob and pretend that I don't know that its an instance of Foo::Bar print ref( $fob ), "\n"; See `perldoc -f ref`. -- Just my 0.0002 million dollars worth, Sh

Function to print Object properties

2011-01-06 Thread Parag Kalra
Hi, This question is related to OOPs in Perl and I am learning and enjoying it gradually. Anyways I want to know is there any function or a way that would reveal all the properties of the object. For example if I have a package say Foo::Bar. Now assume that there is a object called $fob and pret