1: package Object::Clone;
2:
3: use strict;
4: use vars qw($VERSION);
5: use Data::Dumper;
6:
7: $VERSION = '0.02';
8:
9: sub clone {
10: my $self = shift;
11:
12: my $VAR1;
13: my $copy_dump = Dumper $self;
14:
15: eval $copy_dump; warn $@ if $@;
16:
17: return $VAR1;
18: }
19:
20: =pod
21:
22: =head1 NAME
23:
24: Object::Clone
25:
26: =head1 SYNOPSIS
27:
28: package Myclass;
29:
30: @ISA = qw(Object::Clone);
31:
32: my object1 = Myclass->new(attribute => 'argle');
33: my object2 = object1->clone;
34:
35: =head1 DESCRIPTION
36:
37: This class offers a simple cloning method. So you can make copies of your object
38: s fast.
39:
40: =over
41:
42: =item clone
43:
44: The method use to clone objects. Takes no arguments, just has to be called as a
45: regular method (cause it is) and returns a new object.
46:
47: =back
48:
49: =head1 AUTHOR
50:
51:
52: jonasbn <jonasbn@wanadoo.dk>
53:
54: =head1 BUGS
55:
56: No known bugs.
57:
58: =head1 SEE ALSO
59:
60: L<Data::Dumper>
61:
62: =head1 COPYRIGHT
63:
64: Copyright (c) 2001 Jonas B. Nielsen. All rights
65: reserved. This program is free software; you can
66: redistribute it and/or modify it under the same
67: terms as Perl itself.
68:
69: Drop me a mail - it will be appreciated.
70:
71: Home of this code is http://jonasbn.hjem.wanadoo.dk/perl
72:
73: =cut
74:
75: 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Object::Clone a simple class providing a cloning method
by dws (Chancellor) on Nov 19, 2001 at 02:43 UTC | |
|
Re: Object::Clone a simple class providing a cloning method
by premchai21 (Curate) on Nov 18, 2001 at 23:54 UTC | |
|
Re: Object::Clone a simple class providing a cloning method
by belg4mit (Prior) on Nov 18, 2001 at 23:05 UTC | |
|
Re: Object::Clone a simple class providing a cloning method
by IlyaM (Parson) on Nov 26, 2001 at 05:36 UTC |