ePages 7.0.0 - DE_EPAGES/ShopTransfer/API/BCPEditor.pm

Package DE_EPAGES::ShopTransfer::API::BCPEditor

Examines and manipulates BCP files.

Example
$Editor = DE_EPAGES::ShopTransfer::API::BCPEditor->new('object.bcp');
$ShopsFolderID = $Editor->findRows({ 2 => 1, 3 => 'Shops' })->[0]->[0];
$aShops = $Editor->findRows({ 2 => $ShopsFolderID });

Functions

countRows
deleteRows
findRows
forEach
map
new
updateRows

countRows

Counts all rows where the specified columns have the specified values. Returns the total number of lines if $hFind is an empty hash.

Syntax
$Count = $Editor->countRows($hFind);
Input
$hFind (ref.hash)
Column index => value hash
Return
$Count (int)
number of matching rows

deleteRows

Deletes all rows where the specified columns have the specified values.

Syntax
$Editor->deleteRows($hFind);
Input
$hFind (ref.hash)
Column index => value hash

findRows

Returns all rows where the specified columns have the specified values.

Syntax
$aRows = $Editor->findRows($hFind);
Input
$hFind (ref.hash)
Column index => value hash
Return
$aRows (ref.array.array.string)
list of matching rows. Each row is a list of values

forEach

Calls $Sub->(@Values) for each row.

Syntax
$Editor->forEach($Sub);
Input
$Sub (ref.code)
iterator function

map

Runs $Sub->(@Values) on all rows. The return list of $Sub replaces the current values of the row. The modified rows are written back to the original file.

Syntax
$Editor->map($Sub);
Input
$Sub (ref.code)
iterator function

new

Creates a BCPEditor object

Syntax
$Editor = DE_EPAGES::ShopTransfer::API::BCPEditor->new($FileName, $Encoding);
Input
$FileName (string)
file name
$Encoding (string)
encoding of bcp file (default utf8)
Return
$Editor (DE_EPAGES::ShopTransfer::API::BCPEditor)
new BCPEditor object

updateRows

Runs $Sub->(@Values) on all rows where the specified columns have the specified values. The return list of $Sub replaces the current values of the row. The modified rows are written back to the original file.

Syntax
$Editor->updateRows($hFind, $Sub);
Input
$hFind (ref.hash)
Column index => value hash
$Sub (ref.code)
iterator function