kopia objectu

Aben Siatris aben na webcom.sk
Čtvrtek Říjen 16 12:09:39 MEST 2003


> Pokud bude ten konstruktor
> 
> sub new {
> 	my $class = shift;
> 	if (ref $class) {
> 		return bless { $class->content() }, ref $class;
> 	} else {
> 		return bless { @_ }, $class;
> 	}
> }
> 
> tam bude vracen objekt jako novy anonymni hash, s nejakymi hodnotami,
> ktere klidne mohou byt uplne nov, byt budou odvozezene z hodnot
> $obj1.
> 
> > sa odrazi tiez v obj1 a ja by som chcel
> > vytvorit len copy. da sa to vobec???
> 
> Da se vsechno. Uplne na zacatku je treba si uvedomit, ze Perl s pojmy
> jako copy a clone vubec nepracuje. Objekt je datova struktura. Jak tu
> strukturu naplnite, jestli budete sdilet hodnoty ci nikoli, je zcela
> na Vas.
ano, to viem. tomu ze je to vsak celkom na mne som sa chcel vyhnut.
vychadzam totizto z predpokladu ze content objectu su mi absolutne
nezname a rozne ich plnim. preto ani nemozem postavit nad nim
fciu $obj->content() (alebo mozem nejaky univerzalny? :-o)



btw: experimentoval tu uz niekto s parrotom?


-- 
:
:. stay cool
:..			Aben Siatris
:..			aben na webcom.sk
:.:
:.: www.WebCom.sk
:.: www.LaMonde.net
:.: www.HOWTOlinux.info
:.: www.SATANICMASS.info
:
--- Gentoo binutils: /usr/bin/sex
:.: "Let the games begin!" whimpered the large-boned nymphomaniac as the
:.: awesomely endowed ex-woman lashed her juicy knees and slid his hole
:.: splitting member into her tightly tensed palace.



Další informace o konferenci Perl