|
NAMENet::Amazon::MechanicalTurk::Command::UpdateHITs - Bulk HIT update support for Amazon Mechancial Turk.This module adds the updateHITs method to the Net::Amazon::MechanicalTurk class. SYNOPSISmy $properties = { Title => 'UpdateHITs Perl sample 2', Description => 'This is a test of the bulk updating API.', Keywords => 'UpdateHITs, bulkload, perl', Reward => { CurrencyCode => 'USD', Amount => 0.02 }, RequesterAnnotation => 'test', AssignmentDurationInSeconds => 60 * 60, AutoApprovalDelayInSeconds => 60 * 60 * 10, }; my $mturk = Net::Amazon::MechanicalTurk->new; $mturk->updateHITs( properties => $properties, input => "updatehits-input.csv", progress => \*STDOUT, success => "updatehits-success.csv", fail => "updatehits-failure.csv" ); "updateHITs"updateHITsBulk updates many hits to have a new hit type in Mechanical Turk. The method takes a set of properties used to create a HITType and its associated HITs. HITIds are pulled from an input source. For each row in the input source, the HIT it identifies is modified to have the properties specified. updateHITs takes a hash reference or a hash with the following parameters: properties - (required) Either a hash reference or the name of a file, containing the properties to use for generating a HITType and the associated HITs. When the properties are read from a file, the method Net::Amazon::MechanicalTurk::Properties->readNestedData is used. input - (required) The input source for row data. This parameter may be of the following types: - Net::Amazon::MechanicalTurk::RowData - An array of hashes. (This is internally converted into an object of type: Net::Amazon::MechanicalTurk::RowData::ArrayHashRowData) - A reference to a subroutine. When the updateHITs method asks for row data, the subroutine will be called and passed a subroutine reference, which should be called for every row generated by the input. The generated row should be a hash reference. (This is internally converted into an object of type Net::Amazon::MechanicalTurk::RowData::SubroutineRowData) - The name of a file. The file should be either a CSV or tab delimited file. If the file name ends with '.csv', it will read as a CSV, otherwise it is assumed to be tab delimited. The first row in the file should contain the column names. Each subsequence row becomes a hash reference based on the column names. (This is internally converted into an object of type Net::Amazon::MechanicalTurk::RowData::DelimitedRowData) progress - (optional) Used to display progress messages. This parameter may be of the following types: - A subroutine. The subroutine is called with 1 parameter, a message to be displayed. - An IO::Handle. The progress message is written to the handle. success - (optional) Used to handle a successfully created hit. This parameter may be of the following types: - A filename. HITId's and HITTypeId's will be written to this file. The file will be in a delimited format, with the first row containing column headers. If the filename ends in ".csv" the file format will be CSV, otherwise it will be tab delimited. - A subroutine. The subroutine is called when a hit is created and passed a hash with the following parameters: - mturk - A handle to the mturk client. - row - The input row the hit was created from. - HITId - The HITId of the updated HIT. - HITTypeId - The HITTypeId the updated HIT was assigned to. fail - (optional) Used to handle a hit which failed creation. If this value is not specified and a hit fails creation, an error will be raised. This value may be of the following types: - A filename. The input row will be written back to the file in a delimited format. If the file name ends with ".csv", then the file will be in CSV format, otherwise it will be in a tab delimited format. - A subroutine. The subroutine will be called back with a hash containing the following values: - mturk - A handle to the mturk client. - row - The input row the hit was created from. - HITId - The HITId that was to be updated - HITTypeId - The HITTypeId that the HIT was to be assigned to. - error - The error message associated with the failure. maxHits - (optional) If this value is greater than or equal to 0, than at most maxHits will be created.
Visit the GSP FreeBSD Man Page Interface. |