Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

data::faker::streetaddress(3pm) [debian man page]

Data::Faker::StreetAddress(3pm) 			User Contributed Perl Documentation			   Data::Faker::StreetAddress(3pm)

NAME
Data::Faker::StreetAddress - Data::Faker plugin SYNOPSIS AND USAGE
See Data::Faker DATA PROVIDERS
us_zip_code Return a random zip or zip+4 zip code in the US zip code format. Note that this is not necessarily a valid zip code, just a 5 or 9 digit number in the correct format. us_state Return a random US state name. us_state_abbr Return a random US state abbreviation. (Includes US Territories and AE, AA, AP military designations.) From the USPS list at http://www.usps.com/ncsc/lookups/usps_abbreviations.html street_suffix Return a random street suffix (Drive, Street, Road, etc.) From the USPS list at http://www.usps.com/ncsc/lookups/usps_abbreviations.html street_name Return a fake street name. street_address Return a fake street address. secondary_unit_designator Return a random secondary unit designator, with a range if needed (secondary unit designators are things like apartment number, building number, suite, penthouse, etc that differentiate different units with a common address.) secondary_unit_number Return a random secondary unit number, for the secondary unit designators that take ranges. SEE ALSO
Data::Faker AUTHOR
Jason Kohles, <email@jasonkohles.com> COPYRIGHT AND LICENSE
Copyright 2004-2005 by Jason Kohles This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-07-14 Data::Faker::StreetAddress(3pm)

Check Out this Related Man Page

Data::Faker(3pm)					User Contributed Perl Documentation					  Data::Faker(3pm)

NAME
Data::Faker - Perl extension for generating fake data SYNOPSIS
use Data::Faker; my $faker = Data::Faker->new(); print "Name: ".$faker->name." "; print "Company: ".$faker->company." "; print "Address: ".$faker->street_address." "; print " ".$faker->city.", ".$faker->state." ".$faker->zip." "; DESCRIPTION
This module creates fake (but reasonable) data that can be used for things such as filling databases with fake information during development of database related applications. OBJECT METHODS
new() Object constructor. As a shortcut, you can pass names of plugin modules to load to new(), although this does not actually restrict the functions available to the object, it just causes those plugins to be loaded if they haven't been loaded already. All Data::Faker objects in one interpreter share the plugin data, so that multiple objects don't multiply the memory requirements. methods(); Return a list of the methods that have been provided by all of the loaded plugins. register_plugin(); Plugin modules call register_plugin() to provide data methods. See any of the included plugin modules for examples. LOADING PLUGINS
You can specify which plugins to load by including just the base part of their name as an argument when loading the module with 'use'. For example if you only wanted to use data from the Data::Faker::Name module, you would load Data::Faker like this: use Data::Faker qw(Name); By default any modules matching Data::Faker::* in any directory in @INC will be loaded. You can also pass plugin names when calling the new() method, and they will be loaded if not already in memory. See new(). WRITING PLUGINS
Writing a plugin to provide new kinds of data is easy, all you have to do is create a module named Data::Faker::SomeModuleName that inherits from Data::Faker. To provide data, the plugin merely needs to call the register_plugin function with one or more pairs of function name and function data, like this: #!/usr/bin/perl -w use strict; use warnings; use Data::Faker; my $faker = Data::Faker->new(); print "My fake data is ".$faker->some_data_function." "; package Data::Faker::SomeData; use base 'Data::Faker'; __PACKAGE__->register_plugin( some_data_function => [qw(foo bar baz gazonk)], another_data_item => sub { return '$some_data_function' }, ); The first argument is the method that will be made available to your object, the second is a data source. If the data source is not a reference, it will simply be returned as the data, if it is a reference to an array, a random element from the array will be returned, and if it is a subroutine reference, the subroutine will be run and the results will be returned. The data that your data source provides is checked for two things, tokens (that look like perl variables, starting with a $), and numeric indicators (#). Any tokens found will be replaced with their values, and any numeric indicators will be replaced with random numbers. You can include a literal $ or # by prefacing it with a backslash. If you load more than one module that defines the same function, it has an additive effect, when the function is called one of the data sources provided will be selected at random and then it will be called to get a piece of data. Some data source examples: __PACKAGE__->register_plugin( age => ['#','##'], monetary_amount => ['$####.##','$###.##', '$##.##', '$#.##'], adult_age => sub { int(rand(70)+18) }, ); If your data source is a code reference, it will receive the calling object as an argument so you can build data out of other data if you need to. See Data::Faker::DateTime for some examples of this. BUGS AND KNOWN ISSUES
There is no way to selectively remove data sources from a plugin that was loaded, even if you didn't load it. SEE ALSO
Text::Lorem AUTHOR
Jason Kohles, <email@jasonkohles.com> COPYRIGHT AND LICENSE
Copyright 2004-2005 by Jason Kohles This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-07-14 Data::Faker(3pm)
Man Page