Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3ed0f2ce

Von Steven Schubiger vor mehr als 2 Jahren hinzugefügt

  • ID 3ed0f2ce8095baf1f5faa1c3894d3968f9439929
  • Vorgänger a3a9ebcd
  • Nachfolger 537bd920

Swiss QR-Bill: QrBill.pm: Erläutere die Funktion der einzelnen Methoden

Unterschiede anzeigen:

SL/Helper/QrBill.pm
13 13
  out_file   => 'out.png',
14 14
);
15 15

  
16
# Validate data, populate structures and return a
17
# SL::Helper::QrBill object.
16 18
sub new {
17 19
  my $class = shift;
18 20

  
......
24 26
  return $self;
25 27
}
26 28

  
29
# Populate the data structures with data received by the
30
# constructor.
27 31
sub _init {
28 32
  my $self = shift;
29 33
  my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data) = @_;
......
71 75
  ];
72 76
}
73 77

  
78
# Validate the data with regular expressions and exit ungracefully
79
# if conditions are not matched.
74 80
sub _init_check {
75 81
  my $self = shift;
76 82
  my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data) = @_;
......
186 192
  }
187 193
}
188 194

  
195
# Generate the QR-Code image by calling internal methods.
189 196
sub generate {
190 197
  my $self = shift;
191 198
  my $out_file = $_[0] // $Config{out_file};
......
198 205
  $self->_write($out_file);
199 206
}
200 207

  
208
# Return a new Imager::QRCode object.
201 209
sub _qrcode {
202 210
  my $self = shift;
203 211

  
......
208 216
  );
209 217
}
210 218

  
219
# Read the cross file and scale the resulting image.
211 220
sub _cross {
212 221
  my $self = shift;
213 222

  
......
217 226
  return $cross->scale(xpixels => 35, ypixels => 35, qtype => 'mixing');
218 227
}
219 228

  
229
# Order and modify the structured data, form the text and plot it.
220 230
sub _plot {
221 231
  my $self = shift;
222 232

  
......
243 253
  return $self->{qrcode}->plot($text);
244 254
}
245 255

  
256
# Paste cross image onto the middle of the QR-Code image.
246 257
sub _paste {
247 258
  my $self = shift;
248 259

  
......
253 264
  );
254 265
}
255 266

  
267
# Write the QR-Code image to a file.
256 268
sub _write {
257 269
  my $self = shift;
258 270
  my ($out_file) = @_;

Auch abrufbar als: Unified diff