From baf65988cb4766daeea584ef627e8c2011277d88 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 16 Apr 2016 21:35:17 +0300 Subject: [PATCH] Overload stringify in PlateResult.pm --- lib/Image/OpenALPR/PlateResult.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Image/OpenALPR/PlateResult.pm b/lib/Image/OpenALPR/PlateResult.pm index 3fcca2d..e06a3e9 100644 --- a/lib/Image/OpenALPR/PlateResult.pm +++ b/lib/Image/OpenALPR/PlateResult.pm @@ -4,6 +4,7 @@ use 5.014000; use strict; use warnings; +use overload '""' => sub { shift->plate }, fallback => 1; use parent qw/Class::Accessor::Fast/; our $VERSION = '0.001'; @@ -36,6 +37,7 @@ Image::OpenALPR::PlateResult - a license plate, as identified by OpenALPR =head1 SYNOPSIS my $plate = $alpr->recognise('t/example.jpg'); + say $plate; # ZP36709 say $plate->plate; # ZP36709 say $plate->confidence; # 92.373634 my @coords = $plate->coordinates; # [306, 351], [476, 351], [476, 384], [306, 384] @@ -53,7 +55,8 @@ identified by OpenALPR. It offers the following methods: =item $plate->B The plate number that has the highest confidence value (likelihood of -being correct). +being correct). An object of this class will stringify to the return +value of this method. =item $plate->B -- 2.30.2