[24286] in Perl-Users-Digest
Perl-Users Digest, Issue: 6477 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 27 18:06:30 2004
Date: Tue, 27 Apr 2004 15:05:13 -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 Tue, 27 Apr 2004 Volume: 10 Number: 6477
Today's topics:
Re: a warning <bik.mido@tiscalinet.it>
Re: A1 Triple Gold Star for Robin <robin @ infusedlight.net>
Re: A1 Triple Gold Star for Robin <robin @ infusedlight.net>
ANNOUNCE: CGI::Session::ExpireSessions V 1.01 <ron@savage.net.au>
Re: autobox <bik.mido@tiscalinet.it>
Re: autobox <tassilo.parseval@rwth-aachen.de>
Re: free source blogger (works) <ThomasKratz@REMOVEwebCAPS.de>
Re: free source blogger (works) <dover@nortelnetworks.com>
Re: free source blogger (works) <dover@nortelnetworks.com>
Re: free source blogger (works) <tassilo.parseval@rwth-aachen.de>
Re: free source blogger (works) <flavell@ph.gla.ac.uk>
Re: free source blogger (works) <tassilo.parseval@rwth-aachen.de>
Re: free source blogger (works) <flavell@ph.gla.ac.uk>
Re: free source guestbook (finished) <Juha.Laiho@iki.fi>
Re: How can I create a PDF page with only Images (EPS & <remorse@partners.org>
Re: Ignore errors inserting dup records? <nobull@mail.com>
Re: Is Perl *that* good? (was: How's ruby compare to it <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Apr 2004 23:12:42 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: a warning
Message-Id: <45gt80lij261gfj4a8l6fiq95hlub5glo3@4ax.com>
On Mon, 26 Apr 2004 23:11:31 -0800, "Robin" <robin @ infusedlight.net>
wrote:
>When I installed perl builder (windows) with the default install with
>activestate perl, it crashed my @INC and it may have even deleted some of
>the which are supposed to be included in @INC, so let me advise you not to
>install this software.
Well, I don't know this product you're talking about, so I cannot
exclude a priori and with absolute certainty that what you're saying
is true, but taking into account your recent posts... I'd say that
you'd better ask first if by any means you did something wrong and be
sure that you didn't and *then* possibly, advise people not to install
"that software"...
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Tue, 27 Apr 2004 11:44:39 -0800
From: "Robin" <robin @ infusedlight.net>
Subject: Re: A1 Triple Gold Star for Robin
Message-Id: <c6m6dp$20o3$1@news.f.de.plusline.net>
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7n04xa73p.fsf@mail.sysarch.com...
> >>>>> "Jd" == Julia deSilva <jds@nospantrumpetweb.co.uk> writes:
>
> Jd> Many Congratulations to Robin.
>
> Jd> How does this guy (or gal) do it, I mean, how is it possible to
> Jd> take such stick, stay cool and come back for more. Many others
> Jd> have got themselves into similar situations in this NG and have
> Jd> ended up taking offence, being rude, and then getting plonked, or
> Jd> worse.
>
> he is too dumb to know better? notice he seems to think moronzilla has a
> clue.
hahaha....yeah, that's it. Who's moronzilla, can you point me in the
direction of the post(s) I replied to or the information your refering to? I
remember trawling this group two years ago and reading some posts by
godzilla, is that who you mean?
-Robin
------------------------------
Date: Tue, 27 Apr 2004 11:45:27 -0800
From: "Robin" <robin @ infusedlight.net>
Subject: Re: A1 Triple Gold Star for Robin
Message-Id: <c6m6dr$20o3$2@news.f.de.plusline.net>
> Many Congratulations to Robin.
>
> How does this guy (or gal) do it, I mean, how is it possible to take such
> stick, stay cool and come back for more. Many others have got themselves
> into similar situations in this NG and have ended up taking offence, being
> rude, and then getting plonked, or worse.
>
> What a guy ! <sigh>
Thanks julia! Much appreciated.
-Robin
------------------------------
Date: Tue, 27 Apr 2004 00:47:47 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Session::ExpireSessions V 1.01
Message-Id: <HwuK95.36t@zorch.sf-bay.org>
The pure Perl module CGI::Session::ExpireSessions V 1.01
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.01 Tue Apr 27 10:01:00 2004
- Add another parameter to new(): table_name. This allows you to store sessions in a table with
a non-default name. The default name is of course 'sessions'. Thanx to Mark Stosberg for this
suggestion
- This module does not work with Mark's module CGI::Session::PureSQL. The best solution to this
problem seems to be to extend CGI::Session to offer a session iterator. This suggesion is also
from Mark. I will propose this today to the author of CGI::Session when I report the bug in
CGI:Session V 3.94 line 168, which says:
if ( $arg->isa('CGI') )
This bug means classes such as CGI::Simple can't be used here as a replacement for CGI.
The code needs to be something like:
if ($arg -> can('cookie') )...
elsif ($arg -> can('param') )...
--
Cheers
Ron Savage, ron@savage.net.au on 27/04/2004
http://savage.net.au/index.html
------------------------------
Date: Tue, 27 Apr 2004 23:12:39 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: autobox
Message-Id: <b5jt805q5fr8l8j6vl35tfhtfn2ujuh074@4ax.com>
On Tue, 27 Apr 2004 06:13:19 +0200, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
>>>as people now say that one should wait for perl5.12. This happened to me
>>>anyway when I proposed to extend the tie() interface with stuff like
>>>SUBSTR, INDEX etc. for which I provided an outline on how this could be
>>>implemented.
>>
>> Hmmm, that sounds interesting!
>
>Of course it does. ;-)
After your explanation below, indeed it still does, but...
>I had the idea of writing a module that makes Perl scalars store their
>content zlib compressed so that people could put very large strings into
>them (provided that these strings can be compressed well; ordinary text
>strings usually can) and trade speed for space. But then I realized that
>the first time someone did
>
> substr($compressed, 1, 1);
>
>perl would translate that into
>
> substr( tied($compressed)->FETCH, 1, 1 );
>
>and that gave me no chance to only inflate the needed parts of the
>string. So I had to abandon my idea.
...apart from "historical" reasons, would this really be a good
example? I must admit that I'm particularly ignorant on the matter,
but would it be easy/efficient to to "only inflate the needed parts"
of the string?!?
[Just curious, and -I stress it- ignorant! Please do not answer if you
have any higher priority]
Thanks,
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Tue, 27 Apr 2004 23:43:50 +0200
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: autobox
Message-Id: <c6mk6p$e1j89$1@ID-231055.news.uni-berlin.de>
Also sprach Michele Dondi:
> On Tue, 27 Apr 2004 06:13:19 +0200, "Tassilo v. Parseval"
><tassilo.parseval@rwth-aachen.de> wrote:
>>I had the idea of writing a module that makes Perl scalars store their
>>content zlib compressed so that people could put very large strings into
>>them (provided that these strings can be compressed well; ordinary text
>>strings usually can) and trade speed for space. But then I realized that
>>the first time someone did
>>
>> substr($compressed, 1, 1);
>>
>>perl would translate that into
>>
>> substr( tied($compressed)->FETCH, 1, 1 );
>>
>>and that gave me no chance to only inflate the needed parts of the
>>string. So I had to abandon my idea.
>
> ...apart from "historical" reasons, would this really be a good
> example? I must admit that I'm particularly ignorant on the matter,
> but would it be easy/efficient to to "only inflate the needed parts"
> of the string?!?
Sadly, no. One can't just take the string and compress it into one
smaller string. It would have to happen chunkwise, otherwise parts of it
couldn't be retrieved selectively. In my draft I used this structure:
typedef struct _string {
Bytef *chunk;
uLongf size_compressed;
uLongf size_uncompressed;
uLongf size_total;
struct _string *next;
struct _string *first;
struct _string *last; /* for easier concatenation */
} STRING;
which is essentially a linked list of string chunks ('chunk' in the
above would be the compressed data) of, say, 4k bytes or so. The larger
they are, the better the compression would be. This would have allowed
to find out which chunk(s) to decompress if someone had wanted to carry
out an action on parts of the string.
My implementation hardly reached alpha status and I remember that some
data needed more memory than just using an ordinary Perl scalar. And it
was SLOW.
But it was also fun to write. It would have been a nice proof of
concept. Well, it certainly did prove that it cannot be done. :-)
> [Just curious, and -I stress it- ignorant! Please do not answer if you
> have any higher priority]
As if any of the regulars here could afford to have a life of their own
beyond this group. ;-)
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 27 Apr 2004 17:04:39 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: free source blogger (works)
Message-Id: <408e77e4.0@juno.wiesbaden.netsurf.de>
Tassilo v. Parseval wrote:
> Also sprach Tad McClellan:
>
>
>>Robin <robin@infusedlight.net> wrote:
>>
>>
>>>some of it is just sucky advice though, for example, the
>>>fact that I'm using if (! ) instead of unless makes no difference.
>>
>>
>>Yes it does. You just have not been programming long enough to
>>recognize the difference.
>>
>>You are communicating with the reader of your code.
>>
>>If it communicates more clearly, then it is NON-sucky.
>
>
> I will forever disagree with this one. 'unless' may communicate more
> clearly with a native English speaker. But it it doesn't work half as
> well with someone (like me) whose native language doesn't really have an
> equivalent word for it. In German, you'd usually use 'if' + negated
> condition to express 'unless'. There are other ways of expressing it,
> but those require a very different syntactic structure of the sentence;
> one that doesn't ressemble anything Perl can offer.
I would translate it as: 'es sei denn', which doesn't conflict with the
syntactic structure at all (it's not a single word, though).
>
> I used 'unless' a few times long ago but then I realized that it took me
> much longer to decipher it afterwards. So I dropped it altogether and
> probably haven't used it altogether throughout the past two years. And I
> will continue not to do so.
It took me a while to get used to unless, but after a while I found it
really makes things easier to read. Especially in statements like:
return unless new_mail();
Thomas
--
open STDIN,"<&DATA";$=+=14;$%=50;while($_=(seek( #J~.> a>n~>>e~.......>r.
STDIN,$:*$=+$,+$%,0),getc)){/\./&&last;/\w| /&&( #.u.t.^..oP..r.>h>a~.e..
print,$_=$~);/~/&&++$:;/\^/&&--$:;/>/&&++$,;/</ #.>s^~h<t< ..~. ...c.^..
&&--$,;$:%=4;$,%=23;$~=$_;++$i==1?++$,:_;}__END__#....>>e>r^..>l^...>k^..
------------------------------
Date: Tue, 27 Apr 2004 10:18:58 -0500
From: Robert Dover <dover@nortelnetworks.com>
Subject: Re: free source blogger (works)
Message-Id: <c6lth1$1s$1@zcars0v6.ca.nortel.com>
Robin wrote:
>
> which statement is faster for one thing? I thought if was always faster in
> it's check?
I know nothing about the inner-workings of perl, but I'd bet the farm
that there is no difference in their execution speeds. The difference
between the two statements is a very minor syntactic variation that
should have no impact on the generated code.
> Or am I totally wrong?
Totally.
>
>
>
------------------------------
Date: Tue, 27 Apr 2004 10:25:09 -0500
From: Robert Dover <dover@nortelnetworks.com>
Subject: Re: free source blogger (works)
Message-Id: <c6ltsl$1s$2@zcars0v6.ca.nortel.com>
Robin wrote:
> I should be running unix.
I wish you were running away....
------------------------------
Date: Tue, 27 Apr 2004 19:32:15 +0200
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: free source blogger (works)
Message-Id: <c6m5fa$dgaka$1@ID-231055.news.uni-berlin.de>
Also sprach Thomas Kratz:
> Tassilo v. Parseval wrote:
>
>> Also sprach Tad McClellan:
>>
>>
>>>Robin <robin@infusedlight.net> wrote:
>>>
>>>
>>>>some of it is just sucky advice though, for example, the
>>>>fact that I'm using if (! ) instead of unless makes no difference.
>>>
>>>
>>>Yes it does. You just have not been programming long enough to
>>>recognize the difference.
>>>
>>>You are communicating with the reader of your code.
>>>
>>>If it communicates more clearly, then it is NON-sucky.
>>
>>
>> I will forever disagree with this one. 'unless' may communicate more
>> clearly with a native English speaker. But it it doesn't work half as
>> well with someone (like me) whose native language doesn't really have an
>> equivalent word for it. In German, you'd usually use 'if' + negated
>> condition to express 'unless'. There are other ways of expressing it,
>> but those require a very different syntactic structure of the sentence;
>> one that doesn't ressemble anything Perl can offer.
>
> I would translate it as: 'es sei denn', which doesn't conflict with the
> syntactic structure at all (it's not a single word, though).
'Es sei dann' does change the syntactic structure. It's an easy test
that can be performed. Take an English if-clause. You can always replace
the 'if' with an 'unless' and the result will be syntactically correct.
Try that with the German 'falls' or 'wenn'. If you mechanically replace
those with 'es sei denn', the resulting sentence will usually _not_ be
syntactically ok:
Falls er beschäftigt ist, bleibe ich zu Hause.
Es sei denn, er beschäftigt ist, bleibe ich zu Hause.
It would have to be
Ich bleibe zu Hause, es sei denn, er ist beschäftigt.
Or even (and probably more correct)
Ich bleibe zu Hause. Es sei denn, er ist beschäftigt.
You also loose the ability to use the condition in pre-order when using
'es sei denn'. It has to come in post-order.
>> I used 'unless' a few times long ago but then I realized that it took me
>> much longer to decipher it afterwards. So I dropped it altogether and
>> probably haven't used it altogether throughout the past two years. And I
>> will continue not to do so.
>
> It took me a while to get used to unless, but after a while I found it
> really makes things easier to read. Especially in statements like:
>
> return unless new_mail();
As long as the condition is easy, maybe. It looks less appealing if you
want to add a second condition sententially connected with && or ||.
Sometimes you want one condition to be true and the other one to be false:
return unless new_mail() and not raining();
Now you have a double negation so this is probably the threshold where
one would start using 'if' again.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 27 Apr 2004 19:13:05 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: free source blogger (works)
Message-Id: <Pine.LNX.4.53.0404271857150.23910@ppepc56.ph.gla.ac.uk>
On Tue, 27 Apr 2004, Tassilo v. Parseval wrote:
> Also sprach Thomas Kratz:
>
> > Tassilo v. Parseval wrote:
> >> I will forever disagree with this one. 'unless' may communicate more
> >> clearly with a native English speaker. But it it doesn't work half as
> >> well with someone (like me) whose native language doesn't really have an
> >> equivalent word for it. In German, you'd usually use 'if' + negated
> >> condition to express 'unless'. There are other ways of expressing it,
> >> but those require a very different syntactic structure of the sentence;
> >> one that doesn't ressemble anything Perl can offer.
> >
> > I would translate it as: 'es sei denn', which doesn't conflict with the
> > syntactic structure at all (it's not a single word, though).
>
> 'Es sei dann' does change the syntactic structure. It's an easy test
> that can be performed. Take an English if-clause. You can always replace
> the 'if' with an 'unless' and the result will be syntactically correct.
>
> Try that with the German 'falls' or 'wenn'. If you mechanically replace
> those with 'es sei denn', the resulting sentence will usually _not_ be
> syntactically ok:
Thanks for this interesting insight. In spite of my reputation for
being reasonably fluent in German - and in spite of being an
enthusiastic user of "unless" in programming languages - I somehow had
never noticed this problem, until it was pointed out here.
Yes, it makes perfect sense that someone who doesn't have a natural
counterpart to "unless" in their native language would not be
comfortable with using this in a programming language.
Perhaps you could adapt "mangels" to this context? It's close:
unless otherwise agreed = mangels anderer Vereinbarung
(says a business Lexikon).
> You also loose the ability to use the condition in pre-order when using
> 'es sei denn'. It has to come in post-order.
Schade, dass "loose" and "lose" so verwechselt werden!
There's been a noticeable outbreak of confusing "lose" with "loose"
amongst native users of the language in recent years. A pity that it
seems to be infectious. Nothing personal, you understand...
all the best
------------------------------
Date: Tue, 27 Apr 2004 22:12:50 +0200
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: free source blogger (works)
Message-Id: <c6mes4$dbp1o$1@ID-231055.news.uni-berlin.de>
Also sprach Alan J. Flavell:
> On Tue, 27 Apr 2004, Tassilo v. Parseval wrote:
>
>> Also sprach Thomas Kratz:
>>
>> > Tassilo v. Parseval wrote:
>
>> >> I will forever disagree with this one. 'unless' may communicate more
>> >> clearly with a native English speaker. But it it doesn't work half as
>> >> well with someone (like me) whose native language doesn't really have an
>> >> equivalent word for it. In German, you'd usually use 'if' + negated
>> >> condition to express 'unless'. There are other ways of expressing it,
>> >> but those require a very different syntactic structure of the sentence;
>> >> one that doesn't ressemble anything Perl can offer.
>> >
>> > I would translate it as: 'es sei denn', which doesn't conflict with the
>> > syntactic structure at all (it's not a single word, though).
>>
>> 'Es sei dann' does change the syntactic structure. It's an easy test
>> that can be performed. Take an English if-clause. You can always replace
>> the 'if' with an 'unless' and the result will be syntactically correct.
>>
>> Try that with the German 'falls' or 'wenn'. If you mechanically replace
>> those with 'es sei denn', the resulting sentence will usually _not_ be
>> syntactically ok:
>
> Thanks for this interesting insight. In spite of my reputation for
> being reasonably fluent in German - and in spite of being an
> enthusiastic user of "unless" in programming languages - I somehow had
> never noticed this problem, until it was pointed out here.
Maybe you are less prone to these problems as your native language is
English (I suppose) while you additionally speak German fluently. And
maybe other languages. I wouldn't be surprised. ;-)
The ability to speak several languages may have made your mind more
adaptable.
> Yes, it makes perfect sense that someone who doesn't have a natural
> counterpart to "unless" in their native language would not be
> comfortable with using this in a programming language.
>
> Perhaps you could adapt "mangels" to this context? It's close:
>
> unless otherwise agreed = mangels anderer Vereinbarung
>
> (says a business Lexikon).
Yes, this works in some contexts. The problem is that 'mangels' is more
like the English 'lacking'. It requires a nominal phrase following it.
Maybe 'außer wenn' works (in English 'except when'):
Ich komme, falls ich Zeit habe.
Ich komme, außer wenn ich Zeit habe.
I was always of the opinion that your native language somewhat
influences the way you think. As I remember, it was Aristoteles who
indulged so much with grammar because he hoped to get some insight on
how humans structure arguments in their head.
>> You also loose the ability to use the condition in pre-order when using
>> 'es sei denn'. It has to come in post-order.
>
> Schade, dass "loose" and "lose" so verwechselt werden!
>
> There's been a noticeable outbreak of confusing "lose" with "loose"
> amongst native users of the language in recent years. A pity that it
> seems to be infectious. Nothing personal, you understand...
You've caught me in the act of something I do quite frequently. There's
a set of words I find exceptionally difficult to spell correctly. 'lose'
is one of them. I have similar problems with 'prove' versus 'proof'. I
think the latter is the noun whereas the first one is the verb. But I
would have to look it up to be sure. English phonetics are dreadful...in
both directions. There's always a realistic chance of getting
pronunciation of an unknown word spectacularly wrong on first reading.
Likewise when you hear one: It could be spelled in many different ways.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 27 Apr 2004 22:24:29 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: free source blogger (works)
Message-Id: <Pine.LNX.4.53.0404272209460.23910@ppepc56.ph.gla.ac.uk>
On Tue, 27 Apr 2004, Tassilo v. Parseval wrote:
> Maybe you are less prone to these problems as your native language is
> English (I suppose) while you additionally speak German fluently.
We are really in the wrong place for this discussion, so I'll keep it
as short as I can. However, in the interests of honesty I must
respond to the next item...
> And maybe other languages. I wouldn't be surprised. ;-)
No. I was taught French and Latin at school - and have no useful
competence in either. I picked-up fluent German by working there,
without really trying, but it's my only fluent non-native language.
One day, I woke up, and realised that I had been dreaming -in- German.
This came as a surprise.
Subsequently to this experience, I am a great supporter of the
learn-by-doing-it method, and do not believe that the formal language
instruction we used to get at school has any -practical- use in
teaching a second language (although it is an interesting academic
study...).
However, the absorption method (if I can call it that) does have some
negative points:
- sometimes, German speakers ask me how to say some German sentence in
English, and I find it hard to answer. They ask "have you not
understood the German?" and I have to say that I understood the German
very well, but I am having difficulty translating it into English!
- my grammar is terrible
> > Perhaps you could adapt "mangels" to this context? It's close:
> >
> > unless otherwise agreed = mangels anderer Vereinbarung
>
> Yes, this works in some contexts. The problem is that 'mangels' is more
> like the English 'lacking'. It requires a nominal phrase following it.
Yes - as we see in the example, the grammar is rather different.
This is why I said "adapt" ;-)
> I was always of the opinion that your native language somewhat
> influences the way you think.
There is no doubt about it.
all the best, bzw. beste Gruesse ;-)
------------------------------
Date: Tue, 27 Apr 2004 18:37:02 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: free source guestbook (finished)
Message-Id: <c6m988$21a$1@ichaos.ichaos-int>
"Robin" <robin @ infusedlight.net> said:
>> Ouch. First gethead just to determine whether or not the file exists,
>> and if it did succeed, do it again to actually store the read contents.
>> So, opening/locking/reading/unlocking/closing the file twice for each
>> request (if using your original gethead code)? In addition there would
>> of course be the possible race condition that the header file gets
>> removed between the two gethead calls; the first call to gethead telling
>> that the file is there, and thus default content is not needed, and the
>> second trying to read content from the file that no longer exists.
>And how would I fix this race condition?
By only opening/reading the file once -- returning either content or
a failure status, instead of reading once for status and re-reading
if the status was ok.
Don't worry -- you're not the first one having done this; in Unix
operating systems there's an "access" library call that is to be
used for checking whether the current user has desired kind of access
to a specified file. The problem of using this library call anyuwhere
is exactly as with your code -- the information might be invalid at
the time it reaches your code. Similarly, the solution there is to not
make the "access" call at all, but to attempt to open the file with
the desired access mode, and use the failure code from the "open"
function. There, either the file open did succeed, or it did not -
no time is provided for someone to change the file between checking
and accessing it.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Tue, 27 Apr 2004 14:41:59 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: How can I create a PDF page with only Images (EPS & TIFF)
Message-Id: <remorse-422B4F.14415927042004@plato.harvard.edu>
In article <55d7995c.0404262146.3f009fd9@posting.google.com>,
junk@dlink.org (Aqua) wrote:
> > Can you install PDF::API2?
> >
> > This should allow you to create a PDF with all the images...
> >
> > HTH,
> > Ricky
>
> I am conversant with Perl. So I have already tried PDF::API2.
> use PDF::API2;
>
> unlink "test.pdf";
> $pdf = PDF::API2->new(-file=>"test.pdf");
> $page = $pdf->page(1);
> $gfx = $page->gfx;
> $img = $pdf->image_tiff("bbb.tif");
> #$img = $pdf->image_jpeg("ccc.jpg");
> $gfx->image($img, 0, 0);
> $page->update;
> $pdf->update;
>
> exit;
>
> The above sample doesnt create a PDF (or it creates a PDF but I am not
> able to open it)
What happens if you do the following:
#!/usr/bin/perl
use strict;
use warnings;
use PDF::API2;
my $pdf = PDF::API2->new();
my $page = $pdf->page();
$page->mediabox('LETTER');
my $gfx = $page->gfx();
$gfx->image($pdf->image_jpeg("/path/to/some/jpg"), 100, 100);
$gfx->circle(50, 50, 10);
$gfx->stroke();
$pdf->saveas("/path/to/save/as");
__END__
Ricky
--
Pukku
------------------------------
Date: 27 Apr 2004 19:57:21 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Ignore errors inserting dup records?
Message-Id: <u9n04xtfji.fsf@wcl-l.bham.ac.uk>
Richard Morse <remorse@partners.org> writes:
> my $sql = "insert into t (v) values (?)";
> my $sth = $db->prepare($sql);
> foreach (qw/the walrus was paul/) {
> $sth->execute($_);
> }
> $sth->finish();
Don't forget execute_array().
So far it's not widely supported by the backends so is equivalent to
the above. However if execute_array() is ever directly supported by
the DBD you are using the improvement could be significant.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 27 Apr 2004 23:12:41 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)
Message-Id: <v1gt80pdise5mk0b261a7b5gd1pj6vvbsl@4ax.com>
ùOn Mon, 26 Apr 2004 16:55:02 -0400, "Ruby Tuesdays"
<NoSpamPlease_rubytuzdaiz@yahoo.com> wrote:
>Would this super perl program of yours can convert the massive amount of
>perl script to ruby or python?
>
>If it could, it would be great so ruby/python programmers does not have to
>learn those cryptic perl-ish syntax and the non-OOish scripting language.
Huh?!?
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
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 6477
***************************************