Rob Kinyon

NAME

DBIx::Class::Sims::Types

PURPOSE

These are pre-defined sim types for using with DBIx::Class::Sims.

TYPES

The following sim types are pre-defined:

  • email_address

    This generates a reasonable-looking email address. The account and server names are randomly generated. The TLD is selected from a list of TLDs, including 'co.uk' (so be warned). If the server name is large enough, a '.' will be added to create a 2-level name.

    There is a small chance that a more complex email address will be used. These email addresses are ones that are more likely to break poorly-written validator checks. Some real-life (completely legal) examples are:

    • rob.kinyon+lists@gmail.com

  • ip_address

    This generates a reasonable-looking IP address.

  • us_address

    This generates a reasonable-looking US street address. The address will be one of these forms:

    • "#### Name Type", so something like "123 Main Street"

    • "PO Box ####", so something like "PO Box 13579"

    • "P.O. Box ####", so something like "P.O. Box 97531"

  • us_city

    This generates a reasonable-looking US city name.

  • us_county

    This generates a reasonable-looking US county name.

  • us_firstname

    This generates a reasonable-looking US person first name. It will be randomized as to gender.

  • us_lastname

    This generates a reasonable-looking US person last name. It may contain one word, two words, or an apostrophized word.

  • us_name

    This generates a reasonable-looking US person name. The first and last names will be generated from us_firstname and us_lastname, respectively. There is a small chance a suffix will be appended.

  • us_phone

    This generates a reasonable-looking US phone-number, based on the size of the column being filled. The column is assumed to be a character-type column (varchar, etc). If the size of the column is less than 10, there will be no area code. If there is space, hyphens and parentheses will be added in the right places. If the column is long enough, the value will look like "(###) ###-####"

    Phone extensions are not supported at this time.

  • us_ssntin

    This generates a reasonable-looking US Social Security Number (SSN) or Tax Identification Number (TIN). These are government identifiers that are often usable as unique personal IDs. An SSN is a personal ID number and a TIN is a corporate ID number.

  • us_state

    This generates a random US state or territory (so 57 choices). The column is assumed to be able to take a US state as a value. If the size of the column is 2 (the default), then the abbreviation will be returned. Otherwise, the first N characters of the name (where N is the size) will be returned.

  • us_zipcode

    This generates a reasonable-looking US zipcode. If the column is numeric, it generates a number between 1 and 99999. Otherwise, it generates a legal string of numbers (with a possible dash for a 5+4) that will fit within the column's width.

The reason why several of the pre-defined sim types have the country prefixed is because different countries do things differently. (Shocker, I know!)

AUTHOR

Rob Kinyon <rob.kinyon@gmail.com>

LICENSE

Copyright (c) 2013 Rob Kinyon. All Rights Reserved. This is free software, you may use it and distribute it under the same terms as Perl itself.




Hosting generously
sponsored by Bytemark