diff options
author | dakkar <dakkar@thenautilus.net> | 2016-11-10 14:51:03 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2016-11-10 14:51:03 +0000 |
commit | 568c7a442188ff8d420622a7a9b5cac4c011aab1 (patch) | |
tree | cc6429e60b21157ee70b3c4ccbb725489239fc6a /lib/Data/QRCode.pm | |
parent | don't test pod coverage on generated files (diff) | |
download | Data-QRCode-568c7a442188ff8d420622a7a9b5cac4c011aab1.tar.gz Data-QRCode-568c7a442188ff8d420622a7a9b5cac4c011aab1.tar.bz2 Data-QRCode-568c7a442188ff8d420622a7a9b5cac4c011aab1.zip |
allow building QRCode with just a string
Diffstat (limited to 'lib/Data/QRCode.pm')
-rw-r--r-- | lib/Data/QRCode.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Data/QRCode.pm b/lib/Data/QRCode.pm index 74896c9..649e1f9 100644 --- a/lib/Data/QRCode.pm +++ b/lib/Data/QRCode.pm @@ -34,6 +34,15 @@ has input_data => ( isa => Str, ); +around BUILDARGS => sub { + my ($orig,$class,@args) = @_; + + return { input_data => $args[0] } + if @args == 1 && !ref $args[0]; + + return $class->$orig(@args); +}; + has _result => ( is => 'lazy', init_arg => undef, |