[25691] in Perl-Users-Digest
Perl-Users Digest, Issue: 7932 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 1 11:05:49 2005
Date: Fri, 1 Apr 2005 08:05:18 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 1 Apr 2005 Volume: 10 Number: 7932
Today's topics:
Re: $line = <FH> returns incomplete lines (Anno Siegel)
[BEGINNER] Regex with ~ soup_or_power@yahoo.com
Re: [BEGINNER] Regex with ~ <noreply@gunnar.cc>
Re: Class instances with 'use overload' in a tied hash <Guy_Bolton-King@non.agilent.com>
Re: Class instances with 'use overload' in a tied hash (Anno Siegel)
Re: Database -> Excel sigzero@gmail.com
difference between two files <hendrik_maryns@despammed.com>
Re: difference between two files (Anno Siegel)
Re: difference between two files <tim@mrbun.watterson>
Re: difference between two files (Anno Siegel)
Re: difference between two files <1usa@llenroc.ude.invalid>
Re: file name from command line <tadmc@augustmail.com>
Re: How to find installed Modules <gisle@activestate.com>
Re: HP-UX 11.11 performance with Ingres 2.6 <noone@nowhere.com>
Re: Looking for a PERL version of "filetime" <zawrotny@sb.fsu.edu>
Re: Looking for a PERL version of "filetime" (Anno Siegel)
Re: Looking for a PERL version of "filetime" <zawrotny@sb.fsu.edu>
Re: Perl script hangs (Anno Siegel)
Re: Pulling hair out with pattern matching <tadmc@augustmail.com>
Re: slicing syntax question <mpapec@foobar.com>
Re: using Perl to insert footer into PDF files? <1usa@llenroc.ude.invalid>
Re: using Perl to insert footer into PDF files? <sbryce@scottbryce.com>
Re: YARQ - Yet another regex question <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Apr 2005 12:53:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $line = <FH> returns incomplete lines
Message-Id: <d2jg7n$ja8$2@mamenchi.zrz.TU-Berlin.DE>
Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> robic0@yahoo.com <robic0@yahoo.com> wrote:
[...]
> Your code that I quoted is equivalent to:
>
> if ($line =~ /\n+/) {
>
> The 2 underlined characters served no purpose, so I'm wondering
> why you included them. Maybe you (mis)think that they _do_ serve
> some purpose, in which case you will learn something.
The '+' doesn't make sense either, unless someone messed with $/.
This guy's code is sloppy and imprecise, matching his English.
Anno
------------------------------
Date: 1 Apr 2005 07:04:16 -0800
From: soup_or_power@yahoo.com
Subject: [BEGINNER] Regex with ~
Message-Id: <1112367856.390397.272990@z14g2000cwz.googlegroups.com>
Can someone please explain the regular expression with the tilda?
What is being matched there?
Thanks for your help.
$trap++ if($st_domains =~ /~$user~/i);
$trap++ if($st_domains =~ /~$tld~/i);
$trap++ if($st_users =~ /~$user~/i);
------------------------------
Date: Fri, 01 Apr 2005 17:28:59 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: [BEGINNER] Regex with ~
Message-Id: <3b57n8F6h2j18U1@individual.net>
soup_or_power@yahoo.com wrote:
> Can someone please explain the regular expression with the tilda?
> What is being matched there?
> Thanks for your help.
>
> $trap++ if($st_domains =~ /~$user~/i);
> $trap++ if($st_domains =~ /~$tld~/i);
> $trap++ if($st_users =~ /~$user~/i);
Why do you ask? Is there any reason to believe that a '~' would match
anything but a '~'?
To find out which characters are special in Perl regular expressions:
perldoc perlre
(Another thing is that a tilde both before and after e.g. a username
appears odd to me.)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 01 Apr 2005 12:05:43 +0100
From: Guy Bolton King <Guy_Bolton-King@non.agilent.com>
Subject: Re: Class instances with 'use overload' in a tied hash
Message-Id: <4nxy8c2u588.fsf@tsdsles9-2.britain.agilent.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
> >
> >
> > Guy Bolton King wrote:
> > >>
> > >> I'm relatively new to the OO-features of perl, so I may have made an
> > >> obvious mistake in the following code, in which case I apologise for
> > >> wasting the group's time. I have a value-type class (Foo in the
> > >> example below) which overloads the comparison operator. sort() then
> > >> successfully uses the comparison operator when sorting a list of
> > >> instances obtained from the values() of a hash. However, if the class
> > >> instances are used as the values in a _tied_ hash, the overloaded
> > >> operator is no longer called, _unless_ values() is called before
> > >> calling the sort() function.
> > >
> > >
> > > Yes, I've posted code that doesn't work. Working code attached.
> > >
> > > ---snip!---
> >
> > Good illustration.
> >
> > I was able to reproduce on 5.8.6.
> >
> > I'm fairly sure you've found a bug in Perl.
>
> Looks like it.
John Peacock's followup in http://rt.perl.org/rt3/index.html?q=34604
shows some mysterious Devel::Peek output; I had a look at hv.c in
5.8.6, but it was unsurprisingly unenlightening...
> An alternative workaround is
>
> sort( map $_, values(%b));
>
> Usually, "map $_, ..." should be a no-op, but here it isn't.
Thanks for that; however, I've opted to excise all instances of 'use
overload' from my code as I _need_ tied hashes, but overload is a
convenience (after all, we live without it in Java), and I don't want
to have to care whether the hash I'm using is tied or not, and I
certainly don't want to write suspicious-looking no-ops like 'sort(map
$_, values(%b))' for all hashes!
Would I be right in thinking that 'use overload' has been seen to
behave mysteriously in other contexts? It's a pity; value types are
nice to have.
Guy.
------------------------------
Date: 1 Apr 2005 11:25:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Class instances with 'use overload' in a tied hash
Message-Id: <d2jb45$h4v$1@mamenchi.zrz.TU-Berlin.DE>
Guy Bolton King <Guy_Bolton-King@non.agilent.com> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> > Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
[use overload]
> > > I'm fairly sure you've found a bug in Perl.
> >
> > Looks like it.
[...]
> Would I be right in thinking that 'use overload' has been seen to
> behave mysteriously in other contexts? It's a pity; value types are
> nice to have.
I use overload almost routinely for stringification (and then more often
than not either switch off autogeneration or overload "bool", but I
digress...).
Apart from the one discussed here, which was new to me, I know of
one more bug in overload. I forget the specifics, but it has to do
with changing overload behavior at run time, which doesn't seem to
catch on until something is blessed into the overloading package.
That happens rarely enough to live with. YMMV.
Anno
------------------------------
Date: 1 Apr 2005 05:31:01 -0800
From: sigzero@gmail.com
Subject: Re: Database -> Excel
Message-Id: <1112362261.761282.130840@o13g2000cwo.googlegroups.com>
So far the files are less than 300K. Would you be willing to send me a
quick example?
Robert
------------------------------
Date: Fri, 01 Apr 2005 13:43:03 +0200
From: Hendrik Maryns <hendrik_maryns@despammed.com>
Subject: difference between two files
Message-Id: <1112355816.34080@seven.kulnet.kuleuven.ac.be>
<I posted this to perl.beginners too, but as there didn't come an answer
yet, I try here again>
Hi,
I thought there must be some easy ways/prepared modules/available
scripts to compare two files. I tried perldoc -q diff and perldoc -q
compare, but didn't find a hint. I'd be thankful for a prod in the
right direction!
(Concrete: I have two xml-files, and want to be sure they have the same
content. I know we should have been using CVS right from the start, but
it's too late for that now...)
Cheers, H.
--
Hendrik Maryns
Interesting websites:
www.lieverleven.be (I cooperate)
www.eu04.com European Referendum Campaign
aouw.org The Art Of Urban Warfare
------------------------------
Date: 1 Apr 2005 12:11:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: difference between two files
Message-Id: <d2jdq0$ja8$1@mamenchi.zrz.TU-Berlin.DE>
Hendrik Maryns <hendrik_maryns@despammed.com> wrote in comp.lang.perl.misc:
> <I posted this to perl.beginners too, but as there didn't come an answer
> yet, I try here again>
>
> Hi,
>
> I thought there must be some easy ways/prepared modules/available
> scripts to compare two files. I tried perldoc -q diff and perldoc -q
> compare, but didn't find a hint. I'd be thankful for a prod in the
> right direction!
The algorithm in diff to produce a line-by-line comparison of files
is remarkably complex -- the main problem being re-synchronization
after a difference. No one has bothered to re-implement it in Perl,
afaik. People use the external diff command if needed.
> (Concrete: I have two xml-files, and want to be sure they have the same
> content. I know we should have been using CVS right from the start, but
> it's too late for that now...)
If all you need to know is whether two files contain the exact same
text, (untested)
do { local $/; <$f1> eq <$f2> };
should do it for non-large files. Use Digest::MD5 if both files don't
fit into memory.
Anno
------------------------------
Date: Fri, 01 Apr 2005 07:27:55 -0500
From: Tim Heaney <tim@mrbun.watterson>
Subject: Re: difference between two files
Message-Id: <87is3665ro.fsf@mrbun.watterson>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>
> The algorithm in diff to produce a line-by-line comparison of files
> is remarkably complex -- the main problem being re-synchronization
> after a difference. No one has bothered to re-implement it in Perl,
> afaik. People use the external diff command if needed.
The CPAN module Algorithm::Diff seems to do all that and more. If you
really want just diff, the Text::Diff module distills it for you. That
is,
perl -MText::Diff -e 'print diff @ARGV' file1.xml file2.xml
is the same as
diff -U3 file1.xml file2.xml
Tim
------------------------------
Date: 1 Apr 2005 12:54:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: difference between two files
Message-Id: <d2jgb2$ksu$1@mamenchi.zrz.TU-Berlin.DE>
Tim Heaney <tim@mrbun.watterson> wrote in comp.lang.perl.misc:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> >
> > The algorithm in diff to produce a line-by-line comparison of files
> > is remarkably complex -- the main problem being re-synchronization
> > after a difference. No one has bothered to re-implement it in Perl,
> > afaik. People use the external diff command if needed.
>
> The CPAN module Algorithm::Diff seems to do all that and more. If you
> really want just diff, the Text::Diff module distills it for you. That
> is,
>
> perl -MText::Diff -e 'print diff @ARGV' file1.xml file2.xml
>
> is the same as
>
> diff -U3 file1.xml file2.xml
Thanks for the correction. I never noticed those modules.
Anno
------------------------------
Date: Fri, 01 Apr 2005 13:27:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: difference between two files
Message-Id: <Xns962B56096D8B3asu1cornelledu@127.0.0.1>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
news:d2jgb2$ksu$1@mamenchi.zrz.TU-Berlin.DE:
> Tim Heaney <tim@mrbun.watterson> wrote in comp.lang.perl.misc:
>> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>> >
>> > The algorithm in diff to produce a line-by-line comparison of files
>> > is remarkably complex
...
>> The CPAN module Algorithm::Diff seems to do all that and more. If you
>> really want just diff, the Text::Diff module distills it for you.
...
> Thanks for the correction. I never noticed those modules.
OTOH, the OP might want to remember that XML files can have equivalent
data, but not the same text.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Fri, 1 Apr 2005 06:37:35 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: file name from command line
Message-Id: <slrnd4qg4f.g4t.tadmc@magna.augustmail.com>
robic0@yahoo.com <robic0@yahoo.com> wrote:
> On Thu, 24 Mar 2005 07:30:42 -0600, Tad McClellan
><tadmc@augustmail.com> wrote:
>
>>Tad McClellan <tadmc@augustmail.com> wrote:
>>> robic0@yahoo.com <robic0@yahoo.com> wrote:
>>>
>>>> if (!@ARGV) {
>>>> print "Enter a filename as a cmdline argument.\n";
>>>> exit (1);
>>>> }
>>>
>>>
>>> Error message should go on STDERR, so you can replace
>>> that whole if statement with:
>>>
>>> warn "Enter a filename as a cmdline argument.\n" unless @ARGV;
>>
>>
>>Doh!
>>
>>I meant die() instead of warn(), else there will be no exit().
>
> What the fuck do u mean man?
It's "computer stuff".
You wouldn't understand.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 01 Apr 2005 13:18:19 +0200
From: Gisle Aas <gisle@activestate.com>
Subject: Re: How to find installed Modules
Message-Id: <87u0mqycck.fsf@ask.g.aas.no>
Joe Smith <joe@inwap.com> writes:
> There is another way not mentioned in that FAQ.
There is also the 'instmodsh' program that is bundled with perl.
--
Gisle Aas
------------------------------
Date: Fri, 01 Apr 2005 09:35:06 -0500
From: Dennis Roesler <noone@nowhere.com>
Subject: Re: HP-UX 11.11 performance with Ingres 2.6
Message-Id: <1112366107.476806@cswreg.cos.agilent.com>
Please ignore, I had the wrong newsgroup selected when posting.
Sorry, Dennis
Dennis Roesler wrote:
> Ingres II 2.6/0305 (hpb.us5/00)
> HP-UX B.11.11 rp3440 (8GB memory) and RAID 1 on the disks
> - patch PHCO_30544 Pthread enhancement and fixes installed
>
> We're migrating some data to a new schema. Not really having a
> benchmark of how long it would take to process the data I started doing
> some tests.
>
> One set of data was taking over 5 hours and a different set of data was
> taking a little over 2 hours. Not really having a benchmark to go by I
> wasn't sure if this was unreasonable or not.
>
> For some reason I decided to test how long it would take to process the
> data on linux. The linux box is a Compaq P4 desktop (512MB memory and a
> single 40G disk) with RH FC3 and r3/109 installed using express_install,
> no other configuration changes.
>
> I copied the data and script to the linux box and when I ran the same
> scripts on the same data sets the jobs took ~45min and ~15mins
> respectively. At first I thought the script bombed out in some places,
> but looking at the script logs all the data was processed properly.
>
> I have a call in to tech support to try and resolve why there would be
> such a discrepancy on the two systems. I've tried various suggestions
> from tech support, but there is no significant gains in processing time.
>
> Any suggestions? I can post any relevant config info, but at this point
> I'm not sure what is relevant.
>
> Thanks
>
> Dennis
>
> d underscore roesler at agilent dot com
>
>
>
------------------------------
Date: 1 Apr 2005 14:35:33 GMT
From: Michael Zawrotny <zawrotny@sb.fsu.edu>
Subject: Re: Looking for a PERL version of "filetime"
Message-Id: <slrnd4qn31.84s.zawrotny@localhost.localdomain>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Michael Zawrotny <zawrotny@sb.fsu.edu> wrote in comp.lang.perl.misc:
> >
> > It's not a perl solution, but many versions of linux come with a
> > user-level utility called "stat". See "man 1 stat" for details,
> > in particular the %x, %X, %y, %Y, %z, %Z formatting options.
>
> You should take a look at the Perl documentation before answering
> questions. Perl has a stat() function as well.
You should avoid jumping to conclusions. I never said that Perl
couldn't do the job. I've used Perl's stat on many occasions. Just
because someone isn't a regular poster, doesn't mean that they don't
know Perl.
The OP wanted a Linux solution to a problem. Many people gave him
information on how to do it in Perl, I gave him one that was Linux
specific rather than Perl specific. TMTOWTDI.
I'm in favor of using the right tool for the job. Only the OP can
decide whether calling stat(1) or Perl's stat fits his needs better.
I can easily envision scenarios for both. But if nobody tells him
about stat(1), he'll never have the opportunity to see if it works for
him.
phynkel@yahoo.com <phynkel@yahoo.com> wrote:
> > > We have a compiled program (no source) on our SUN machines called
> > > filetime. If you run it against a file name it returns with the number
> > > of seconds from 1/1/1970. We use it to flag files older than a fixed
> > > date
> > >
> > > Looking for same thing in PERL or C for use of Linux
If you take another look at the OP's request, it looks like an XY
problem. OP wanted something on Linux that worked like a Sun specific
utility, and then asked for "the same thing in PERL or C". This was
interepreted by most of the people replying as "How do I re-write the
Sun utility in Perl?" I interpreted the intent as "What's the easiest
way to print the mtime in Epoch seconds for a file?"
It seemed to me that a distribution-supplied utility that would print
out the specified parts of the struct from the stat system call might
be more useful than a roll your own solution.
Using the pre-built utility avoids having to do the error checking
(someone asking the question is likely to forget to check the result
of the stat syscall). And it's more flexible since its easier to
change the one format string than it is to edit the script to pull out
different parts of the stat struct (if you needed to change from mtime
to atime for example). Likewise if the requirements change and you
need a human readable format (no messing around with localtime and/or
POSIX::strftime).
Mike
--
Michael Zawrotny
Institute of Molecular Biophysics
Florida State University | email: zawrotny@sb.fsu.edu
Tallahassee, FL 32306-4380 | phone: (850) 644-0069
------------------------------
Date: 1 Apr 2005 14:57:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Looking for a PERL version of "filetime"
Message-Id: <d2jng3$p10$1@mamenchi.zrz.TU-Berlin.DE>
Michael Zawrotny <zawrotny@sb.fsu.edu> wrote in comp.lang.perl.misc:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > Michael Zawrotny <zawrotny@sb.fsu.edu> wrote in comp.lang.perl.misc:
> > >
> > > It's not a perl solution, but many versions of linux come with a
> > > user-level utility called "stat". See "man 1 stat" for details,
> > > in particular the %x, %X, %y, %Y, %z, %Z formatting options.
> >
> > You should take a look at the Perl documentation before answering
> > questions. Perl has a stat() function as well.
>
> You should avoid jumping to conclusions. I never said that Perl
> couldn't do the job.
Sorry for misreading you, but taken by itself (as it appeared on my news
server) your posting appeared to say just that.
Anno
------------------------------
Date: 1 Apr 2005 15:17:12 GMT
From: Michael Zawrotny <zawrotny@sb.fsu.edu>
Subject: Re: Looking for a PERL version of "filetime"
Message-Id: <slrnd4qph4.9hu.zawrotny@localhost.localdomain>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Michael Zawrotny <zawrotny@sb.fsu.edu> wrote in comp.lang.perl.misc:
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > > Michael Zawrotny <zawrotny@sb.fsu.edu> wrote in comp.lang.perl.misc:
> > > >
> > > > It's not a perl solution, but many versions of linux come with a
> > > > user-level utility called "stat". See "man 1 stat" for details,
> > > > in particular the %x, %X, %y, %Y, %z, %Z formatting options.
> > >
> > > You should take a look at the Perl documentation before answering
> > > questions. Perl has a stat() function as well.
> >
> > You should avoid jumping to conclusions. I never said that Perl
> > couldn't do the job.
>
> Sorry for misreading you, but taken by itself (as it appeared on my news
> server) your posting appeared to say just that.
That's ok. Usenet and email are notorious for making it easy to
misinterpret things.
Mike
--
Michael Zawrotny
Institute of Molecular Biophysics
Florida State University | email: zawrotny@sb.fsu.edu
Tallahassee, FL 32306-4380 | phone: (850) 644-0069
------------------------------
Date: 1 Apr 2005 11:33:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl script hangs
Message-Id: <d2jbit$h4v$2@mamenchi.zrz.TU-Berlin.DE>
Kurt <kurt.semba@gmx.de> wrote in comp.lang.perl.misc:
> I had a while loop with a counter like this:
>
> counter = 0;
> while ($array[$counter])
> {
> ...
> if (some_statement)
> {
> ...
> $counter++;
> }
> }
>
> In this short version of the code it is easy to see what happens if
> the "some_statement" never evaluates to true --> endless loop. But it
> was not that obvious to me in the "long" version of the code :)
s/never evaluates to true/ever evaluates to false/
Anno
------------------------------
Date: Fri, 1 Apr 2005 06:51:27 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Pulling hair out with pattern matching
Message-Id: <slrnd4qguf.g4t.tadmc@magna.augustmail.com>
robic0@yahoo.com <robic0@yahoo.com> wrote:
> There is only one single way to do it
perldoc -q learn
Is Perl difficult to learn?
... One of the guiding mottos for Perl development is "there's more
than one way to do it" (TMTOWTDI, sometimes pronounced "tim toady").
See also:
perldoc -f quotemeta
> Trust me::
Don't.
> my @regx_esc_codes = ( "\\", '/', '(', ')', '[', ']',
> '?', '|',
> '+', '.', '*', '$', '^', '{',
> '}', '@' );
my @regx_esc_codes = qw< \ / ( ) [ ] ? | + . * $ ^ { } @ >;
(but / is NOT meta in regular expressions)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 1 Apr 2005 13:10:26 +0200
From: Matija Papec <mpapec@foobar.com>
Subject: Re: slicing syntax question
Message-Id: <xd4zj9gofiko.px2udlk301w4$.dlg@40tude.net>
On Fri, 01 Apr 2005 02:46:01 -0800, robic0@yahoo.com wrote:
> No, actually thats not true at all !! If you want to limit the
> programs you write to less than a screen, you might find
> that your boss will get upset after 6 months of trying to
> write a single screen of code when there should be
> 10,000 lines by then ....
Such boss shouldn't last long, at least not in company which actually want
to produce something.
------------------------------
Date: Fri, 01 Apr 2005 13:06:25 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: using Perl to insert footer into PDF files?
Message-Id: <Xns962B52789C614asu1cornelledu@127.0.0.1>
robic0@yahoo.com wrote in news:0oqp4153sp39m2tocd4r3t1t36kubvhhop@
4ax.com:
> On 29 Mar 2005 14:41:22 -0800, codingalex@yahoo.com wrote:
>
>>I'm a little new at PDF manipulation in Perl
...
> Whoa man, pdf is proprietory. If you find out how to modify pdf's
> I wouldn't sell it to anyone...
Wrong.
From:
<URL:
http://partners.adobe.com/public/developer/pdf/index_reference.html>
<blockquote>
The PDF Reference provides a description of the Portable Document Format
and is intended for application developers wishing to develop
applications that create PDF files directly, as well as read or modify
PDF document content.
</blockquote>
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 31 Mar 2005 08:33:24 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: using Perl to insert footer into PDF files?
Message-Id: <98qdncoK1NtZ9NDfRVn-rA@comcast.com>
robic0@yahoo.com wrote:
> Whoa man, pdf is proprietory. If you find out how to modify pdf's
> I wouldn't sell it to anyone...
The PDF spec is published and available for free from Adobe's website. I
use Perl to create PDF's all the time.
The problem the OP is going to have is that in general, the regulars
here don't know the PDF spec well, and in general the regulars at
comp.text.pdf don't know Perl well.
A search of CPAN will bring up several PDF related modules, but they
tend not to be well documented. It may take some time to determine if
one of them will do what the OP wants to do.
The OP should post this question at comp.text.pdf. He will probably be
given a non-Perl solution.
The PDF spec is fairly complex. This will not be a simple matter of
inserting page breaks. The entire document will have to be re-built.
------------------------------
Date: Fri, 1 Apr 2005 06:58:07 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: YARQ - Yet another regex question
Message-Id: <slrnd4qhav.g4t.tadmc@magna.augustmail.com>
robic0@yahoo.com <robic0@yahoo.com> wrote:
> On Tue, 29 Mar 2005 18:37:50 GMT, sjp <salvador@progressivetrail.org>
> wrote:
>
>>but records that use '=09'
>>have erroneous line breaks after '=' signs, like so:
>>I'd like to remove the '=' and EOL, but 'Sline =~ s/\=\n//g;' fails with
>>an "Can't modify constant item in substitution (s///) at
>>What is the proper way to do it?
> $line =~ s/[=\n]+//g;
That does not do what was asked for.
The OP wants to remove the 2-character sequence "=\n".
That code removes all equal signs and all newlines.
In fact, the OP's pattern match would do it just fine if he
had typed "$" instead of "S".
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 V10 Issue 7932
***************************************