Perl Postscript Problem

Corey Edwards tensai at zmonkey.org
Wed Aug 4 13:46:52 MDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/04/2010 01:26 PM, Levi Pearson wrote:
> On Wed, Aug 4, 2010 at 12:26 PM, Charles Curley
> <charlescurley at charlescurley.com> wrote:
>> I have been using PostScript::TextBlock to spit out envelope text ready
>> to print. No graphics, nothing fancy, and it has worked for years. Now
>> on Ubuntu 10.4 ("Good Buddy") I get:
>>
>> Can't use string ("1") as an ARRAY ref while "strict refs" in use
>> at /usr/share/perl5/PostScript/TextBlock.pm line 57.
> 
> Sorry, I don't have anything actually useful to add, but it seems
> crazy that perl would refuse to let you use an integer in a string as
> a number.  That always seemed like one of the defining features of
> perl--that it would do what you mean instead of forcing you to
> conform.

It's not refusing to use an integer as a string, but rather a string as
an array pointer. I ran into this in some code just the other day.

Bad:

  use strict;
  my $a = ("1");
  print $a->[0];

Good:

  use strict;
  my @a = ("1");
  my $b = \@a;
  print $b->[0];

I don't have access to an Ubuntu 10.4 box right now. Simple test would
be to try turning off use strict, as Levi suggested. That line of code
will still fail, but it'll just keep going and might possibly work. Or
it might melt your computer.

Corey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxZw5cACgkQwNwjtxfqOkM0mwCfdCVc8InMEt0sKgZOjPQo0SSN
V3sAn0qCkSdETyiO3vdXN9ymrsB6mj8C
=Amnh
-----END PGP SIGNATURE-----


More information about the PLUG mailing list