NAME

Business::CompanyDesignator::SplitResult - class for modelling Business::CompanyDesignator::split_designator result records

SYNOPSIS

# Returned by split_designator in scalar context
$bcd = Business::CompanyDesignator->new;
$res = $bcd->split_designator("Open Fusion Pty Ltd (Australia)");

# Accessors
say $res->designator;         # Pty Ltd (designator as found in input string)
say $res->designator_std;     # Pty. Ltd. (standardised version of designator)
say $res->before;             # Open Fusion (trimmed text before designator)
say $res->after;              # (Australia) (trimmed text after designator)
say $res->short_name;         # Open Fusion ($res->before || $res->after)
say $res->extra;              # (Australia) ($res->before ? $res->after : '')

# Designator records arrayref (since designator might be ambiguous and map to multiple)
foreach (@{ $res->records }) {
  say join ", ", $_->long, $_->lang;
}

ACCESSORS

designator()

If a designator is found, returns the matched designator as it exists in the input string. Otherwise returns an empty string ('').

say $res->designator;

designator_std()

If a designator is found, returns the standardised version of the designator as it exists in the company designator dataset. This may or may not match $res->designator().

say $res->designator_std;

e.g. "Open Fusion Pty Ltd" would return a designator of 'Pty Ltd', but a designator_std of 'Pty. Ltd.' (with the dots).

The designator_std version can be used to retrieve the matching dataset record(s) using $bcd->records( $res->designator_short ).

before()

If a non-leading designator is found, returns the (whitespace-trimmed) text before the designator. If a leading designator is found, returns an empty string (''). If no designator is found, returns the full company name i.e. the input.

say $res->before;

after()

If a designator is found, returns the (whitespace-trimmed) text after the designator, if any. Otherwise returns an empty string ('').

say $res->after;

short_name()

If a non-leading designator is found, returns $res->before. If a leading designator is found, returns, $res->after. That is, it returns the logical 'short name' of the company (stripped of the designator), for both trailing and leading designators.

extra()

If a non-leading designator is found, returns $res->after. That is, it's any extra text not include in $res->short_name, if any. Otherwise returns an empty string ('').

AUTHOR

Gavin Carr <gavin@profound.net>

COPYRIGHT AND LICENCE

Copyright (C) 2013-2015 Gavin Carr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.