You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came to this module trying to generate email addresses for fake people. This module has the necessary providers (ie. Internet), but is there any way to make it generate data that makes sense as a set?
Case in point: if I generate a person whose name is "Zachary Tinnel", it wouldn't make sense for this person to have the username "srodriguez" or the email "yoko75@bigwiz.net".
What I would like to do is something like this:
my$fake = Faker->new;
my$person = $fake->provider('Person');
my$internet = $fake->provider('Internet');
# Generate a random user# eg. Zachary Tinnelmy%user = (
first_name=>$person->first_name,
last_name=>$person->last_name,
);
# Generate a related username. One of eg.# ztinnel# zachary.tinnel# tinnel.zachary# zachary85$user->{user_name} = $person->username(%user);
# Generate a related email address.# eg. <ztinnel@yahoo.com>, or <zachary85@foobar.net> $user->{email_address} = $internet->email_address(
username=>$user{user_name}
);
The way I imagine this working is that the argument to the functions that generate the fields would receive an optional hash as argument, and populate the used formats with the values received (or with random data, if left undefined). That way, the existing behaviour would remain unchanged, but the user would have the option of controlling the generated output.
What do you think?
The text was updated successfully, but these errors were encountered:
I understand the ask but trying to account for stickiness and variability of each generator and how they might relate to other generators/providers would be a nightmare to support. A better approach (which I've used personally, professionally) is to create classes where the accessors and methods generate fake data and persist it (class attributes) where appropriate. Then you could related as much data as you want (as a set). Sorry for the delayed reply, I just refactored this library and will be releasing within the hour!
I came to this module trying to generate email addresses for fake people. This module has the necessary providers (ie.
Internet
), but is there any way to make it generate data that makes sense as a set?Case in point: if I generate a person whose name is "Zachary Tinnel", it wouldn't make sense for this person to have the username "srodriguez" or the email "yoko75@bigwiz.net".
What I would like to do is something like this:
The way I imagine this working is that the argument to the functions that generate the fields would receive an optional hash as argument, and populate the used formats with the values received (or with random data, if left undefined). That way, the existing behaviour would remain unchanged, but the user would have the option of controlling the generated output.
What do you think?
The text was updated successfully, but these errors were encountered: