in reply to Module provides both of functional interface and object-oriented one
Usage from the main code:package Foo; use Moose; use Sub::Exporter -setup => {exports => [qw(procedure1 procedure2)]}; # OO stuff comes here has some_attribute … sub some_method { my ($self, @args) = @_; … } # procedural stuff comes here sub procedure1 { my $self = __PACKAGE__->new; # if needed my @args = @_; … } sub procedure2 { my $self = __PACKAGE__->new; # if needed my @args = @_; … } 1;
use Foo qw(procedure1); procedure1(foo bar quux); my $f = Foo->new(some_attribute => baz); $f->some_method;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Module provides both of functional interface and object-oriented one
by anazawa (Scribe) on Feb 16, 2012 at 18:25 UTC | |
by tobyink (Canon) on Feb 17, 2012 at 09:01 UTC | |
by anazawa (Scribe) on Feb 17, 2012 at 09:13 UTC |