Alexey Skorikov > String-Blender-0.04 > String::Blender

Download:
String-Blender-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.04   Source  

NAME ^

String::Blender - flexible vocabulary-based generator of compound words (e.g. domain names).

VERSION ^

This document describes String::Blender version 0.04

SYNOPSIS ^

    use String::Blender;
    
    my $blender = String::Blender->new(
        vocab_files => [
            './vocab/hacker-jargon.txt',  # load into vocab #0
            [
                './vocab/places.txt',     # load both files
                './vocab/boosters.txt',   # into vocab #1
            ]
        ],
        quantity => 10,
        max_length => 20,
        max_elements => 3,
        postfix => '.com',
    );
    
    my @result = $blender->blend;
    
    # The @result will look like this:
    # (
    #      'tastybitshandler.com',
    #      'bubblesortcore.com',
    #      'regexpkingdom.com',
    #      'bigslashbase.com',
    #      'powerslurp.com',
    #      'pipestacklabel.com',
    #      'metaspoofzone.com',
    #      'randomsubshell.com',
    #      'forehandleroot.com',
    #      'pragmaware.com'
    # );
    
    # Vocabularies can be also specified directly, e.g.:
    my $blender = String::Blender->new(
        vocabs => [
            [qw/web net host site list archive core base switch/],
            [qw/candy honey muffin sugar sweet yammy/],
            [qw/area city club dominion empire field land valley world/],
        ],
        strict_order => 1,
        min_elements => 3,
        max_elements => 3,
        max_length => 20,
        delimiter => "-",
    );
    
    my @result = $blender->blend(5);
    
    # Then the @result will look like this:
    # (
    #      'base-honey-field',
    #      'list-candy-dominion',
    #      'web-sugar-land',
    #      'archive-muffin-field',
    #      'web-yammy-area'
    # );

DESCRIPTION ^

String::Blender is an OO implementation of random generator of compound words based on one or more priority driven word vocabularies. Originally the module was created for the purpose of constructing new attractive thematic domain names. Later it was used to improve dictionary attack tool.

Each vocabulary itself represents an array of single words not necessarily sorted. All vocabularies are stored in an array within predefined order. String::Blender provides ability to load vocabularies from plain text files or set them manually.

Resulting compound words are represented as an array of uniq strings which consist of one or more vocabulary words placed in serial or random order; probably prefixed, followed and/or separated by defined strings.

Construction of one compound word can be briefly described like this:

SUBROUTINES/METHODS ^

Class methods

Object methods

CONFIGURATION AND ENVIRONMENT ^

The following list gives a short summary of each String::Blender object attribute. All of them can be defined on object creation (see "new") or set separately like follows.

    $blender->max_elements(30);
    $blender->vocabs(\@my_vocabs);

Vocabularies

Constraints

Options

DIAGNOSTICS ^

There are some exceptional situations worth consideration.

Maximum tries limit exceeded (%s)

Normally the size of resulting list returned by the "blend" method should be equal to $quantity. But having in mind that the method is intended to provide a list of unique strings within certain restrictions, it becomes clear that in some conditions there is a chance to fall into infinite loop. That's what the "max_tries_factor" limitation attribute stands for. When the generator runs into narrow constraints and/or poor vocabularies, the resulting list may turn out to be shoter then expected or even empty. In this case relevant warning will follow. In order to avoid this you might want to increase value of the "max_tries_factor" attribute or weaken generation constraints such as "min_elements", "max_elements", "min_length", "max_length".

There are no vocabulary files specified

The load_vocabs method will die once the "vocab_files" attribute is not defined or refers to an empty list.

Could not open (close) file %s

"load_vocabs" will also die being unable to open any file specified in the "vocab_files" attribute.

Attribute (%s) does not pass the type constraint because: %s

Assigning any object attribute to a value which does not match the attribute's type constraints will cause relevant fatal error.

DEPENDENCIES ^

String::Blender depends on the Moose object system (version 0.74 or newer) which must be installed separately.

INCOMPATIBILITIES ^

None reported.

BUGS AND LIMITATIONS ^

No bugs have been reported. The API is not stable yet and can be changed in future.

Please report any bugs or feature requests to bug-string-blender@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR ^

Alexey Skorikov <alexey@skorikov.name>

LICENSE AND COPYRIGHT ^

Copyright (c) 2009, Alexey Skorikov <alexey@skorikov.name>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: