| Acme-Hello documentation | Contained in the Acme-Hello distribution. |
Acme::Hello - Print a greeting message
This document describes version 0.04 of Acme::Hello.
use Acme::Hello; # exports hello() by default
hello(); # procedure call interface
my $obj = Acme::Hello->new;
$obj->hello; # object-oriented interface
To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to Acme-Hello.
This work is published from Taiwan.
| Acme-Hello documentation | Contained in the Acme-Hello distribution. |
package Acme::Hello; $Acme::Hello::VERSION = '0.05'; use strict; use Acme::Hello::I18N; use Exporter; use base 'Exporter'; use vars '@EXPORT'; @EXPORT = 'hello';
sub new { my ($class, %args) = @_; $class = ref($class) if (ref $class); $args{lh} ||= Acme::Hello::I18N->get_handle($args{language}) or die "Cannot find handle for language: $args{language}.\n"; return bless(\%args, $class); } sub hello { my $self = ref($_[0]) ? $_[0] : __PACKAGE__->new; print $self->loc("Hello, world!"), "\n"; } sub lh { my $self = shift; $self->{lh} = shift if @_; return $self->{lh}; } sub loc { my $self = shift; return $self->lh->maketext(@_); } 1; __END__