in reply to Module provides both of functional interface and object-oriented one

I concur, it's bad practice. The split over packages is brittle and unnecessary. Done with common modules (untested):
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;
Usage from the main code:
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
    Thanks for your suggestion. I feel it's modern to use Moose. Actually, I want to use my module in CGI environment, and so I think it's heavy to load Moose. In addition, I'm a Perl beginner. I want to know how to implement above features in an old-fashioned way.
        Thanks for your comment. I didn't know what Mo is. I can't decide whether to use Moose because I have never used :) I have to learn, anyway.