[17255] in Perl-Users-Digest
Perl-Users Digest, Issue: 4677 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 20 14:10:53 2000
Date: Fri, 20 Oct 2000 11:10:21 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972065421-v9-i4677@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 20 Oct 2000 Volume: 9 Number: 4677
Today's topics:
Re: http referer manipulation <jeff@vpservices.com>
Re: Is perl object oriented? (Andy Lester)
lenght if query string <Glimne@gmx.net>
Re: lenght if query string <anders@wall.alweb.dk>
lenght of query string??? <Glimne@gmx.net>
Re: lenght of query string??? nobull@mail.com
Re: lenght of query string??? <anders@wall.alweb.dk>
Re: lenght of query string??? (Jerome O'Neil)
make doesn't make <ducateg@info.bt.co.uk>
Re: manipulating data files <russ_jones@rac.ray.com>
need help with my script <sbearden@houston.rr.com>
Need to change 3000 images... <speed.demon9999@virgin.net>
Re: Need to change 3000 images... <anders@wall.alweb.dk>
no flock file access ?? <mrobison@c802.crane.navy.mil>
opposite of pack? <paradive@industrial.org>
Re: opposite of pack? (Andrew Johnson)
Perl Callbacks for Byacc and Flex pinhong@eecs.berkeley.edu
Re: Perl for PalmOS? (Tony L. Svanstrom)
Re: perl objects and methods <pdcawley@bofh.org.uk>
Re: perl objects and methods <bart.lateur@skynet.be>
Re: POST into an other cgi script nobull@mail.com
Subroutine reference/undef/redefine anomaly nobull@mail.com
Re: whence $0 (Randal L. Schwartz)
Re: Working w/ Hashes of Arrays w/in an object <martin.mclaughlin@uvm.edu>
Writing multiple files to a particular directory <MPEDDLE@uk.ibm.com>
Re: Writing multiple files to a particular directory <anders@wall.alweb.dk>
Re: Writing multiple files to a particular directory (Jerome O'Neil)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Oct 2000 09:46:25 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: http referer manipulation
Message-Id: <39F076E1.A598E0B6@vpservices.com>
nobull@mail.com wrote:
>
> OK this is off-topic but Jeff Zucker <jeff@vpservices.com> writes
> things that AFAIK are factually incorrect:
AFAIK also.
> > EM wrote:
> > >
> > > I use this code to redirect the browser to an url
> > >
> > > print "Content-type: text/html\n";
> > > print "Location: $url\n\n";
> > >
> > > this works fine
> >
Yes, since there is only a single CRLF after the content-type line, it
should. If one tried this with two CRLFs at the end of that line, as is
often mistakenly done, it would not since the second CRLF would end the
header section and the location line would be treated as body. I
misremembered why this usually doesn't work and mistakenly blamed it on
combining a response header with an entity header. I was wrong.
> What specs would those be?
The ones in my head that bear no relation to reality in this case.
Thanks for the correction.
--
Jeff
------------------------------
Date: 20 Oct 2000 15:07:47 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Is perl object oriented?
Message-Id: <39f05fc3$0$12775@wodc7nh0.news.uu.net>
: RM> http://www.amazon.com/exec/obidos/ASIN/1884777791/XXXXXXXXXXXXXXXXX
: when you mention a book here, it is VERY impolite to use your kickback
: link. keep that to your website and private email.
But really, who cares?
xoxo,
Andy
--
--
# Andy Lester http://www.petdance.com AIM:petdance
%_=split';','.; Perl ;@;st a;m;ker;p;not;o;hac;t;her;y;ju';
print map $_{$_}, split //,
'andy@petdance.com'
------------------------------
Date: Fri, 20 Oct 2000 19:08:14 +0200
From: Stefan Glimne <Glimne@gmx.net>
Subject: lenght if query string
Message-Id: <39F07BFE.528A9E2F@gmx.net>
Hi all,
Does anyone know how long the "query string" can be. I have problem when
I write to much in a TEXTAREA. The "query string" is just cut. Is there
a solution for this problem. Should I perhaps use another
cgi-translator?
Thank you in advance
Stefan, ute och ser sig om i världen
------------------------------
Date: Fri, 20 Oct 2000 19:49:21 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: lenght if query string
Message-Id: <jB%H5.7557$Uy5.272411@news000.worldonline.dk>
Stefan Glimne wrote:
> Hi all,
>
> Does anyone know how long the "query string" can be. I have problem when
> I write to much in a TEXTAREA. The "query string" is just cut. Is there
> a solution for this problem. Should I perhaps use another
> cgi-translator?
I think oyu should look at your server configuration first!
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Fri, 20 Oct 2000 19:10:42 +0200
From: Stefan Glimne <Glimne@gmx.net>
Subject: lenght of query string???
Message-Id: <39F07C92.C5066FE6@gmx.net>
Hi all,
Does anyone know how long the "query string" can be. I have problem when
I write to much in a TEXTAREA. The "query string" is just cut. Is there
a solution for this problem. Should I perhaps use another
cgi-translator?
Thank you in advance
Stefan, ute och ser sig om i världen
------------------------------
Date: 20 Oct 2000 18:31:42 +0100
From: nobull@mail.com
Subject: Re: lenght of query string???
Message-Id: <u9zojzs9kx.fsf@wcl-l.bham.ac.uk>
Stefan Glimne <Glimne@gmx.net> writes:
> Does anyone know how long the "query string" can be.
I think that URLs are limited to about 1024.
> I have problem when
> I write to much in a TEXTAREA. The "query string" is just cut. Is there
> a solution for this problem.
Stop using method=GET and start using method=POST in your HTML forms.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 20 Oct 2000 19:50:03 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: lenght of query string???
Message-Id: <YB%H5.7558$Uy5.272438@news000.worldonline.dk>
Stefan Glimne wrote:
> Hi all,
>
> Does anyone know how long the "query string" can be. I have problem when
> I write to much in a TEXTAREA. The "query string" is just cut. Is there
> a solution for this problem. Should I perhaps use another
> cgi-translator?
>
> Thank you in advance
>
> Stefan, ute och ser sig om i världen
*please post each message only once*
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Fri, 20 Oct 2000 17:57:50 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: lenght of query string???
Message-Id: <yI%H5.580$UK.144920@news.uswest.net>
nobull@mail.com elucidates:
> Stefan Glimne <Glimne@gmx.net> writes:
>
>> Does anyone know how long the "query string" can be.
>
> I think that URLs are limited to about 1024.
There is no specified limit to the size of a URL, or the size
of a query string.
Various servers may have limitations, but that is an issue for the
server.
--
"Civilization rests on two things: the discovery that fermentation
produces alcohol, and the voluntary ability to inhibit defecation.
And I put it to you, where would this splendid civilization be without
both?" --Robertson Davies "The Rebel Angels"
------------------------------
Date: Fri, 20 Oct 2000 16:21:59 +0100
From: "Géry" <ducateg@info.bt.co.uk>
Subject: make doesn't make
Message-Id: <8spnvq$5ii$1@pheidippides.axion.bt.co.uk>
Hi,
I am running Windows NT (I know...) I am trying to make the HTML::template
module. I got borland version 5.2 of "make" (by the way it is the first
module I install, ever). the instructions are quite clear:
perl makefile.pl
make
make test
make install
I had to add -N to my "make", I don't know why apart from that it makes it
compatible with "nmake"...
therefore I did:
perl makefile.pl
no probs
make -N
no probs - I even get congratulations lines :)
make -N test
no probs - it does a series of tests, I am congratulated again :)
make -N install(or make, or make -N -I -e or all -something that you
want...)
the error msg is:
syntax error at -e line 4, nea ") print"
execution of -e aborted due to compilation error
If anyone by any chance experienced that before, you can contact me here!
--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Géry Ducatel
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
------------------------------
Date: Fri, 20 Oct 2000 12:01:25 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: manipulating data files
Message-Id: <39F07A65.35AD7BD8@rac.ray.com>
Randy Harris wrote:
(beau coups of zilla crapola snipped)
> OK. I admit I'm a bit slow. It has taken me a while to realize, you
> really are a nut. It has become apparent that attempting to communicate
> with you is a waste of time and newsgroup message space. A foolish
> mistake which I won't repeat.
>
Much like wrestling with a pig. It gets you dirty and the pig likes
it.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Fri, 20 Oct 2000 17:31:14 GMT
From: "Seth" <sbearden@houston.rr.com>
Subject: need help with my script
Message-Id: <Cj%H5.9688$Fe4.251301@typhoon.austin.rr.com>
ftp.fragilis.net/pub/newnewlpbmatches.cgi
coudl someone please look at this and maybe tell me what im doing wrong?
------------------------------
Date: Fri, 20 Oct 2000 18:18:11 +0100
From: "Speed Demon" <speed.demon9999@virgin.net>
Subject: Need to change 3000 images...
Message-Id: <8spuld$cab$1@uk21.supernews.com>
Hi everyone, I've got a little problem with some images on my site.
I have 3000 of them, I need them all to be 72x14, some are not, a few are a
few pixels out.
Using perl or other language, can I read in the image, check out its size
and delete the strip of offending pixels if necessary and then save the
image again?
I wouldn't mind doing this manually if it wasn't for the huge number of
pictures :)
Any ideas? Will I need to get some modules installed to do this?
thanks for your help, best regards Taz.
--------------------------------------------------------
http://www.e-tones.co.uk
Free Resources For Your Mobile Phone
------------------------------
Date: Fri, 20 Oct 2000 19:51:31 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Need to change 3000 images...
Message-Id: <lD%H5.7559$Uy5.272378@news000.worldonline.dk>
Speed Demon wrote:
> Hi everyone, I've got a little problem with some images on my site.
>
> I have 3000 of them, I need them all to be 72x14, some are not, a few are
> a few pixels out.
> Using perl or other language, can I read in the image, check out its size
> and delete the strip of offending pixels if necessary and then save the
> image again?
>
> I wouldn't mind doing this manually if it wasn't for the huge number of
> pictures :)
>
> Any ideas? Will I need to get some modules installed to do this?
>
> thanks for your help, best regards Taz.
Image::Magick may do the job
Did you visit http://search.cpan.org before asking such a basic q??
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Fri, 20 Oct 2000 16:40:58 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: no flock file access ??
Message-Id: <8spsio$cje$1@nnrp1.deja.com>
i've been having trouble getting a counter to work on
a flash page. i'm not a seasoned veteran at perl so i
figured maybe my programming was off, cuz i've got a
simple counter working elsewhere.
i have a ssi which grabs a string from a count text file
and then parses the count out of it, increments it, and
then reparses the string back in.
THEN, i open a flash file which accesses the file. i
thought it wasn't working at all, but then i noticed that
sometimes it did and sometimes it didn't, and that some-
times i could hit the refresh on IE5.5 several times and
it wouldn't refresh but if i closed it totally and reopened
it, all the refreshes would show on the count.
so how does this all work? i'm worried that if i put an
flock on the file then flash will fail to open it and
i'll get no count at all. this is looking more and more
like a flash question and not a perl question, isn't it?
but maybe somebody here would still know... i believe that
the flash plug-in on IE5 is an activeX component (it calls
for an object) and netscape uses an embed.
thank you, miker
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 20 Oct 2000 15:33:44 GMT
From: "paradive" <paradive@industrial.org>
Subject: opposite of pack?
Message-Id: <sBZH5.394$E85.13246@news1.sttls1.wa.home.com>
i currently have some variables i'm packing like so...
$foo = pack("A7", $foo)
print "\"" . $foo . "\""; # prints something like "4.31 "
what i need to do instead is pad the beginning of the number w/ spaces
instead of the end so it will print something more like " 4.31".
surely, this is simple,.... right?
thanks in advance,
paradive
------------------------------
Date: Fri, 20 Oct 2000 15:41:44 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: opposite of pack?
Message-Id: <YIZH5.22768$6O5.2030470@news1.rdc1.mb.home.com>
In article <sBZH5.394$E85.13246@news1.sttls1.wa.home.com>,
paradive <paradive@industrial.org> wrote:
> i currently have some variables i'm packing like so...
>
> $foo = pack("A7", $foo)
> print "\"" . $foo . "\""; # prints something like "4.31 "
>
> what i need to do instead is pad the beginning of the number w/ spaces
> instead of the end so it will print something more like " 4.31".
If you are merely trying to format data, you probably want
to use the sprintf() function rather than pack():
$foo = 4.31;
$foo = sprintf("%7.2f",$foo);
print "<$foo>";
see:
perldoc -f sprintf
perldoc -f printf
for details.
regards,
andrew
--
Andrew L. Johnson http://members.home.net/andrew-johnson/
Doing linear scans over an associative array is like
trying to club someone to death with a loaded Uzi.
-- Larry Wall
------------------------------
Date: Fri, 20 Oct 2000 17:47:51 GMT
From: pinhong@eecs.berkeley.edu
Subject: Perl Callbacks for Byacc and Flex
Message-Id: <8sq0g4$g9q$1@nnrp1.deja.com>
Hi all,
I've implemented a package which can insert
some interface code that makes perl callbacks
possible in the output of byacc or that of flex.
The major difference between my work and
"byacc -P" (for generating Perl parser) is that
in my approach you will get a C parser
engine with Perl embedded callbacks, while
you will get a pure Perl parser using "byacc -P".
The benefit of this approch is to speed up
the parser performance and ease the trouble
to tweak those C data strutures in callbacks.
Usually, it takes a while before a pure C code
parser can work just because a user has to deal
with tons of data structures to carry the information
correctly from parsing.
If anyone is interested, I will make it publicly
available.
Pinhong
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 20 Oct 2000 17:08:01 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Perl for PalmOS?
Message-Id: <1eitdhn.4bda9138nuioN%tony@svanstrom.com>
<wrnelson@my-deja.com> wrote:
> I've seen several references on the web to a project underway to port Perl
> to the PalmOS, but I haven't been able to find any details on this or
> confirm it. If anyone knows if this is in the works, and/or the status of
> the project, please let me know.
As far as newsgroups goes comp.lang.perl.misc is a good choice to ask
this in, as far as finding the answer... Go to the more or less official
websites and have a look around, sooner or later you'll come across a
nice lil ML that is about porting Perl. Personally I've not subscribed
to it ever, but I've got a hunch that you might find the answer there.
The answer, I'm sure, will be something like "now how the hell would I
get Perl to work on that lil thing".
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: 20 Oct 2000 16:32:20 +0100
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: perl objects and methods
Message-Id: <m1y9zj7cl7.fsf@rt158.private.realtime.co.uk>
Rick Delaney <rick.delaney@home.com> writes:
> Logan Shaw wrote:
> >
> > In article <Pine.GSO.4.21.0010160924080.25707-100000@crusoe.crusoe.net>,
> > Jeff Pinyan <japhy@pobox.com> wrote:
> > >As of Perl 5.6, you can make subroutines lvalues -- which means they can
> > >be assigned to.
> > >
> > > package Foo;
> > > sub id :lvalue {
> > > return $_[0]{id};
> > > }
> > >
> > > package main;
> > > bless $obj, 'Foo';
> > > $obj->id = 100;
> > > print $obj->id; # 100
> >
> > This doesn't seem to actually work for me. For one, thing, if I run
> > the code as posted, I get a "Can't bless non-reference value" error,
> > but I fix that by adding "$obj = {};" immediately before the bless.
> > Still, it doesn't seem to actually modify the object.
>
> That's because of the explicit "return". If it is coded as
>
> sub id :lvalue {
> $_[0]{id};
> }
Err... I think you mean '$_[0]->{id}'
--
Piers
------------------------------
Date: Fri, 20 Oct 2000 17:06:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: perl objects and methods
Message-Id: <5ru0vskvbasmrf9qs8ai38ej6l1cb4b875@4ax.com>
Piers Cawley wrote:
>> That's because of the explicit "return". If it is coded as
>>
>> sub id :lvalue {
>> $_[0]{id};
>> }
>
>Err... I think you mean '$_[0]->{id}'
Err... what's the difference. If an array item (or hash item) is a
reference, you may drop any following arrows. Under normal
circumstances.
--
Bart.
------------------------------
Date: 20 Oct 2000 17:22:54 +0100
From: nobull@mail.com
Subject: Re: POST into an other cgi script
Message-Id: <u966mntrc1.fsf@wcl-l.bham.ac.uk>
Jørgen Teunis <jorgen@bos.nl> writes:
> Then i want my script to do something with the data..... and then post that
> data to a script wich isn't mine...
Yes that is the question I thought you asked, and the question I
answered.
> Understand?
Maybe the question you asked is not the question you meant to ask. I
think what you meant to say was "Then i want my script to do something
with the data..... and then cause the _browser_ to post that data to a
script wich isn't mine..."
This is a completely different matter. You can't do it. At least not
directly through HTTP. You may be able to do it through client-side
scripting. Also since this is a question about manipulating the
browser's behaviour you could reasonably have been expected to realise
that it was a HTTP/HTML question and not a Perl one.
> GET THE IDEA???? I didn't saw a question of this type....
Yes, this question is not so frequently asked. It is 5 weeks
(14/8/00) since I last answered it in the comp.lang.perl.misc. I can't
say for certain it hasn't been asked again since. You can be forgiven
for not finding it as George Crane didn't bother to give a useful
subject line. His subject line was: "Newbie post problem.".
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 20 Oct 2000 17:23:38 +0100
From: nobull@mail.com
Subject: Subroutine reference/undef/redefine anomaly
Message-Id: <u94s27trat.fsf@wcl-l.bham.ac.uk>
Undefining and then redefining a subroutine creates an anomalous state
in references to the old subroutine.
#!/usr/bin/perl -w
use strict;
sub foo { 2 };
my $old_foo = \&foo;
undef &foo;
*foo = sub { 3 };
print 0 + defined &$old_foo;
print $old_foo->();
This prints '03'. This is of course nonsense. How can I call an
undefined function and have it return 3?
If I comment out the undef it correctly prints '12' and correctly
warns about the redefinition of &main::foo.
If I put back the undef and comment out the redefinition it correctly
prints '0' and correctly dies when it tries to call the undefined
function.
Not exactly a serious bug, but it caused me some great confusion
trying to debug a program.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 20 Oct 2000 10:55:11 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: whence $0
Message-Id: <m14s27o0sg.fsf@halfdome.holdit.com>
>>>>> "Paul" == Paul David Fardy <pdf@morgan.ucs.mun.ca> writes:
merlyn> Or something else entirely. Remember, $0 is trivial to spoof... Perl
merlyn> even gives you the tools to do it:
merlyn>
merlyn> system { $what_I_want_dollar_0_to_say } $program, @args;
merlyn>
merlyn> It just happens that the shells *usually* put the program name
merlyn> in $0. But that's just a *usually*.
Paul> That should be
Paul> system { $program } $what_I_want_dollar_0_to_say, @args;
Paul> I just wanted to correct Randal, once. :-)
You know, I always get that backwards. So I wrote it that way first,
and then I said "no, I get this backwards" and reversed it!
Bleh. Bad brain. Naughty Naughty.
print "Just another Prell hacker," :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 20 Oct 2000 13:02:05 -0400
From: Martin McLaughlin <martin.mclaughlin@uvm.edu>
Subject: Re: Working w/ Hashes of Arrays w/in an object
Message-Id: <39F07A8D.192B62@uvm.edu>
Thank you. That was very helpful.
And... yes a reference is prefereable.
-Marty
Ala Qumsieh wrote:
> Martin McLaughlin <martin.mclaughlin@uvm.edu> writes:
>
> > I wonder if you could clarify my misconception with the following.
> >
> > I have a RateTable object and one of the properties (IDD_MAT) is a
> > hash. Each element of the hash is an array. In the show method, I can
> >
> > access the individual elements w/in the hash using the syntax:
> >
> > print "$self->{IDD_MAT}->{aaa}->[2]\n";
>
> I prefer to use the following syntax, since it's shorter:
>
> $self->{IDD_MAT}{aaa}[2]
>
> > But I would like to do something like the following:
> >
> > my %h = $self->{IDD_MAT}; #What do I need to do to access the
> > hash???
>
> You need to read perlref and perldsc! Then, the following will be
> obvious:
>
> my %h = %{$self->{IDD_MAT}};
>
> But why do you want to do that? If you do not intend to modify your
> hash, making a copy simply wastes memory. Moreover, any changes you make
> to %h will NOT be reflected back on the anonymous hash referred to by
> $self->{IDD_MAT}.
>
> > foreach my $key (keys %h) {
> > print "IDDMAT = $key value = %h->{$key}\n";}
>
> print "IDDMAT = $key value = $h{$key}\n";
>
> > Do you see where I've gone astray????? Any recommendations?
>
> You did not take the time to read the documentation and understand
> Perl's complex data structures. They are simple and staightforward once
> you understand them. I suggest you have a good look at the perlref and
> perldsc docs.
>
> --Ala
------------------------------
Date: Fri, 20 Oct 2000 16:30:10 -0000
From: Mark <MPEDDLE@uk.ibm.com>
Subject: Writing multiple files to a particular directory
Message-Id: <sv0soiiskqfi2a@corp.supernews.com>
Hi all,
Problem:
Attempting to process a number of files, then to write the output to a
specific directory.
open (FIXEDLOG, '>c:\baalogs\fixeddirectory\$fixed') or die "n\nCan not
open $fixed for write: $!\n\n";
I can see that the code overwrites each new file created, and I end up
with only the last file processed called $fixed.
But how do i ensure that the variable $fixed is recognised in this 'open'
line.
I know there is an easy answer, but have not managed to figure it out. Any
suggestions would be greatfully received - I have not had much joy with
the perldoc pages either.
Mark
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 20 Oct 2000 19:47:46 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Writing multiple files to a particular directory
Message-Id: <Qz%H5.8388$Tq1.308301@news010.worldonline.dk>
Mark wrote:
> Hi all,
>
> Problem:
> Attempting to process a number of files, then to write the output to a
> specific directory.
>
> open (FIXEDLOG, '>c:\baalogs\fixeddirectory\$fixed') or die "n\nCan not
> open $fixed for write: $!\n\n";
>
> I can see that the code overwrites each new file created, and I end up
> with only the last file processed called $fixed.
>
To apend to a file, do
open HANDLE ">>FILENAME";
perldoc -f open
> But how do i ensure that the variable $fixed is recognised in this 'open'
> line.
if (-f $fixed) { # do stuff if $fixed is a file...
# not that if $fixed is not the _complete_ filename,
# you should if ( -f "/path/to/$fixed")...
perldoc -f -X
for more on file tests
>
> I know there is an easy answer, but have not managed to figure it out. Any
> suggestions would be greatfully received - I have not had much joy with
> the perldoc pages either.
>
Hope this was what you were looking for..
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Fri, 20 Oct 2000 17:56:00 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Writing multiple files to a particular directory
Message-Id: <QG%H5.571$UK.144171@news.uswest.net>
Anders Lund <anders@wall.alweb.dk> elucidates:
>> open (FIXEDLOG, '>c:\baalogs\fixeddirectory\$fixed') or die "n\nCan not
>> open $fixed for write: $!\n\n";
>>
>> I can see that the code overwrites each new file created, and I end up
>> with only the last file processed called $fixed.
>>
> To apend to a file, do
>
> open HANDLE ">>FILENAME";
>> But how do i ensure that the variable $fixed is recognised in this 'open'
>> line.
Anders, take a closer look at the quoting used in the call to open().
To the OP, single quotes don't interpolate. Change them to double
quotes, and I think it will DWYM.
HTH!
--
"Civilization rests on two things: the discovery that fermentation
produces alcohol, and the voluntary ability to inhibit defecation.
And I put it to you, where would this splendid civilization be without
both?" --Robertson Davies "The Rebel Angels"
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4677
**************************************