1Rose::Object(3) User Contributed Perl Documentation Rose::Object(3)
2
3
4
6 Rose::Object - A simple object base class.
7
9 package MyObject;
10
11 use Rose::Object;
12 our @ISA = qw(Rose::Object);
13
14 sub foo { ... }
15 sub bar { ... }
16 ...
17
18 my $o = MyObject->new(foo => 'abc', bar => 5);
19 ...
20
22 Rose::Object is a generic object base class. It provides very little
23 functionality, but a healthy dose of convention.
24
26 new PARAMS
27 Constructs a new, empty, hash-based object based on PARAMS, where
28 PARAMS are name/value pairs, and then calls init (see below),
29 passing PARAMS to it unmodified.
30
31 init PARAMS
32 Given a list of name/value pairs in PARAMS, calls the object method
33 of each name, passing the corresponding value as an argument. The
34 methods are called in the order that they appear in PARAMS. For
35 example:
36
37 $o->init(foo => 1, bar => 2);
38
39 is equivalent to the sequence:
40
41 $o->foo(1);
42 $o->bar(2);
43
45 John C. Siracusa (siracusa@gmail.com)
46
48 Copyright (c) 2010 by John C. Siracusa. All rights reserved. This
49 program is free software; you can redistribute it and/or modify it
50 under the same terms as Perl itself.
51
52
53
54perl v5.34.0 2022-01-21 Rose::Object(3)