[31026] in Perl-Users-Digest
Perl-Users Digest, Issue: 2271 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 12 18:09:44 2009
Date: Thu, 12 Mar 2009 15:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Mar 2009 Volume: 11 Number: 2271
Today's topics:
Autovivification by foreach <devnull4711@web.de>
Re: Autovivification by foreach <uri@stemsystems.com>
Re: Comparing Date Strings <noreply@gunnar.cc>
How can I add DBI for Oracle in Strawberry Perl 5.10.0. <tim@gjerlufsen.dk>
Re: How to test if global has been assigned to? <whynot@pozharski.name>
Interactive App over Telnet <fake@phony.invalid>
Re: Interactive App over Telnet sln@netherlands.com
Re: Interactive App over Telnet <fake@phony.invalid>
new CPAN modules on Thu Mar 12 2009 (Randal Schwartz)
Regexp for multiple consecutive capitalized words 100amp@gmail.com
Re: Regexp for multiple consecutive capitalized words <1usa@llenroc.ude.invalid>
Re: s/// parametrized with backreferences <m@epf.pl>
Re: s/// parametrized with backreferences <peter@makholm.net>
Re: Where is the definition or documentation of PDF "de <mijoryx@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Mar 2009 22:34:24 +0100
From: Frank Seitz <devnull4711@web.de>
Subject: Autovivification by foreach
Message-Id: <71tdf0FbrhpiU5@mid.individual.net>
Hi,
given the following code:
use strict;
use warnings;
my (@a,$ref);
push @a,@$ref;
Perl throws an exception:
Can't use an undefined value as an ARRAY reference
Seems plausible.
We are modifying the code:
my (@a,$ref);
push @a,$_ for @$ref;
Now, there is no exception anymore. Perl creates the array on the fly.
Why is it so? What is the difference?
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
------------------------------
Date: Thu, 12 Mar 2009 16:43:18 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Autovivification by foreach
Message-Id: <x7eix2zabt.fsf@mail.sysarch.com>
>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
FS> my (@a,$ref);
FS> push @a,@$ref;
FS> Perl throws an exception:
FS> Can't use an undefined value as an ARRAY reference
FS> Seems plausible.
FS> We are modifying the code:
FS> my (@a,$ref);
FS> push @a,$_ for @$ref;
FS> Now, there is no exception anymore. Perl creates the array on the fly.
FS> Why is it so? What is the difference?
in the first case @$ref is readonly as it is input to push and can't be
modified. autovivification only happens on lvalues when they are undef
and used where a ref should be.
on the other hand for (modifier or main loop style) makes $_ an alias
into each element of its list. and $_ is read/write so the elements
should be lvalues. so perl will autovivify the array ref since you might
be modifying elements. it can't tell (the executed code could be a sub
call, etc.) so it has to do this before the loop starts. this little
test shows what happens:
perl -le 'push @a,$_ for @$ref; print $ref'
ARRAY(0x8163248)
for much more on autoviv read my tutorial:
http://sysarch.com/Perl/autoviv.txt
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 12 Mar 2009 00:39:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Comparing Date Strings
Message-Id: <71r0d6Fmu75kU1@mid.individual.net>
ccc31807 wrote:
> M wrote:
>> I have a string like so "2009-02-10" and I need to determine if its over say
>> x days old. In this instance 5 days old. Whats the best way to do that? I
>> imagine I first must parse the string into a date in perl.
>
> You don't say if it's older than five days from when. This would be
> important.
>
> Use Date::Calc. Delta_Days returns the difference in days. You can
> parse the string like
> my ($yr, $mo, $da) = split /-/, $string;
Parsing may be needed if you go for Date::Calc or some of its many
relatives. If you stick to the standard module Time::Local, and since
YYYY-MM-DD is a sensible and standards compliant date format, there is
no need to parse.
use Time::Local;
my $timestamp = '2009-02-10';
print $timestamp lt days_ago(5) ? "Delete\n" : "Keep\n";
sub days_ago {
my $days = shift;
my $time = timelocal(0,0,12,(localtime)[3..5]) - $days*86400;
my ($d, $m, $y) = (localtime $time)[3..5];
sprintf '%d-%02d-%02d', $y+1900, $m+1, $d;
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 12 Mar 2009 14:06:25 +0100
From: tim Gjerlufsen <tim@gjerlufsen.dk>
Subject: How can I add DBI for Oracle in Strawberry Perl 5.10.0.4
Message-Id: <49b908d2$0$56796$edfadb0f@dtext02.news.tele.dk>
Hi All,
How can I use Strawberry Perl 5.10.0.4 to connect to an Oracle database
using DBI module?
It's not included in the default distribution.
Thanks in advance.
Tim Gjerlufsen
tim@gjerlufsen.dk
------------------------------
Date: Thu, 12 Mar 2009 09:50:26 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: How to test if global has been assigned to?
Message-Id: <slrngrhfm8.sej.whynot@orphan.zombinet>
On 2009-03-11, kj <socyl@987jk.com.invalid> wrote:
*SKIP*
> Is there a way to make the analogous distinction between the case
> where a global variable has not been initialized from the one where
> it has been explicitly initialized with the value "undef"?
I've got your question this way: How I can know if global variable was
declared (C<use strict> provided) and set to C<undef> explicitly rather
than put in symbol table by blind referencing it on right side of
assignment or in I<@_> of some function or subroutine?
The answer to *this* question is simple -- look in symbol table. That's
possible there's module what can do it for you (B<Devel::>? since I'm
not interested, I'm not going to search one for you). Anyway you can
see debugger's code -- it somehow can output variables in any requested
namespace (even lexicals).
--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
------------------------------
Date: Wed, 11 Mar 2009 18:21:38 -0600
From: Shawn N Blank <fake@phony.invalid>
Subject: Interactive App over Telnet
Message-Id: <66egr4tpjsjbtfgot8athtdpd5kc82l9g6@4ax.com>
I'm attempting to automate some tasks on a remote interactive console
app that was written by crack-smoking monkeys.
Seemingly at random, the order (or presence) of menus changes, forms
have different fields at different times, default values appear and
disappear and mutate.
Expect has gotten me nowhere, since I often don't know what to expect.
It doesn't help that that app paints the screen using ecapes to
position each character, sometimes via relative positioning sometimes
absolute, often not even emitting adjacent characters consecutively.
Okay, so Term::VT102 lets me mantain a semi-coherent concept of what
the screen would show, and I can handle simple stuff with a huge wad
of if/elsif/etc. to negotiate interaction paths I've encountered
previously, but that's quickly getting messy and unmaintainable.
Any thoughts or concepts or algorithms that might help? I'm weak on
the formal education, so I haven't a clue where to start searching for
a better way.
--
Thanks,
Shawn
------------------------------
Date: Thu, 12 Mar 2009 15:51:38 GMT
From: sln@netherlands.com
Subject: Re: Interactive App over Telnet
Message-Id: <4abir4licupom6gof1jgvu4mch86mbqisc@4ax.com>
On Wed, 11 Mar 2009 18:21:38 -0600, Shawn N Blank <fake@phony.invalid> wrote:
>I'm attempting to automate some tasks on a remote interactive console
>app that was written by crack-smoking monkeys.
>
>Seemingly at random, the order (or presence) of menus changes, forms
>have different fields at different times, default values appear and
>disappear and mutate.
>
>Expect has gotten me nowhere, since I often don't know what to expect.
>It doesn't help that that app paints the screen using ecapes to
>position each character, sometimes via relative positioning sometimes
>absolute, often not even emitting adjacent characters consecutively.
>
>Okay, so Term::VT102 lets me mantain a semi-coherent concept of what
>the screen would show, and I can handle simple stuff with a huge wad
>of if/elsif/etc. to negotiate interaction paths I've encountered
>previously, but that's quickly getting messy and unmaintainable.
>
>Any thoughts or concepts or algorithms that might help? I'm weak on
>the formal education, so I haven't a clue where to start searching for
>a better way.
I would use Tera Term. You can create TTL files with perl then launch
it from the command line. With a little effort you can create a template
ttl file like mail-merge, then drop in what you need.
Fully automates the process. Logging the session, etc. The TTL language is
robust.
-sln
================================
Tera Term Pro is a free software terminal emulator (communication program) which supports:
Serial port connections.
TCP/IP (telnet) connections.
VT100 emulation and selected VT200/300 emulation.
TEK4010 emulation.
File transfer protocols (Kermit, XMODEM, ZMODEM, B-PLUS and Quick-VAN).
Scripts using the "Tera Term Language".
Japanese and Russian character sets.
MACRO (TTPMACRO.EXE) is an interpreter of the macro language "Tera Term Language (TTL)",
which controls Tera Term and provides various functions like auto dialing, auto login
and so on.
Tera Term Language (TTL)
TTL is a simple interpreted language like BASIC. To learn TTL quickly, study the sample macro
files in the distribution package and the command reference.
------------------------------
Date: Thu, 12 Mar 2009 14:35:13 -0600
From: Shawn N Blank <fake@phony.invalid>
Subject: Re: Interactive App over Telnet
Message-Id: <gesir45qqaibbnnt6ibiqnk1vnmjtljkp8@4ax.com>
On Thu, 12 Mar 2009 15:51:38 GMT, sln@netherlands.com wrote:
>I would use Tera Term.
I'll take a look and see what it can do.
--
Shawn
------------------------------
Date: Thu, 12 Mar 2009 04:42:25 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Mar 12 2009
Message-Id: <KGDMEp.1zA7@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Apache2-ASP-2.35
http://search.cpan.org/~johnd/Apache2-ASP-2.35/
ASP for Perl, reloaded.
----
App-DualLivedDiff-1.05
http://search.cpan.org/~smueller/App-DualLivedDiff-1.05/
Diff between the perl core and dual-lived modules' CPAN distributions
----
App-Toodledo-0.01
http://search.cpan.org/~pjs/App-Toodledo-0.01/
Perl class for interacting with Toodledo.
----
Archive-Extract-0.31_03
http://search.cpan.org/~kane/Archive-Extract-0.31_03/
A generic archive extracting mechanism
----
Attribute-Handlers-0.82
http://search.cpan.org/~smueller/Attribute-Handlers-0.82/
Simpler definition of attribute handlers
----
Bot-BasicBot-Pluggable-Module-Log-0.02
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-Module-Log-0.02/
Provide logging for Bot::BasicBot::Pluggable
----
Bot-BasicBot-Pluggable-Module-Log-0.03
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-Module-Log-0.03/
Provide logging for Bot::BasicBot::Pluggable
----
Bot-BasicBot-Pluggable-Module-Log-0.04
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-Module-Log-0.04/
Provide logging for Bot::BasicBot::Pluggable
----
CGI-Application-Plugin-GenVal-0.01_01
http://search.cpan.org/~cosmicnet/CGI-Application-Plugin-GenVal-0.01_01/
Generate input forms with client/server validation
----
CGI-IDS-1.0112
http://search.cpan.org/~hinnerk/CGI-IDS-1.0112/
PerlIDS - Perl Website Intrusion Detection System (XSS, CSRF, SQLI, LFI etc.)
----
Catalyst-Manual-5.7019
http://search.cpan.org/~hkclark/Catalyst-Manual-5.7019/
The Catalyst developer's manual
----
Catalyst-Plugin-Server-JSONRPC-0.06
http://search.cpan.org/~darknos/Catalyst-Plugin-Server-JSONRPC-0.06/
Catalyst JSONRPC Server Plugin
----
CatalystX-CRUD-YUI-0.016
http://search.cpan.org/~karman/CatalystX-CRUD-YUI-0.016/
YUI for your CatalystX::CRUD view
----
Config-Auto-0.29_01
http://search.cpan.org/~kane/Config-Auto-0.29_01/
Magical config file parser
----
Config-Model-TkUI-1.205
http://search.cpan.org/~ddumont/Config-Model-TkUI-1.205/
Tk GUI to edit config data through Config::Model
----
Config-Model-TkUI-1.206
http://search.cpan.org/~ddumont/Config-Model-TkUI-1.206/
Tk GUI to edit config data through Config::Model
----
DOCSIS-ConfigFile-0.54
http://search.cpan.org/~eidolon/DOCSIS-ConfigFile-0.54/
Decodes and encodes DOCSIS config-files
----
FCGI-Async-0.16
http://search.cpan.org/~pevans/FCGI-Async-0.16/
Module to allow use of FastCGI asynchronously
----
File-HomeDir-0.84
http://search.cpan.org/~adamk/File-HomeDir-0.84/
Find your home and other directories, on any platform
----
Flickr-Simple2-0.02
http://search.cpan.org/~jfroebe/Flickr-Simple2-0.02/
A XML::Simple based Perl Flickr API.
----
Guardian-OpenPlatform-API-0.01
http://search.cpan.org/~davecross/Guardian-OpenPlatform-API-0.01/
Access the Guardian OpenPlatform API
----
JSON-CPAN-Meta-3.000
http://search.cpan.org/~rjbs/JSON-CPAN-Meta-3.000/
JSON is YAML; emit JSON into META.yml
----
MojoX-Session-0.08
http://search.cpan.org/~vti/MojoX-Session-0.08/
Session management for Mojo
----
MouseX-Getopt-0.05
http://search.cpan.org/~masaki/MouseX-Getopt-0.05/
A Mouse role for processing command line options
----
Net-DHCP-Info-0.10
http://search.cpan.org/~eidolon/Net-DHCP-Info-0.10/
Fast dhcpd.leases and dhcpd.conf parser
----
POE-Component-Generic-0.1200
http://search.cpan.org/~gwyn/POE-Component-Generic-0.1200/
A POE component that provides non-blocking access to a blocking object.
----
POE-Component-SimpleDBI-1.27
http://search.cpan.org/~apocal/POE-Component-SimpleDBI-1.27/
Asynchronous non-blocking DBI calls in POE made simple
----
POE-Component-TFTPd-0.02
http://search.cpan.org/~eidolon/POE-Component-TFTPd-0.02/
A tftp-server, implemented through POE
----
POE-Declare-0.13
http://search.cpan.org/~adamk/POE-Declare-0.13/
A POE abstraction layer for conciseness and simplicity
----
Parse-CPAN-Meta-0.05
http://search.cpan.org/~smueller/Parse-CPAN-Meta-0.05/
Parse META.yml and other similar CPAN metadata files
----
Parse-USDASR-0.02
http://search.cpan.org/~gugod/Parse-USDASR-0.02/
Parse USDA Food nutrition standard reference data files.
----
Path-Router-0.07
http://search.cpan.org/~stevan/Path-Router-0.07/
A tool for routing paths
----
Pod-POM-0.18
http://search.cpan.org/~andrewf/Pod-POM-0.18/
POD Object Model
----
Pod-ToDocBook-0.6
http://search.cpan.org/~zag/Pod-ToDocBook-0.6/
Pluggable converter POD data to DocBook.
----
RDF-Query-2.003_01
http://search.cpan.org/~gwilliams/RDF-Query-2.003_01/
An RDF query implementation of SPARQL/RDQL in Perl for use with RDF::Redland and RDF::Core.
----
RDF-Trine-0.110_02
http://search.cpan.org/~gwilliams/RDF-Trine-0.110_02/
An RDF Framework for Perl.
----
Regexp-Common-debian-0.1.5
http://search.cpan.org/~whynot/Regexp-Common-debian-0.1.5/
regexps for Debian specific strings
----
Rubric-0.144
http://search.cpan.org/~rjbs/Rubric-0.144/
a notes and bookmarks manager with tagging
----
SQL-Abstract-1.50
http://search.cpan.org/~mstrout/SQL-Abstract-1.50/
Generate SQL from Perl data structures
----
Simo-Util-0.0204
http://search.cpan.org/~kimoto/Simo-Util-0.0204/
Utility Class for Simo
----
Simo-Wrapper-0.0216
http://search.cpan.org/~kimoto/Simo-Wrapper-0.0216/
Wrapper class to manipulate object.
----
Switchvox-API-1.0
http://search.cpan.org/~dwp/Switchvox-API-1.0/
Perl interface to the Switchvox Extend API.
----
Sys-Statistics-Linux-0.48_02
http://search.cpan.org/~bloonix/Sys-Statistics-Linux-0.48_02/
Front-end module to collect system statistics
----
Template-Plugin-Latex-3.01
http://search.cpan.org/~andrewf/Template-Plugin-Latex-3.01/
Template Toolkit plugin for Latex
----
Test-POE-Stopping-0.03
http://search.cpan.org/~adamk/Test-POE-Stopping-0.03/
Test if a POE process has nothing left to do
----
Text-Tokenizer-0.4.2
http://search.cpan.org/~samsk/Text-Tokenizer-0.4.2/
Perl extension for tokenizing text(config) files
----
WWW-Mechanize-Plugin-JavaScript-0.009b
http://search.cpan.org/~sprout/WWW-Mechanize-Plugin-JavaScript-0.009b/
JavaScript plugin for WWW::Mechanize
----
WWW-Mechanize-Plugin-JavaScript-0.009c
http://search.cpan.org/~sprout/WWW-Mechanize-Plugin-JavaScript-0.009c/
JavaScript plugin for WWW::Mechanize
----
WebService-Nestoria-Search-1.14.5
http://search.cpan.org/~kaoru/WebService-Nestoria-Search-1.14.5/
Perl interface to the Nestoria Search public API.
----
XML-FeedPP-0.38
http://search.cpan.org/~kawasaki/XML-FeedPP-0.38/
Parse/write/merge/edit RSS/RDF/Atom syndication feeds
----
XML-Grammar-ProductsSyndication-0.0303
http://search.cpan.org/~shlomif/XML-Grammar-ProductsSyndication-0.0303/
an XML Grammar for ProductsSyndication.
----
YAML-Object-0.04
http://search.cpan.org/~eidolon/YAML-Object-0.04/
Use OO to point to a yaml-node
----
constant-def-0.01
http://search.cpan.org/~mons/constant-def-0.01/
Perl pragma to declare previously undeclared constants
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 11 Mar 2009 19:40:23 -0700 (PDT)
From: 100amp@gmail.com
Subject: Regexp for multiple consecutive capitalized words
Message-Id: <7d880468-1391-46f5-9522-6d244ca57b29@h20g2000yqn.googlegroups.com>
I'm trying to come up with a Perl regexp to capture multiple
capitalized words in a row.
For example, in the sentence "I love New York City in the springtime."
I want to capture "New York City", "New York", and "York City".
I've been playing around with this for awhile with little luck. Any
ideas?
------------------------------
Date: Thu, 12 Mar 2009 02:59:03 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Regexp for multiple consecutive capitalized words
Message-Id: <Xns9BCBE9CCC6027asu1cornelledu@127.0.0.1>
100amp@gmail.com wrote in news:7d880468-1391-46f5-9522-6d244ca57b29
@h20g2000yqn.googlegroups.com:
> I'm trying to come up with a Perl regexp to capture multiple
> capitalized words in a row.
>
> For example, in the sentence "I love New York City in the springtime."
>
> I want to capture "New York City", "New York", and "York City".
>
> I've been playing around with this for awhile with little luck. Any
> ideas?
Here is one part of the task:
#!/usr/bin/perl
use strict;
use warnings;
my $text = <<EOT;
I love New York City in the springtime. The United Nations
is headquartered in New York City but the North Atlantic Treaty
Organization is headquartered in Brussels.
EOT
my $pat = '(?:[[:upper:]][[:alpha:]]+)';
my @matches = ( $text =~ /\s(${pat}(?:\s+${pat})+)/g );
for ( @matches ) {
s/\s+/ /g;
print $_, "\n";
}
__END__
C:\DOCUME~1\asu1\LOCALS~1\Temp> t
New York City
The United Nations
New York City
North Atlantic Treaty Organization
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Wed, 11 Mar 2009 16:24:17 -0700 (PDT)
From: msciwoj <m@epf.pl>
Subject: Re: s/// parametrized with backreferences
Message-Id: <34a443e4-10e8-453e-8895-9bbeab3b303c@y13g2000yqn.googlegroups.com>
Tad,
Sorry, I was bit distracted
Apologies
I see the reason why single eval doesnt work with variable (without
double quotes).
If double eval works with double quotes then this also should work
(just a check):
s/$pattern/"$2\n$1"/ge;
and it works indeed!
The mystery for me is this 'second' evaluation actually, like you
said, "interpolates the values for $2 and $1 into the replacement
string" and it seems it's the only way that does the job.
A bit of mystery for me but at the end it works and only this counts,
I guess.
Thanks again,
m.
------------------------------
Date: Thu, 12 Mar 2009 09:21:49 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: s/// parametrized with backreferences
Message-Id: <87hc1z2lsy.fsf@vps1.hacking.dk>
Tad J McClellan <tadmc@seesig.invalid> writes:
> my $pattern = '(.)\n(.)';
> my $replacement = '"$2\n$1"'; # note the double quotes for the 1st eval to see
Doh. Didn't think of that.
Much nicer than my workaround...
//Makholm
------------------------------
Date: Wed, 11 Mar 2009 23:29:38 -0700 (PDT)
From: luser-ex-troll <mijoryx@yahoo.com>
Subject: Re: Where is the definition or documentation of PDF "default user space units"?
Message-Id: <190e58e0-0fb0-4c6b-b8a0-de91095203c7@o11g2000yql.googlegroups.com>
On Mar 11, 10:35=A0am, Ted Byers <r.ted.by...@gmail.com> wrote:
> On Mar 10, 2:54=A0pm, Ted Byers <r.ted.by...@gmail.com> wrote:
>
> > Searching through the documentation for the PDF Perl packages'
> > documentation, I found very terse mention of "default user space
> > units", but I have yet to find what the default is, or how I can
> > change it (or at least make a call that says the coordinates provided
> > are in mm). To date, all my perl scripts that make PDF files use
> > coordinates determined by trial and error, but I want to change this
> > so I can just use coordinates in mm, or cm, and forget the tedium of
> > rerunning the script seemingly countless times to get the position of
> > text just right.
>
> > Thanks
>
> > Ted
>
> Thanks guys.
>
> Knowing the default units are points is a start, providing familiar
> ground. =A0It makes writing functions to convert from any other unit of
> length to points trivial. =A0I am quite used to writing code in a number
> of languages to support real time animation, and to write code
> generated graphics to a variety of output devices including printers:
> all of which required explicit transformations from real world
> coordinates to device coordinates. =A0However, the question is more
> about use of PDF::API2, and related packages, than it is about the PDF
> specification itself.
>
> Depending on where the author lived and worked, his "default user
> space units" could well have been inches, feet, millimeters, or
> centimeters. =A0What was written in the documentation I referred to does
> not make even that clear.
>
> A colleague told me yesterday that the PHP PDF package he uses
> supports providing coordinates in millimeters, and naturally I looked
> into the Perl packages I use to see if they provide comparable
> functionality. =A0The problem I encountered is one of salient
> information apparently not being provided in the documentation of
> functions and packages provided to create and edit PDF files. =A0If they
> don't I can easily create it myself. =A0But as you can understand, I
> would want to avoid recreating the wheel, and so would use the
> packages' functions if they do what I require.
>
> Thanks again,
>
> Ted
If you're using a toolchain that goes through Postscript,
you can scale the coordinate system to inches
72 72 scale
or millimeters
72 2.54 div 28.3465 scale
or
28.3465 dup scale
I don't know the particulars of the various pdf
generators, but this is a fundamental capability
of the image model, hard-won in the desktop wars
of the eighties.
N.B. Transformations are often reset for each page.
For multiple pages, you'll have to arrange to
rescale on each one.
lxt
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2271
***************************************