0: package Object::Clone;
1:
2: use strict;
3: use vars qw($VERSION);
4: use Data::Dumper;
5:
6: $VERSION = '0.02';
7:
8: sub clone {
9: my $self = shift;
10:
11: my $VAR1;
12: my $copy_dump = Dumper $self;
13:
14: eval $copy_dump; warn $@ if $@;
15:
16: return $VAR1;
17: }
18:
19: =pod
20:
21: =head1 NAME
22:
23: Object::Clone
24:
25: =head1 SYNOPSIS
26:
27: package Myclass;
28:
29: @ISA = qw(Object::Clone);
30:
31: my object1 = Myclass->new(attribute => 'argle');
32: my object2 = object1->clone;
33:
34: =head1 DESCRIPTION
35:
36: This class offers a simple cloning method. So you can make copies of your object
37: s fast.
38:
39: =over
40:
41: =item clone
42:
43: The method use to clone objects. Takes no arguments, just has to be called as a
44: regular method (cause it is) and returns a new object.
45:
46: =back
47:
48: =head1 AUTHOR
49:
50:
51: jonasbn <jonasbn@wanadoo.dk>
52:
53: =head1 BUGS
54:
55: No known bugs.
56:
57: =head1 SEE ALSO
58:
59: L<Data::Dumper>
60:
61: =head1 COPYRIGHT
62:
63: Copyright (c) 2001 Jonas B. Nielsen. All rights
64: reserved. This program is free software; you can
65: redistribute it and/or modify it under the same
66: terms as Perl itself.
67:
68: Drop me a mail - it will be appreciated.
69:
70: Home of this code is http://jonasbn.hjem.wanadoo.dk/perl
71:
72: =cut
73:
74: 1;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|