www.farid-hajji.net banner

Farid Hajji

Perl: Einführung, Anwendungen, Referenz (2/e) [Support-Site]

Farid Hajji: Perl - Einführung, Anwendungen, Referenz
2., aktualisierte und erweiterte Auflage
Addison-Wesley Longman, ISBN 3-8273-1535-2

Beispielprogramm

test-hash-object.pl
#!/usr/local/bin/perl -w
# test-hash-object.pl -- Testet die perfekte namenshashbasierte Klasse.

use ClassWithAnonHash;

$mary = ClassWithAnonHash->new(name => 'mary', phone => '555-1234');
$john = ClassWithAnonHash->new(name => 'john', phone => '555-9999',
                               room => '42',   fax   => '555-7777');

print join(' ', map { "$_: " . $john->getAttribute($_) }
                sort $john->getAttributeNames() ),
      "\n";

$mary->setAttribute('room', '41');
print "Room of Mary: ", $mary->getAttribute('room'), "\n";
   

[Prev] [Up] [Relevant Chapter] [Next]

[Alte Quelle]


Last modified: $Date: 2006/05/18 12:56:08 $
FH. Search :: Sitemap :: Disclaimer :: Copyright :: Privacy
FreeBSD Logo