Acme-ID-CompanyName

 view release on metacpan or  search on metacpan

lib/Acme/ID/CompanyName.pm  view on Meta::CPAN


          ADD_PREFIX:
            {
                last unless $will_add_prefix;
                my $prefix = $Prefixes[@Prefixes * rand()];
                redo WORD if $desired_initial && substr($prefix, 0, 1) ne $desired_initial;

                # avoid prefixing e.g. 'indo-' to 'indonesia'
                last if $word =~ /^\Q$prefix\E/;

                # amalgamate letter
                if (substr($prefix, -1, 1) eq substr($word, 0, 1)) {
                    $word =~ s/^.//;
                }

                $word = "$prefix$word";
                $has_added_prefix++;
            }

          ADD_SUFFIX:
            {
                last unless $add_suffixes;
                last unless !$has_added_suffix && rand()*$num_words*3 < 1;
                my $suffix = $Suffixes[@Suffixes * rand()];

                # avoid suffixing e.g. '-tama' to 'pertama'
                last if $word =~ /\Q$suffix\E$/;

                # amalgamate letter
                if (substr($word, -1, 1) eq substr($suffix, 0, 1)) {
                    $word =~ s/.$//;
                }

                $word = "$word$suffix";
                $has_added_suffix++;
            }

            # avoid duplicate words
            redo if grep { $word eq $_ } @words;

            push @words, ucfirst $word;
        }
        my $name = join(" ", $type, @words);

        # avoid duplicate name
        redo if grep { $name eq $_ } @res;

        push @res, $name;

    }
    return \@res;
}

1;
# ABSTRACT: Generate nice-sounding, generic Indonesian company names

__END__

=pod

=encoding UTF-8

=head1 NAME

Acme::ID::CompanyName - Generate nice-sounding, generic Indonesian company names

=head1 VERSION

This document describes version 0.007 of Acme::ID::CompanyName (from Perl distribution Acme-ID-CompanyName), released on 2021-05-07.

=head1 DESCRIPTION

=head1 FUNCTIONS


=head2 gen_generic_ind_company_names

Usage:

 gen_generic_ind_company_names(%args) -> any

Generate nice-sounding, generic Indonesian company names.

Examples:

=over

=item * Generate five random PT names:

 gen_generic_ind_company_names( num_names => 5);

Result:

 [
   "PT Hulu Humania Harmoni",
   "PT Jaya Cipta Indoakurasi",
   "PT Baru Berjaya Legenda",
   "PT Normal Zona Gempita",
   "PT Multi Gelora Baswara",
 ]

=item * Generate three PT names with desired initials "ACME":

 gen_generic_ind_company_names( num_names => 3, desired_initials => "ACME");

Result:

 [
   "PT Aksara Catur Mekar Elektronik",
   "PT Anugerah Cendrawasih Mandala Esa",
   "PT Asaindo Cakra Mandala Elang",
 ]

=back

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

=over 4



( run in 0.414 second using v1.01-cache-2.11-cpan-bbe5e583499 )