Commit 26180ceb by PotatoGim

perl: lvalue example

parent 5f8f0a50
#!/usr/bin/env perl
#===========================================================================
# FILE: lvalue.pl
# USAGE: ./lvalue.pl
# DESCRIPTION:
# VERSION: 0.1
# OPTIONS: ---
# NOTES: ---
# AUTHOR: Ji-Hyeon Gim <potatogim@potatogim.net>
# COPYRIGHT: Copyleft 2018 by Ji-Hyeon Gim.
# LICENSE: Artistic License 2.0
# DATE: 2018년 02월 10일 01시 15분 45초
#===========================================================================
use strict;
use warnings;
use utf8;
our $AUTHOR = "cpan:potatogim";
our $VERSION = "0.1";
package Foo;
sub new
{
bless {}, shift;
}
sub bar : lvalue
{
my $self = shift;
# must return the variable for lvalue-ness
$self->{bar};
}
package main;
my $foo = Foo->new();
$foo->bar = 'potatogim';
print $foo->bar;
=encoding utf8
=head1 NAME
lvalue.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 AUTHOR
Ji-Hyeon Gim E<lt>potatogim@potatogim.netE<gt>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyleft 2018 by Ji-Hyeon Gim.
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=head1 DATE
2018년 02월 10일 01시 15분 45초
=cut
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment