CptVorpal has asked for the wisdom of the Perl Monks concerning the following question:

I'm currently workin with PDF::Labels on a Win2k box.

$pdf->label($labelArray[0],$labelArray[1],$labelArray[2],$labelArr +ay[3]);

My problem arises when I don't know how many lines I need to pass to this object and short of hardcoding how many I believe can fit on a label, I'd like to develop something a bit more robust. I tried doing something along the lines of $pdf->label(eval($argumentsinstring)); but to no avail. Thoughts?

- CptVorpal

Edited 2003-03-10 by Ovid

Replies are listed 'Best First'.
Re: Object Method Usage
by Ovid (Cardinal) on Mar 11, 2003 at 02:57 UTC

    When you say "I don't know how many lines I need to pass to this object", what exactly do you mean? In other words, if you sat down with pen and paper, how would you write instructions for another person to determine how many lines would fit? If you can answer that, we might be able to help you.

    Side note, I would change your method call to something like this:

    # we've taken off the word 'Array'. We already know it's an array + :) $pdf->label(@label); # or, if @label might have more than for elements $pdf->label(@label[0 .. 3]); # or if it has four or fewer elements: $pdf->label(@label[0 .. $#label]);

    Depending on which of the above you need, it's easier for an experienced programmer to read (and might be more robust).

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

Re: Object Method Usage
by Dr. Mu (Hermit) on Mar 11, 2003 at 04:22 UTC
    I use PDF::Create all by itself for labels. It gives me more control over the outcome and doesn't add that much extra coding effort. Just iterate on $x0 and $y0, for example, as your corner coordinates, and define the contents of each label relative to them.