[19824] in Perl-Users-Digest
Perl-Users Digest, Issue: 2019 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 26 18:05:41 2001
Date: Fri, 26 Oct 2001 15:05:10 -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: <1004133910-v10-i2019@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 26 Oct 2001 Volume: 10 Number: 2019
Today's topics:
Re: $ENV not defined <djberge@uswest.com>
Re: $ENV not defined (Lori Fleetwood)
Array initialization, what am I doing wrong? <jennifer.frank@ericsson.com>
Re: Automated html index ? <bart.lateur@skynet.be>
Control of parent shell <Tony_Armell@notes.teradyne.com>
Re: Control of parent shell (Chris Fedde)
Re: create tarball of perl (Stephen Patterson)
Even without binmode, txt file gets uploaded as BINARY (Etal)
Re: getting %errorlevel% values with perl? <e_kelleher@hotmail.com>
Re: hash slices through references (Malcolm Dew-Jones)
Re: IIS and Perl - Why the corruption? (Gordon McCreight)
Re: IIS and Perl - Why the corruption? <wyzelli@yahoo.com>
Re: IIS and Perl - Why the corruption? <joe+usenet@sunstarsys.com>
Is there Perl Binding to GNUPLOT (Krish)
Re: Is there Perl Binding to GNUPLOT (Chris Fedde)
LDAP & Persistent Data <vangrubt@uwec.edu>
Re: LDAP & Persistent Data (Chris Fedde)
Re: New user question <robtmil@ptd.net>
Perl expression to delete delimited bits of text in a l (wb0gaz)
Re: Print Question (file & cgi) <usenet@diefenba.ch>
Re: Print Question (file & cgi) <craigandbarbara@pacbell.net>
Re: problem of connection to a server FTP (Chris Fedde)
Re: Regular expression stumps me ... <stevea@wrq.com>
Re: Regular expression stumps me ... <bart.lateur@skynet.be>
surrogate utf-8 newbie problem (RonaldWS)
Web image tables <greenbd@u.washington.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 26 Oct 2001 13:29:14 -0500
From: Mr Sunblade <djberge@uswest.com>
Subject: Re: $ENV not defined
Message-Id: <3BD9AB7A.4B87F833@uswest.com>
Tad McClellan wrote:
> Lars Snith <lars.snith@inpactmicro.com> wrote:
> >OK, OK!
> >
> >Thanks for the help on the matter,
>
> You are the only person who knows who you are addressing.
>
>
Are you using a text based news reader? Doesn't the thread make this
obvious? Or isn't the whole thread available to some text based
readers? I'm curious about this piece of netiquette, since I've never
used a text based news reader (call me crazy).
Regards,
Mr. Sunblade
--
"Evil will always triumph because Good is *dumb*."
-- Dark Helmet, 'Spaceballs: The Movie'
------------------------------
Date: 26 Oct 2001 13:40:55 -0700
From: dlorraine@peoplepc.com (Lori Fleetwood)
Subject: Re: $ENV not defined
Message-Id: <35b9aa8f.0110261240.3472d53d@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrn9tiqcc.6q3.tadmc@tadmc26.august.net>...
> Lars Snith <lars.snith@inpactmicro.com> wrote:
> >OK, OK!
> >
> >Thanks for the help on the matter,
>
>
> You are the only person who knows who you are addressing.
>
> You should quote the text you're commenting on, or at the very least
<<SNIP (Pretentious bullshit)>>
Only an asshole like you would criticize somebody for thanking the
group. If Perl's motto is "There's more than one way to do it", then
why the hell do YOU insist "There's only one way to Usenet" on
comp.lang.perl.misc??
> Everybody makes mistakes. Just try and not make it the next time.
How charitable of you
<<SNIP: more pretentious bullshit>>
> >But reading up on the subject takes time, and I needed
> >to find a quick way
>
>
> Be very careful.
>
> That sounds like transfering your work to hundreds of others.
>
> I hope that isn't what happened.
How UNcharitable of you. What does he have to be "careful" about, if
it "is" what happened?
------------------------------
Date: Fri, 26 Oct 2001 14:40:06 -0700
From: "Jennifer Frank" <jennifer.frank@ericsson.com>
Subject: Array initialization, what am I doing wrong?
Message-Id: <9rcl7v$4bl$1@aken.eed.ericsson.se>
Hi,
I always get the message:
Use of uninitialized value at NOIS2XML.pl line 601.
When compiling the following code (only partial):
@temp = (" ") x @temp;
$tempType = " ";
print OUT "\n<!-- XML generated from the pdl files --> \n\n";
foreach $line (@lines)
{
$_ = $line;
s/&/AND/g; # Replace & by AND
@temp = split(" ",$line); # Split line at spaces
.
.
.
$tempType = $temp[1];
if ($temp[1] eq "byte") < This is line 601
{
$tempType = "U8";
}
if ($temp[1] eq "word16")
{
$tempType = "U16";
}
if ($temp[1] eq "word32")
{
$tempType = "U32";
}
.
.
.
}
I thought I am already initializing @temp, so what am I doing wrong.
Thanks in advance,
Jennifer
------------------------------
Date: Fri, 26 Oct 2001 21:06:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Automated html index ?
Message-Id: <fnjjttkb204blsvuvce19s1tjm3p2dikr1@4ax.com>
Leary wrote:
>While this provides a wealth of information and code to play with, I need to
>get the "title" and "updated" info from within each html doc, not the file
>mod time. I could really use a working example of using the HTML::Parser or
>other routine. I played with HTML::Parser quite a while yesterday and am not
>having much luck so far.
Check out HTML::HeadParser for a working example. That module serves
explicitely to extract the title and such. Granted, it's not really that
simple.
Also, have you seen Jonathan Stowe's sample code?
<http://www.gellyfish.com/htexamples/>
Finally: I find it a lot easier to wrap my brain around
HTML::TokeParser. In that case, code can look just like as if you're
reading from a file, line by line; except here, it is tag by tag, or
piece of plain text by piece of plain text (but not necessarily all of
it in one chunk).
--
Bart.
------------------------------
Date: Fri, 26 Oct 2001 14:15:18 -0400
From: Tony Armell <Tony_Armell@notes.teradyne.com>
Subject: Control of parent shell
Message-Id: <3BD9A835.C9912151@notes.teradyne.com>
Can the /bin/csh shell that executed a PERL script be controlled by that
PERL script?
Ex. A simple PERL/TK GUI to change directories where the c-shell follows
the GUI.
Tony
------------------------------
Date: Fri, 26 Oct 2001 20:24:08 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Control of parent shell
Message-Id: <IDjC7.168$X3.171314688@news.frii.net>
In article <3BD9A835.C9912151@notes.teradyne.com>,
Tony Armell <Tony_Armell@notes.teradyne.com> wrote:
>Can the /bin/csh shell that executed a PERL script be controlled by that
>PERL script?
>
>Ex. A simple PERL/TK GUI to change directories where the c-shell follows
>the GUI.
>
If such a thing were possible it would probably be a feature of the
c-shell. Maybe your question would find a better answer if you ask it in a
group that has the word "csh" somewhere in it's name.
Good Luck!
--
This space intentionally left blank
------------------------------
Date: Fri, 26 Oct 2001 19:35:16 BST
From: spam@freeuk.com (Stephen Patterson)
Subject: Re: create tarball of perl
Message-Id: <slrn9tjb8v.du.spam@localhost.localdomain>
On 25 Oct 2001 11:49:02 -0700, liping zhang wrote:
> I need to create a tarball containing a version of perl that can be
> used to install perl in usr/local. But I have to build and install in
> a different dir other than usr/local, and create tar ball from there.
> Could anyone give me a clue? Thanks.
If perl follows the usual GNU ./configure options (sorry I haven't got
the sources handy), you can supply a --prefix option to install perl
into a directory tree under some other directory.
--
Stephen Patterson http://home.freeuk.net/s.patterson/
s.patterson@SPAM.freeuk.com (remove spam to reply)
ICBM address 54-22-0N 0-28-0W
------------------------------
Date: 26 Oct 2001 14:28:55 -0700
From: colorful_98@yahoo.com (Etal)
Subject: Even without binmode, txt file gets uploaded as BINARY instead of ASCII
Message-Id: <370bfd7.0110261328.6601d210@posting.google.com>
I sent the day trying to get this to work. Read the manuals and the
news group. It should work but it does not.
I want to upload via browser a file from local drive to web. I NEED it
in ASCII. According to perl manual, "Regardless of platform, use
binmode() on binary files, and do not use binmode() on text files."
I tried with and without and my text file still uploads as binary. I
found this script on the newsgroup, it's very nice, but I can't get it
to upload in ASCII.
Does anyone have an idea?
<-- Start
#!/usr/bin/perl
use strict;
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
my $path = "/www/directory/where/it/goes";
print header, start_html("Upload files to server"),
h2("Upload files to server"),
start_multipart_form,
filefield(-name => 'file'),
submit(-value => 'Upload'),
endform;
my $file = param('file');
my $fn = $file; # $file is used as an FH, probably don't wanna change
it.
$fn =~ s,^.*(\\|/)(.+)$,$2,; # Extract filename from client path.
if ($fn =~ /^([-\@\w. ]+)$/) { # From perlsec.
$fn = $1; # $fn now untainted.
} else {
if($fn ne undef) { # Ignore if undef, probably first run.
die "'$fn' is an illegal filename.";
}
}
if (ref $file) {
open (OUT, ">$path$fn") or die "Could not write file '$path$fn':
$!\n";
while (my $bytesread=read($file,my $buffer,1024)) {
print OUT $buffer;
} print "'$fn' has been successfully sent to server."
}
print end_html;
-->
------------------------------
Date: Fri, 26 Oct 2001 16:00:35 -0400
From: ek <e_kelleher@hotmail.com>
Subject: Re: getting %errorlevel% values with perl?
Message-Id: <3BD9C0E3.DE71F416@hotmail.com>
I'm trying to write a test program for part a software utility being built
within my company. The utility is run from a command line and I'm trying to
write a perl script that will check that the developer is returning the
correct errorlevel value if something is typed incorrectly at the prompt (he
uses the %errorlevel% to store specific return values for this utility). The
values her returns using echo %errorlevel% depend on the last entry by the
user at the command prompt.
Any help and/or assistance would be greatly appreciated..
David Wall wrote:
> ek <e_kelleher@hotmail.com> wrote on 26 Oct 2001:
>
> > Tha's exactly what I'm looking to catch (the 2 value that echo
> > %errorlevel% returns after the dir rubbish) and cannot with perl. If,
> > as I said, I do it with a batch file it returns 2 from echo
> > %errorlevel% but perl returns zero. At the moment the only way I can
> > get around it is to call a 2-line batch file with perl but if at all
> > possible I need to get away from any dependency on batch files to make
> > it portable to Solaris.
>
> Without seeing your code, none of us here can offer much in the way of
> suggestions. (Assuming they're interested; some aren't because it
> involves MS Windows) What is the code you are using? What output or
> error messages do you get?
>
> Or maybe you could tell us more about what you're trying to do instead of
> the problems with the particular approach you've been trying? That might
> evoke some more useful suggestions than what I've been able to offer.
>
> --
> David Wall
> darkon@one.net
------------------------------
Date: 26 Oct 2001 11:48:41 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: hash slices through references
Message-Id: <3bd9b009@news.victoria.tc.ca>
Gopi Sundaram (gopalan@cs.sc.edu) wrote:
: Hello all,
: I have a hash-ref like so:
: $hashref = { one => 1, two => 2, three => 3, ...};
: Is there a clean way of taking a slice of this hash? Right now, I have
: this bletcherousness:
: @ar = @{%{$hashref}}{'one', 'three'};
"clean"?
local *hash = $hashref;
@ar = @hash{'one', 'three'};
------------------------------
Date: 26 Oct 2001 11:25:09 -0700
From: gordon@mccreight.com (Gordon McCreight)
Subject: Re: IIS and Perl - Why the corruption?
Message-Id: <4bd8a536.0110261025.65dd3cdc@posting.google.com>
"Wyzelli" <wyzelli@yahoo.com> wrote in message news:<AB3C7.27$5E3.429@wa.nnrp.telstra.net>...
> "Gordon McCreight" <gordon@mccreight.com> wrote in message
> news:4bd8a536.0110251745.1c7f0aa0@posting.google.com...
> > Hi All,
> > I've go the latest ActiveState Perl distribution running on a
> > Windows 2000 server. I am having issues with the results I'm getting
> > when executing perl scripts as CGIs from the browser. Specifically,
> > characters are getting corrupted. I wrote a test script. First it
> > writes the correct html header information, <html><body>, then 10,000
> > zeros, then the end of the page. It writes these all into a single
> > $output variable. Then I print the variable to both a file and to
> > stdout.
> >
> > The results in the file are perfect, but occasionally there is
> > corruption on the version that is printed to the web browser. If I do
> > a "view source" on the corrupted version, it will look somthing like
> > this snip... it should only be zeros.
> >
> > 00000000000000000y6w4ck000000000000000000000
> >
> > About 80% of the time everything works flawlessly... it's that 20%
> > that's driving me nuts.
> >
> > Can anyone explain to me why the file that gets written to disk has no
> > errors, but the one that gets returned to the browser has errors? Is
> > this a result of the interaction between perl and IIS? I have to
> > admit that I don't understand the nature of the beast.
>
> Have you unbuffered the output?
>
> Try putting
> $| = 1;
>
> At the top of your script.
>
> Wyzelli
Hi Wyzelli,
Thanks for your suggestion. In my case, I was building
everything into a variable and then printing the variable, so I don't
think the unbuffering would have made a difference, would it have?
Anyhow, I modified my code so that it printed as soon as it had
anything to print, rather than saving to a variable, and I still have
the same error as before. Any other thoughts?
Thanks - Gordon
------------------------------
Date: Sat, 27 Oct 2001 06:14:59 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: IIS and Perl - Why the corruption?
Message-Id: <5OjC7.1$qS3.102@wa.nnrp.telstra.net>
"Gordon McCreight" <gordon@mccreight.com> wrote in message
news:4bd8a536.0110261025.65dd3cdc@posting.google.com...
> "Wyzelli" <wyzelli@yahoo.com> wrote in message
news:<AB3C7.27$5E3.429@wa.nnrp.telstra.net>...
> > "Gordon McCreight" <gordon@mccreight.com> wrote in message
> > news:4bd8a536.0110251745.1c7f0aa0@posting.google.com...
> > > Hi All,
> > > I've go the latest ActiveState Perl distribution running on a
> > > Windows 2000 server. I am having issues with the results I'm getting
> > > when executing perl scripts as CGIs from the browser. Specifically,
> > > characters are getting corrupted. I wrote a test script. First it
> > > writes the correct html header information, <html><body>, then 10,000
> > > zeros, then the end of the page. It writes these all into a single
> > > $output variable. Then I print the variable to both a file and to
> > > stdout.
> > >
> > > The results in the file are perfect, but occasionally there is
> > > corruption on the version that is printed to the web browser. If I do
> > > a "view source" on the corrupted version, it will look somthing like
> > > this snip... it should only be zeros.
> > >
> > > 00000000000000000y6w4ck000000000000000000000
> > >
> > > About 80% of the time everything works flawlessly... it's that 20%
> > > that's driving me nuts.
> > >
> > > Can anyone explain to me why the file that gets written to disk has no
> > > errors, but the one that gets returned to the browser has errors? Is
> > > this a result of the interaction between perl and IIS? I have to
> > > admit that I don't understand the nature of the beast.
> >
> > Have you unbuffered the output?
> >
> > Try putting
> > $| = 1;
> >
> > At the top of your script.
> >
> > Wyzelli
>
> Hi Wyzelli,
> Thanks for your suggestion. In my case, I was building
> everything into a variable and then printing the variable, so I don't
> think the unbuffering would have made a difference, would it have?
> Anyhow, I modified my code so that it printed as soon as it had
> anything to print, rather than saving to a variable, and I still have
> the same error as before. Any other thoughts?
Yes, 'printing as soon as there is something to print', still only prints to
the buffer. I would turn buffering of (look up $| in perlvar) and see if
that makes a difference.
Web servers typically have their own buffering arrangements on their input
and output, which you cannot control, but your script you can.
Otherwise, we would need to see your actual code to be of more help. You
could try a group related to your server.
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: 26 Oct 2001 17:23:05 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: IIS and Perl - Why the corruption?
Message-Id: <m3ofmup03q.fsf@mumonkan.sunstarsys.com>
"Wyzelli" <wyzelli@yahoo.com> writes:
> "Gordon McCreight" <gordon@mccreight.com> wrote in message
> > Thanks for your suggestion. In my case, I was building
> > everything into a variable and then printing the variable, so I don't
> > think the unbuffering would have made a difference, would it have?
> > Anyhow, I modified my code so that it printed as soon as it had
> > anything to print, rather than saving to a variable, and I still have
> > the same error as before. Any other thoughts?
>
> Yes, 'printing as soon as there is something to print', still only prints to
> the buffer. I would turn buffering of (look up $| in perlvar) and see if
> that makes a difference.
>
> Web servers typically have their own buffering arrangements on their input
> and output, which you cannot control, but your script you can.
>
> Otherwise, we would need to see your actual code to be of more help. You
> could try a group related to your server.
This sounds more like a C problem than a Perl one- assuming he
has eliminated the possibility of browser corruption (which is a real
possibility if he's using NS4* for testing), it looks to me like his
webserver is reusing the same memory area for more than one data
structure. If possible, OP might try switching to a better quality
webserver, or as you suggest, asking again in the appropriate
server/browser newsgroup.
--
Joe Schaefer "In order to form an immaculate member of a flock of sheep one
must, above all, be a sheep."
--Albert Einstein
------------------------------
Date: 26 Oct 2001 13:02:45 -0700
From: skrishnan@snet.net (Krish)
Subject: Is there Perl Binding to GNUPLOT
Message-Id: <87e66aa2.0110261202.57db14f1@posting.google.com>
Thanks
------------------------------
Date: Fri, 26 Oct 2001 20:29:50 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Is there Perl Binding to GNUPLOT
Message-Id: <2JjC7.169$X3.188719616@news.frii.net>
In article <87e66aa2.0110261202.57db14f1@posting.google.com>,
Krish <skrishnan@snet.net> wrote:
>Thanks
sudo perl -MCPAN -e shell
[...]
cpan> m /gnuplot/
[...]
Module Chart::GnuPlot (Contact Author Nick Peskett
<cpan@peskett.com>)
Module Chart::Graph::Gnuplot (M/MH/MHYOUNG/Chart-Graph-1.1.tar.gz)
Module Geo::GNUPlot (C/CA/CARPENTER/Geo-GNUPlot_0.01.tar.gz)
Module Term::Gnuplot (I/IL/ILYAZ/Term-Gnuplot-0.5701.tar.gz)
Good Luck
--
This space intentionally left blank
------------------------------
Date: Fri, 26 Oct 2001 14:19:28 -0500
From: "Brian" <vangrubt@uwec.edu>
Subject: LDAP & Persistent Data
Message-Id: <9rcd04$eou$1@wiscnews.wiscnet.net>
Well, here it goes ... I am retrieving address info from an LDAP server.
From this I am assigning the returned data to a spot in an array. Like so:
$streetAddress[$index] = $entry->get_value( 'streetAddress' );
A print of $streetAddress returns the correct data. For Example "311 Horan
Hall". However When I submit it in a form ... like I am here:
print "<form METHOD=\"POST\"
ACTION=\"HTTP://blahblah.blah.com/cgi-bin/into.pl\">";
print "<input type=hidden name=\"sdorm\"
value=$streetAddress[$index]>";
I am only getting part of the address data when I do this:
print $data{'sdorm'}
This would return only 311. Anyone had any similar problems or have any
ideas. Any info would be greatly appreciated!
------------------------------
Date: Fri, 26 Oct 2001 19:43:15 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: LDAP & Persistent Data
Message-Id: <n1jC7.164$X3.190937088@news.frii.net>
In article <9rcd04$eou$1@wiscnews.wiscnet.net>,
Brian <vangrubt@uwec.edu> wrote:
>Well, here it goes ... I am retrieving address info from an LDAP server.
>From this I am assigning the returned data to a spot in an array. Like so:
>
>$streetAddress[$index] = $entry->get_value( 'streetAddress' );
>
>A print of $streetAddress returns the correct data. For Example "311 Horan
>Hall". However When I submit it in a form ... like I am here:
>
> print "<form METHOD=\"POST\"
>ACTION=\"HTTP://blahblah.blah.com/cgi-bin/into.pl\">";
> print "<input type=hidden name=\"sdorm\"
>value=$streetAddress[$index]>";
>
>I am only getting part of the address data when I do this:
>
>print $data{'sdorm'}
>
>This would return only 311. Anyone had any similar problems or have any
>ideas. Any info would be greatly appreciated!
>
You are not quoting the value= properly. Look at using
print qq{stuff with "quotes" in it};
Good Luck
--
This space intentionally left blank
------------------------------
Date: Fri, 26 Oct 2001 18:18:07 GMT
From: "Robt. Miller" <robtmil@ptd.net>
Subject: Re: New user question
Message-Id: <Pine.LNX.4.21.0110261416230.31013-100000@localhost>
Works as hoped after the appropriate modifications. Thanks for the
inspiration!
On Fri, 26 Oct 2001, Mina Naguib wrote:
> #!/usr/bin/perl
>
> use strict;
>
> my $directory = "/home/mina/music";
> my $player = "/bin/wavplay";
> my $maxwait = 3600;
>
> my @T;
> my $filename;
> my $temp;
>
> fork && exit;
>
> while (1) {
> sleep(rand($maxwait));
> opendir(DH, $directory) || die "Error opendir() $directory: $!\n";
> while ($filename = readdir(DH)) {
> if ($filename =~ /\.wav$/i) {
> push (@T, $filename);
> }
> }
> closedir(DH);
> $filename = $T[rand(@T)] || next;
> $filename = "$directory/$filename";
> $temp = fork();
> if ($temp == 0) {
> exec("$player $filename");
> exit;
> }
> elsif (!defined $temp) {
> die "Error forking: $!\n";
> }
> }
>
> #############################
> #
> # The above was written in 2.5 minutes with clearness in mind, and has not
> been tested even for syntax.
> # Now go learn perl.
------------------------------
Date: 26 Oct 2001 14:56:42 -0700
From: wb0gaz@hotmail.com (wb0gaz)
Subject: Perl expression to delete delimited bits of text in a line (help)
Message-Id: <7670fd52.0110261356.64898a61@posting.google.com>
Given the string ABC<DEF>GHI<JKL>MNO I want to eliminate
the <DEF> and <JKL> leaving the rest intact. My attempt has
produced unwanted results of ABCMNO (basically the < and >
given below as the "ends" of my pattern work out-to-in rather
than left-to-right, in my layman's terms.)
What am I doing wrong?
(FYI it's part of a routine to partially clean out HTML
tags, which I'm sure is a common thing to do, but I also would
like to learn from this misfortune...)
Tnx,
Dave
MY ATTEMPT:
$try =~ s/<.*>//g;
------------------------------
Date: 26 Oct 2001 22:02:59 +0200
From: Kai Diefenbach <usenet@diefenba.ch>
Subject: Re: Print Question (file & cgi)
Message-Id: <bnelnqmaoc.fsf@diefenba.ch>
Hi,
>>>>> "craig" == craig <craigandbarbara@pacbell.net> writes:
craig> select(NEW1);
here you set NEW1 to default filehandle
craig> close(NEW1) or die "can't close $new: $!";
here you close NEW1
craig> print "\n<br>$old file has been processed";
here you print to the default (now closed) filehandle NEW1,
and ...
craig> #this gives this error
craig> #generateKeyTest.pl: print() on closed filehandle main::NEW1 at
craig> generateKeyTest.pl line 61.
perldoc -f select
Regards Kai
------------------------------
Date: Fri, 26 Oct 2001 11:47:41 -0700
From: craig <craigandbarbara@pacbell.net>
Subject: Re: Print Question (file & cgi)
Message-Id: <3BD9AFCD.1F183C00@pacbell.net>
Kai:
Thanks for the tip, I just removed the unnecessary select statements and
it now works.
Craig
Kai Diefenbach wrote:
> Hi,
> >>>>> "craig" == craig <craigandbarbara@pacbell.net> writes:
>
> craig> select(NEW1);
>
> here you set NEW1 to default filehandle
>
> craig> close(NEW1) or die "can't close $new: $!";
>
> here you close NEW1
>
> craig> print "\n<br>$old file has been processed";
>
> here you print to the default (now closed) filehandle NEW1,
> and ...
>
> craig> #this gives this error
> craig> #generateKeyTest.pl: print() on closed filehandle main::NEW1 at
> craig> generateKeyTest.pl line 61.
>
> perldoc -f select
>
> Regards Kai
------------------------------
Date: Fri, 26 Oct 2001 20:20:05 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: problem of connection to a server FTP
Message-Id: <VzjC7.167$X3.189626368@news.frii.net>
In article <20011026-142251-342092@foorum.com>, christophe
<clelan@tf1.fr> wrote:
>
>hello everybody i have a problem of connexion to a server FTP when i
>run my script (who sould conect to a ftp server) on a IIS server, there
>is no problem but when i run this script on a apche server (on a sun),
>my script
>
>doesn't succed to connect to this FTP server
>
>i connect to this server as
>
>$HOSTSOURCE="IP du serveur FTP";
>$LOGINSOURCE=*********;
>$PASSWDSOURCE=********;
>
>my $ftp1=Net::FTP->new($HOSTSOURCE,Passive=>1);
>
I may have inverted your problem over in my head... If I recall
correctly the IIS server has a built in FTP server? Is that true? Apache
does not. A separate ftp server is need with apache. Have I come close
to understanding the issue?
Good Luck
--
This space intentionally left blank
------------------------------
Date: Fri, 26 Oct 2001 18:56:01 GMT
From: Steve Allan <stevea@wrq.com>
Subject: Re: Regular expression stumps me ...
Message-Id: <m34rom1ba0.fsf@vhilx.wrq.com>
marlon_jackson@yahoo.com (Marlon Jackson) writes:
>I can't figure out what this line does:
>
> $build_dir =~ s|^.*/$source_root/||o;
Others have answered the OP's question, but I'm curious about the
usefulness of anchoring a regular expression to '0 or more occurances
of any character'. Is there a dirrence btw
s|^.*/$source_root/||o;
and
s|.*/$source_root/||o;
that I'm not seeing?
--
-- Steve __
------------------------------
Date: Fri, 26 Oct 2001 20:59:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regular expression stumps me ...
Message-Id: <9hjjtt0h4h3g4fd3lto0iv3fsvkv4v1g7q@4ax.com>
Steve Allan wrote:
>I'm curious about the
>usefulness of anchoring a regular expression to '0 or more occurances
>of any character'. Is there a dirrence btw
>
> s|^.*/$source_root/||o;
>
>and
>
> s|.*/$source_root/||o;
>
>that I'm not seeing?
Prevention of useless backtracking in case of a failure to match. In
this case, this could even happen if there is no slash in the string.
Without the anchor, the regex might be tempted to try again starting
with every character of the string. With the anchor, it will try only
once.
--
Bart.
------------------------------
Date: 26 Oct 2001 20:45:41 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: surrogate utf-8 newbie problem
Message-Id: <20011026164541.23731.00000038@mb-fj.aol.com>
I am using Perl to read utf-8 data from stream handles mostly
in a windows 2000 environment. I "use bytes;" and try and make
sure I read in the data in bytes and then re-assemble
the data later into unicode/utf-8. I seem to be doing OK
with greek, hebrew, cyrillic, korean, chinese, etc. but
not farsi and related languages. For the problem languages the
stream of data looks like it's all comming in as unicode
high surrogates and Perl is refusing to process them. A
sample dump from a file of farsi utf-8 follows:
0ACD:01A0 64 79 20 62 67 63 6F 6C-6F 72 3D 22 57 68 69 74 dy bgcolor="Whit
0ACD:01B0 65 22 3E 0D 0A 20 3C 62-72 3E 0D 0A 20 20 20 20 e">.. <br>..
0ACD:01C0 D8 B3 D9 8A D9 86 D8 A8-D9 86 D8 AA D8 B3 D9 8A ................
0ACD:01D0 D8 AA D8 A8 D8 AA D8 B3-D9 85 D9 86 D9 8A D8 AA ................
0ACD:01E0 D8 A8 D9 86 D9 85 D8 B3-20 20 20 20 20 20 20 3C ........ <
0ACD:01F0 62 72 3E 0D 0A 20 3C 62-72 3E 0D 0A 20 0D 0A 3C br>.. <br>.. ..<
The file was created with netscape 6 and notepad is happy
to read it and treat it as UTF-8. When I try to use functions
like ord and uc in perl they complain about UTF-16 surrogates
and don't work. Ord being the harder to work around of the
two (no unpack('U') doesn't work either).
The sample can be found at http://www.software-path2.com/cwduni/fsi.htm but you
may need to manually set your browser to charset of utf-8 to see it properly.
I am not familiar with these languages and may be missing
some basic concepts because of that. In general my processing
does not require much understanding of the language.
Any thoughts, explanations, or solutions?
Ronald Schmidt
RonaldWS@software-path.com
(cc to above email will be helpful)
------------------------------
Date: Fri, 26 Oct 2001 14:39:47 -0700
From: "Brian D. Green" <greenbd@u.washington.edu>
Subject: Web image tables
Message-Id: <Pine.A41.4.33.0110261427180.20858-100000@dante35.u.washington.edu>
Hello,
I'm trying to simplify my online photo galleries by writing a Perl script
to generate the tables of thumbnails. How would I make the script begin a
new row after every seventh cell? My script is below.
###
#!/usr/local/bin/perl
use CGI ':standard';
print "Content-type:text/html\n\n";
$id = param('id');
$id++;
open (IN, "foxfield.dat"); # simple db file w/ filenames & alt tags
@lines = <IN>;
close (IN);
foreach $i (@lines) {
chomp($i);
($name,$alt) = split (/\|/,$i);
$pic = $id++;
print<<thumbnail;
<td class="img3">
<a href="gallery.cgi?id=$pic">
<img src="s/$name.jpg" alt="$alt">
</a>
</td>
thumbnail
}
###
I've tried things such as sticking
for ($pic = 5){
print "\n</tr>\n\n<tr>\n";
}
inside the foreach loop, but that just makes a new row for each image.
I'd appreciate any help!
Thanks,
Brian Green http://www.briangreen.org/
O-----------------------------------------------------------------------O
|"I am not ashamed of the gospel, because it is the power of God for the|
| salvation of everyone who believes: first for the Jew, then for the |
| Gentile." --Romans 1:16, NIV |
O-----------------------------------------------------------------------O
------------------------------
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.
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 2019
***************************************