[28419] in Perl-Users-Digest
Perl-Users Digest, Issue: 9783 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 29 18:05:48 2006
Date: Fri, 29 Sep 2006 15:05:05 -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 Fri, 29 Sep 2006 Volume: 10 Number: 9783
Today's topics:
Re: can't locate method new IO::Socket::INET <brent.honadel@lawson.com>
Re: can't locate method new IO::Socket::INET <bik.mido@tiscalinet.it>
Re: failure to build perl 5.8.8 <david.bear@asu.edu>
Re: failure to build perl 5.8.8 <sherm@Sherm-Pendleys-Computer.local>
Re: failure to build perl 5.8.8 <david.bear@asu.edu>
Re: FAQ 2.6 What modules and extensions are available f <brian.d.foy@gmail.com>
Re: FAQ 3.1 How do I do (anything)? <tzz@lifelogs.com>
Re: FAQ 4.34 How do I extract selected columns from a s <jgibson@mail.arc.nasa.gov>
Re: FTP from Perl script on Windows <veatchla@yahoo.com>
Re: FTP from Perl script on Windows <ilackic@yahoo.com>
Re: FTP from Perl script on Windows <benmorrow@tiscali.co.uk>
Re: ImageMagick and Perl <bik.mido@tiscalinet.it>
Re: ImageMagick and Perl <noreply@gunnar.cc>
Re: My first socket question <bik.mido@tiscalinet.it>
Re: My first socket question <jgibson@mail.arc.nasa.gov>
Re: Post to https using perl script <Juha.Laiho@iki.fi>
Re: Questions about Inline::C <january.weiner@gmail.com>
Re: Questions about Inline::C <january.weiner@gmail.com>
Writing to a Parsed Excel Spreadsheet <pamelapdh@aol.com>
Re: Writing to a Parsed Excel Spreadsheet <glex_no-spam@qwest-spam-no.invalid>
Re: Writing to a Parsed Excel Spreadsheet <pamelapdh@aol.com>
Re: Writing to a Parsed Excel Spreadsheet <jgibson@mail.arc.nasa.gov>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Sep 2006 06:46:37 -0700
From: "ten8ciousb" <brent.honadel@lawson.com>
Subject: Re: can't locate method new IO::Socket::INET
Message-Id: <1159537597.230410.102460@e3g2000cwe.googlegroups.com>
Sisyphus wrote:
> "ten8ciousb" <brent.honadel@lawson.com> wrote in message
> .
> .
> >
> > use IO::Socket;
> > use IO::Socket::INET;
> >
> > $sock = IO::Socket::INET->new(
> > PeerAddr => $host,
> > PeerPort => $port,
> > Proto => 'tcp',
> > );
> >
>
> Pretty much stumped by this. (The *full* error message as a copy'n'paste
> could be helpful as that would remove *all* guesswork on our part.)
>
> Normally you don't 'use IO::Socket::INET;' - you just 'use IO::Socket;'. I
> can't think of why that would stuff things up, but it's a change you could
> try.
>
> Cheers,
> Rob
Thanks for the reply.
It originally just had use IO::Socket, I added the use
IO::Socket::INET, just to make sure it was loaded.
I've added a die handler that prints a stack trace which I'm hoping
gives a little more information than just the "or die print $!"; So,
now I'm just waiting for it to fail again.
Here's another little bit of information, which also doesn't make sense
to me.
This problem happened at the same site over 2 1/2 years ago. Because
the script creates mutiple sockets, I wasn't sure which subroutine it
was in when it died. So, I added some print "in sub xxxx" statements
to each subroutine. While running with that "debug" script, the error
didn't occur. All I did was add print statements. Now, same site but
a new server and the print statements aren't helping anymore.
------------------------------
Date: 29 Sep 2006 17:43:51 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: can't locate method new IO::Socket::INET
Message-Id: <3ofqh2pdnu6esbudegohs6jd7njgieecu6@4ax.com>
On 29 Sep 2006 06:46:37 -0700, "ten8ciousb" <brent.honadel@lawson.com>
wrote:
>gives a little more information than just the "or die print $!"; So,
I know it's probably just a typo, but you know that, although strictly
speking syntactically correct, that should really be "or die $!",
don't you?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 29 Sep 2006 10:24:37 -0700
From: David Bear <david.bear@asu.edu>
Subject: Re: failure to build perl 5.8.8
Message-Id: <1795469.YYH1LiBARm@teancum>
Sherm Pendley wrote:
> David Bear <david.bear@asu.edu> writes:
>
>> I am using Suse Linux 9.3. Perl 5.8.6 is the version of perl installed.
>> However, I have some perl code that a vender gave me that they insist
>> only works with perl 5.8.8.
>
> I'd verify their claim. "Not supported" doesn't necessarily mean "Doesn't
> work" - quite often it simply means that the supported configurations are
> the only ones the vendor has tested.
>
This is exactly what I am trying to do. Their pm doesn't work generating a
crypto-hash. I've sent their pm back to them and they insist it works for
them on perl 5.8.8 - I have no choice but to install v 5.8.8 and see. I
think they are lying to me.
>> changed the prefix to be /work/servers/webenv and ran make. Make bombed
>> with the error:
>>
>> `sh cflags "optimize='-O2'" opmini.o` -DPERL_EXTERNAL_GLOB opmini.c
>> CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe
>> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2
>> -Wall cc -L/usr/local/lib -o miniperl \
>> miniperlmain.o opmini.o libperl.a
>> libperl.a(pp.o)(.text+0x9033): In function `Perl_pp_int':
>> pp.c: undefined reference to `floor'
>
> Floor() and the other functions you're missing are all in libm, so add
> "-lm" to the linker flags.
Can I do this in the Configure script with -Dlm ?
>
> sherm--
>
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
------------------------------
Date: Fri, 29 Sep 2006 14:10:10 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: failure to build perl 5.8.8
Message-Id: <m2psdesfwd.fsf@Sherm-Pendleys-Computer.local>
David Bear <david.bear@asu.edu> writes:
> Sherm Pendley wrote:
>
>> David Bear <david.bear@asu.edu> writes:
>>
>>> changed the prefix to be /work/servers/webenv and ran make. Make bombed
>>> with the error:
>>>
>>> `sh cflags "optimize='-O2'" opmini.o` -DPERL_EXTERNAL_GLOB opmini.c
>>> CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe
>>> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2
>>> -Wall cc -L/usr/local/lib -o miniperl \
>>> miniperlmain.o opmini.o libperl.a
>>> libperl.a(pp.o)(.text+0x9033): In function `Perl_pp_int':
>>> pp.c: undefined reference to `floor'
>>
>> Floor() and the other functions you're missing are all in libm, so add
>> "-lm" to the linker flags.
>
> Can I do this in the Configure script with -Dlm ?
Close, but not quite. :-) It's -Dldflags=-lm
It's kind of odd that Configure didn't pick that up automagically - you might
want to verify that you actually do have either libm.so or libm.a installed -
it's a system library, so you should find it in /usr/lib.
If SuSE uses a static libm, then it might be in a -dev package that isn't
installed on your system.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Fri, 29 Sep 2006 12:35:21 -0700
From: David Bear <david.bear@asu.edu>
Subject: Re: failure to build perl 5.8.8
Message-Id: <1832002.zutTOhO3zx@teancum>
Sherm Pendley wrote:
> David Bear <david.bear@asu.edu> writes:
>
>> Sherm Pendley wrote:
>>
>>> David Bear <david.bear@asu.edu> writes:
>>>
>>>> changed the prefix to be /work/servers/webenv and ran make. Make bombed
>>>> with the error:
>>>>
>>>> `sh cflags "optimize='-O2'" opmini.o` -DPERL_EXTERNAL_GLOB opmini.c
>>>> CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe
>>>> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2
>>>> -Wall cc -L/usr/local/lib -o miniperl \
>>>> miniperlmain.o opmini.o libperl.a
>>>> libperl.a(pp.o)(.text+0x9033): In function `Perl_pp_int':
>>>> pp.c: undefined reference to `floor'
>>>
>>> Floor() and the other functions you're missing are all in libm, so add
>>> "-lm" to the linker flags.
>>
>> Can I do this in the Configure script with -Dlm ?
>
> Close, but not quite. :-) It's -Dldflags=-lm
>
> It's kind of odd that Configure didn't pick that up automagically - you
> might want to verify that you actually do have either libm.so or libm.a
> installed - it's a system library, so you should find it in /usr/lib.
>
> If SuSE uses a static libm, then it might be in a -dev package that isn't
> installed on your system.
>
I did the interactive configure again, paying close attention to questions
dealing with link flags. I had to include /usr/lib64 in one of the question
(I forgot which) but after that make and make test ran spendid. Must be a
Suse thing with mixed 32/64 bit libraries?
> sherm--
>
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
------------------------------
Date: Fri, 29 Sep 2006 15:16:11 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 2.6 What modules and extensions are available for Perl? What is CPAN? What does CPAN/src/... mean?
Message-Id: <290920061516115410%brian.d.foy@gmail.com>
In article <280920061200069993%jgibson@mail.arc.nasa.gov>, Jim Gibson
<jgibson@mail.arc.nasa.gov> wrote:
> In article <6guqu3-omc.ln1@blue.stonehenge.com>, PerlFAQ Server
> <brian@stonehenge.com> wrote:
>
> > --------------------------------------------------------------------
> >
> > 2.6: What modules and extensions are available for Perl? What is CPAN?
> > What
> > Considering that there are close to two thousand existing modules in the
> > archive, one probably exists to do nearly anything you can think of.
>
> I think this number is seriously out-of-date,
Yes, it's out of date and I'll fix that.
Thanks,
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Fri, 29 Sep 2006 14:38:07 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: FAQ 3.1 How do I do (anything)?
Message-Id: <g69r6xuplgw.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 29 Sep 2006, usenet@davidfilmer.com wrote:
Michele Dondi wrote:
>> Use the Everything bundle from CPAN.
>
> Has anyone EVER actually installed that? Without force, I mean...
That should be a Perl Purity Test question, no doubt.
Ted
------------------------------
Date: Fri, 29 Sep 2006 14:55:57 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: FAQ 4.34 How do I extract selected columns from a string?
Message-Id: <290920061455577201%jgibson@mail.arc.nasa.gov>
In article <6870v3-sje.ln1@blue.stonehenge.com>, PerlFAQ Server
<brian@stonehenge.com> wrote:
> This is an excerpt from the latest version perlfaq4.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
>
> --------------------------------------------------------------------
>
> 4.34: How do I extract selected columns from a string?
>
> Use "substr()" or "unpack()", both documented in perlfunc. If you prefer
> thinking in terms of columns instead of widths, you can use this kind of
> thing:
>
> # determine the unpack format needed to split Linux ps output
> # arguments are cut columns
> my $fmt = cut2fmt(8, 14, 20, 26, 30, 34, 41, 47, 59, 63, 67, 72);
>
> sub cut2fmt {
> my(@positions) = @_;
> my $template = '';
> my $lastpos = 1;
> for my $place (@positions) {
> $template .= "A" . ($place - $lastpos) . " ";
> $lastpos = $place;
> }
> $template .= "A*";
> return $template;
> }
Wouldn't it be a good idea to mention "split" here? Something like:
Use "split()" if the columns are of variable width and separated by
whitespace or some other delimiter.
my $line = ' a b c ';
my @fields = split /\s+/, $line; # concatenates empty fields
# @fields = ( '', 'a', 'b', 'c' );
my $csvline = 'a,,c,,e,f';
my @csv_fields = split /,/, $csvline; # preserves empty fields
# @csvfields = ( 'a', '', 'c', '', 'e', 'f' );
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Fri, 29 Sep 2006 08:47:07 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: FTP from Perl script on Windows
Message-Id: <1159537705_3685@sp6iad.superfeed.net>
Ivan L wrote:
> I know about %windir% environment variable. However, there is no protocol file (or
> folder) in the c:\Windows\System32\drivers\etc\ There are, however, several files
> named services (services, services01, services02 ...) that happen to be empty.
>
>
>
> "Dr.Ruud" <rvtol+news@isolution.nl> wrote in news:efhvc9.1go.1@news.isolution.nl:
>
>> l v schreef:
>>> Ivan L:
>>>> [attribution corrupted]
>>>>> [attribution corrupted]
>>>>>> "Cannot connect to host: Net::FTP: Bad protocol 'tcp' at
>>>>>> ftptest1.pl line 3."
>>>>> Check out the file "%windir%\system32\drivers\etc\protocol".
>>>> There is no "%windir%\system32\drivers\etc\protocol" file on my
>>>> machine.
>>> s/protocol/services/
>> The error message was "Bad protocol 'tcp'".
>> The "services" file contains a list of names for selected port/protocol
>> combinations.
>>
>> Ivan, did you understand "%windir%"? It's an environment variable that
>> has the value "C:\WINNT" on some systems, "C:\Windows" on other systems,
>> and other values on yet other systems. Go to a command prompt and enter
>> "set" to get the value on your system.
>>
>
Your services file should not be empty. I'd try to help further but Ben
Morrow advises me not to do so.
--
Len
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Fri, 29 Sep 2006 15:50:06 +0000 (UTC)
From: Ivan Lackic <ilackic@yahoo.com>
Subject: Re: FTP from Perl script on Windows
Message-Id: <Xns984DB57BDC832ilac@195.29.150.88>
I have tried to run your FTP script on some other machine and it worked well. I guess
that it is a matter of some XP setting or some security programs running on the first
machine...
regards,
I.
"Sisyphus" <sisyphus1@nomail.afraid.org> wrote in
news:451cc139$0$11971$afc38c87@news.optusnet.com.au:
>
> "Ivan L" <ilackic@yahoo.com> wrote in message
> news:Xns984C73F311E2Bivanlac@213.191.133.136...
>> Hi Sisyphus,
>> Unfortunately the result is the same - the message is :
>> Cannot connect to host: Net::FTP: Bad protocol 'tcp' at
> C:\PROGRA~1\PERLEX~1\Scripts
>> \FTPPER~1.PL line 4.
>> I copied your script and put my host name...
>>
>
> It was my intention that you use that script as is. (You should be
> able to connect to that ftp server.)
>
> However, I get the feeling that the other respondents might be pushing
> you in a more pertinent direction.
>
> Cheers,
> Rob
>
>
------------------------------
Date: Fri, 29 Sep 2006 22:29:18 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: FTP from Perl script on Windows
Message-Id: <eqf0v3-vph.ln1@osiris.mauzo.dyndns.org>
[please don't top-post]
Quoth Ivan L <ilackic@yahoo.com>:
> I know about %windir% environment variable. However, there is no
> protocol file (or
> folder) in the c:\Windows\System32\drivers\etc\ There are, however,
> several files
> named services (services, services01, services02 ...) that happen to be empty.
That directory should have (or at least, my Win2k installation has)
files called hosts, lmhosts.sam, networks, protocol, and services. They
should have at least the following entries:
hosts
127.0.0.1 localhost
networks
loopback 127
protocol
ip 0 IP
icmp 1 ICMP
tcp 6 TCP
udp 17 UDP
services
# a whole list of standard services
If they don't, the networking part of your windows install is severely
broken, and you need to fix it before you can use sockets with Perl.
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one. [benmorrow@tiscali.co.uk]
'We come in peace'---the order came to cut them down.
------------------------------
Date: 29 Sep 2006 17:48:34 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: ImageMagick and Perl
Message-Id: <qqfqh2dsrg4755h1ouqrq5e4kmqsbi8upg@4ax.com>
On Fri, 29 Sep 2006 14:02:45 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>> How 'bout checking the return value of Write(), which should be the
>> number of images (successfully) written?
>
>Are you sure of that? Please see the examples posted by me and zentara.
No, but that's what's written in the documentation.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 29 Sep 2006 18:23:09 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: ImageMagick and Perl
Message-Id: <4o4vjhFcurdpU1@individual.net>
Michele Dondi wrote:
> Gunnar Hjalmarsson wrote:
>>>How 'bout checking the return value of Write(), which should be the
>>>number of images (successfully) written?
>>
>>Are you sure of that? Please see the examples posted by me and zentara.
>
> No, but that's what's written in the documentation.
The documentation isn't all that easy to understand. Please compare
http://www.imagemagick.org/script/perl-magick.php#read
and
http://www.imagemagick.org/script/perl-magick.php#exceptions
Guess everybody is right. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 29 Sep 2006 17:30:27 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: My first socket question
Message-Id: <mqbqh21ee098515lnmvbepgn398b17snei@4ax.com>
On 28 Sep 2006 15:47:00 -0700, "jl_post@hotmail.com"
<jl_post@hotmail.com> wrote:
>time, continue to listen for other clients trying to connect, you might
>want to try fork()ing, like this:
In the meanwhile I've been experimenting with your proposed solution
for learning purposes. First of all I realized that the
close $server or die "Cannot stop server mode: $!\n";
line in my previous post was never reached, and indeed I was getting
quite a lot of 'Address already in use' errors, albeit on a somewhat
random basis. I'm not really sure if failure to reach that line was
the actual cause of the problem, but it *seems* to be gone away after
I modified the code as follows:
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
use constant PORT => 9000;
if (@ARGV) {
my $sock=IO::Socket::INET->new(PeerAddr => 'localhost',
PeerPort => PORT,
Proto => 'tcp') or
die "Cannot connect to server: $!\n";
my $cmd=shift;
print "Client mode, sending command `$cmd'\n";
print $sock "$cmd\r\n";
print scalar <$sock>;
close $sock or die "Cannot disconnect from server: $!\n";
exit;
}
my $server=IO::Socket::INET->new(Listen => 5,
LocalPort => PORT,
Proto => 'tcp') or
die "Cannot start in server mode: $!\n";
print "Server mode\n";
$SIG{INT}=$SIG{TERM}=sub {
close $server or
die "Cannot stop server mode: $!\n";
exit;
};
while ( my $client=$server->accept ) {
(my $cmd=<$client>) =~ tr/\r\n//d;
my %answer=(foo => "foo: that's what I wanted!");
print $client
$answer{$cmd} || "Unknown command: `$cmd'", "\r\n";
}
__END__
Let the above script be cs1.pl; then I created a modified, forking
version of it and tested both of them as follows:
$ diff -u cs*.pl
--- cs1.pl 2006-09-29 15:46:28.662294000 +0200
+++ cs2.pl 2006-09-29 15:46:32.950562000 +0200
@@ -31,11 +31,15 @@
exit;
};
+$SIG{CHLD}='IGNORE';
+
while ( my $client=$server->accept ) {
+ next if fork;
(my $cmd=<$client>) =~ tr/\r\n//d;
my %answer=(foo => "foo: that's what I wanted!");
print $client
$answer{$cmd} || "Unknown command: `$cmd'", "\r\n";
+ exit;
}
__END__
$ ./cs1.pl &
[1] 11781
$ Server mode
$ time for a in $(seq 1 1000); do ./cs1.pl foo >/dev/null; done
real 0m48.784s
user 0m42.407s
sys 0m6.036s
$ kill %1
$ ./cs2.pl &
[2] 12786
[1] Done ./cs1.pl
$ Server mode
time for a in $(seq 1 1000); do ./cs2.pl foo >/dev/null; done
real 0m52.490s
user 0m42.999s
sys 0m5.732s
Please note that I do not claim nor expect this to be a reliable test,
just one to give a rough indication. And the rough indication here
seems to be that *in this particular case* the fork()ing approach
doesn't gain one much. Of course I have not doubt that it would gain
quite a lot, were the server's response to take more time, as it would
actually happen in a more realistic example...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 29 Sep 2006 09:35:27 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: My first socket question
Message-Id: <290920060935277612%jgibson@mail.arc.nasa.gov>
In article <mqbqh21ee098515lnmvbepgn398b17snei@4ax.com>, Michele Dondi
<bik.mido@tiscalinet.it> wrote:
> On 28 Sep 2006 15:47:00 -0700, "jl_post@hotmail.com"
> <jl_post@hotmail.com> wrote:
>
> >time, continue to listen for other clients trying to connect, you might
> >want to try fork()ing, like this:
>
> In the meanwhile I've been experimenting with your proposed solution
> for learning purposes. First of all I realized that the
>
> close $server or die "Cannot stop server mode: $!\n";
>
> line in my previous post was never reached, and indeed I was getting
> quite a lot of 'Address already in use' errors, albeit on a somewhat
> random basis. I'm not really sure if failure to reach that line was
> the actual cause of the problem, but it *seems* to be gone away after
> I modified the code as follows:
Try setting the 'ReuseAddr' option to IO::Socket::INET::new. This
should allow you to open the server socket more quickly each time you
run the server program.
Forking will help if you want to service multiple clients without
making each one wait for the preceding ones.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Fri, 29 Sep 2006 13:52:03 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Post to https using perl script
Message-Id: <efj8cm$9l9$1@ichaos2.ichaos-int>
"cardsharper" <Giridhar.Bandi@gmail.com> said:
>I wanted to post / upload a file to one of our https server
>
>what i am trying to do here is trying to loging to the
>https server using the user credentials . then trying to
>post a file to another url which in general accepts post
>after loging in .
>
>i was able to successfully login, but unable to post
>is this something todo with cookies ?
>
>the error its throughing is "302 Found"
"302 Found" is not an error. It is a response status (error codes
are also reponse status codes, but not all response status codes
are error codes).
Here's what HTTP documentation (IETF RFC 2616) says about 302:
10.3.3 302 Found
The requested resource resides temporarily under a different URI.
Since the redirection might be altered on occasion, the client SHOULD
continue to use the Request-URI for future requests. This response is
only cacheable if indicated by a Cache-Control or Expires header field.
The temporary URI SHOULD be given by the Location field in the
response. Unless the request method was HEAD, the entity of the
response SHOULD contain a short hypertext note with a hyperlink to
the new URI(s).
If the 302 status code is received in response to a request other than
GET or HEAD, the user agent MUST NOT automatically redirect the request
unless it can be confirmed by the user, since this might change the
conditions under which the request was issued.
Note: RFC 1945 and RFC 2068 specify that the client is not allowed
to change the method on the redirected request. However, most
existing user agent implementations treat 302 as if it were a 303
response, performing a GET on the Location field-value regardless
of the original request method. The status codes 303 and 307 have
been added for servers that wish to make unambiguously clear which
kind of reaction is expected of the client.
This is what is commonly called a "redirect". You're given the address
at which the requested resource actually resides, and your code should
handle the access to the correct resource.
You seem to be unsure about cookies, and you should be. If the site
uses cookies for access control, your code should also handle cookies.
Upon login (depending on the login method, though) the server creates
a session, and will place the session identifier into a cookie. To
be associated to that same session (and thus, to be an authenticated
request), all requests from the same client must contain the provided
session cookie.
In the above, the redirect may well point to the login page (as it seems
your code is not passing any cookie).
--
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: Fri, 29 Sep 2006 16:52:37 +0200 (CEST)
From: January Weiner <january.weiner@gmail.com>
Subject: Re: Questions about Inline::C
Message-Id: <efjbvl$892$1@sagnix.uni-muenster.de>
Sisyphus <sisyphus1@nomail.afraid.org> wrote:
> Inline_Stack_Vars and friends are defined in INLINE.h which is a header file
> auto-generated by Inline::C. It gets written in the build directory - and
> then cleaned up once the compilation has successfully completed (unless you
> run with the Config option 'CLEAN_AFTER_BUILD => 0').
Oh, that I do know, I have found that :-) It's just that it didn't tell me
much, because it just redefines the macros. (define inline_stack_push as
Inline_Stack_Push, and earlier Inline_Stack_Push as XPUSHs... but I still
do not know what XPUSHs is).
Anyway, this doesn't matter, as the (stupid! stupid!) error was completly
on my side.
j.
--
------------------------------
Date: Fri, 29 Sep 2006 16:53:35 +0200 (CEST)
From: January Weiner <january.weiner@gmail.com>
Subject: Re: Questions about Inline::C
Message-Id: <efjc1f$892$2@sagnix.uni-muenster.de>
Mirco Wahab <peace.is.our.profession@gmx.de> wrote:
> OK, I see your point now. You could give
> a link option afaik by :
> use Inline C => Config => LIBS => '-L/your/path -lyourlib';
Ah, that is nice (I should have RTFM...).
> Did you think about PDL?
> ==>
> http://pdl.sourceforge.net/PDLdocs/API.html#creating_a_piddle_in_c
And this is really nice. Many thanks! (and my program works beautifully)
January
--
------------------------------
Date: 29 Sep 2006 10:45:24 -0700
From: "Pam" <pamelapdh@aol.com>
Subject: Writing to a Parsed Excel Spreadsheet
Message-Id: <1159551924.508978.46930@h48g2000cwc.googlegroups.com>
Hello:
Here is a good one I wonder if anyone can answer.
I am getting information from a data base, the response is put into a
comma seperated file. I then use Text::CSV_XS to put that comma
seperated info into a spreadsheet by using Spreadsheet::WriteExcel.
This allows me to create a workbook and a worksheet which I can
format and write to.
I then parse that spreadsheet using Spreadsheet::ParseExcel to
check for empty cells which work fine, but one thing I must do
before I can parse the file is close the file. This is because I am
writing to the same file in which I am trying to parse.
Since I have closed the spreadsheet I wish to write to I seemed to have
lost my scope. Meaning the information I got from the parse now needs
to
be put into the spreadsheet.
If the cell is empty I want to write to it. Is it possible to write
using
Spreadsheet::ParseExcell info I have gathered?
Thank You,
Pamela
------------------------------
Date: Fri, 29 Sep 2006 13:01:42 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Writing to a Parsed Excel Spreadsheet
Message-Id: <451d5eea$0$25784$815e3792@news.qwest.net>
Pam wrote:
> Hello:
>
> Here is a good one I wonder if anyone can answer.
>
>
> I am getting information from a data base, the response is put into a
> comma seperated file. I then use Text::CSV_XS to put that comma
> seperated info into a spreadsheet by using Spreadsheet::WriteExcel.
> This allows me to create a workbook and a worksheet which I can
> format and write to.
>
> I then parse that spreadsheet using Spreadsheet::ParseExcel to
> check for empty cells which work fine, but one thing I must do
> before I can parse the file is close the file. This is because I am
> writing to the same file in which I am trying to parse.
Why not do all of your "empty cell" checks as you write it, correcting
them as you go? It doesn't really make sense to write it, then open it,
parse it, and write it again.
> Since I have closed the spreadsheet I wish to write to I seemed to have
> lost my scope. Meaning the information I got from the parse now needs
> to
> be put into the spreadsheet.
>
> If the cell is empty I want to write to it. Is it possible to write
> using
> Spreadsheet::ParseExcell info I have gathered?
If you must, then parse it again, write it to a new XLS file, and rename
it when you're finished.
------------------------------
Date: 29 Sep 2006 11:27:43 -0700
From: "Pam" <pamelapdh@aol.com>
Subject: Re: Writing to a Parsed Excel Spreadsheet
Message-Id: <1159554463.928320.113600@i42g2000cwa.googlegroups.com>
J. Gleixner wrote:
> Pam wrote:
> > Hello:
> >
> > Here is a good one I wonder if anyone can answer.
> >
> >
> > I am getting information from a data base, the response is put into a
> > comma seperated file. I then use Text::CSV_XS to put that comma
> > seperated info into a spreadsheet by using Spreadsheet::WriteExcel.
> > This allows me to create a workbook and a worksheet which I can
> > format and write to.
> >
> > I then parse that spreadsheet using Spreadsheet::ParseExcel to
> > check for empty cells which work fine, but one thing I must do
> > before I can parse the file is close the file. This is because I am
> > writing to the same file in which I am trying to parse.
>
> Why not do all of your "empty cell" checks as you write it, correcting
> them as you go? It doesn't really make sense to write it, then open it,
> parse it, and write it again.
>
>
> > Since I have closed the spreadsheet I wish to write to I seemed to have
> > lost my scope. Meaning the information I got from the parse now needs
> > to
> > be put into the spreadsheet.
> >
> > If the cell is empty I want to write to it. Is it possible to write
> > using
> > Spreadsheet::ParseExcell info I have gathered?
>
> If you must, then parse it again, write it to a new XLS file, and rename
> it when you're finished.
Hi:
Hmmm that is an idea, but this requirement was given to me after I did
the writing
and formating. I have a version of the script already running on a
cron job
I was adding more requirements and wanted to make every attempt not
have to
do a lot of modification to the code. The modules I am using are:
use strict;
use warnings;
use Spreadsheet::ParseExcel;
use Spreadsheet::WriteExcel;
use Text::CSV_XS;
I'm not aware of a way to check for a undef vlaue with out parsing it.
The way
it goes is I have to add the columns and formating first before I am
able to check it if is
empty. Logically it would make more sense to do it that way but my
requirments
don't allow me to.
I have tow questions:
Can you tell me how you would create a spreadsheet write to it and
parse it
(check for empty cell) at same tiem.
Can you tell me if it is possible to write to a parse file. Would I
write to a sheet
or to the work book/
#tThis is what I am doing now
# Create a new Excel workbook
my $workbook = Spreadsheet::WriteExcel->new("filename.xls");
my $worksheet = $workbook->add_worksheet();
# Create a new CSV parsing object
my $csv = Text::CSV_XS->new;
# Row and column are zero indexed
my $row = 0;
my $total;
my $count;
while (<CSVFILE>) {
if ($csv->parse($_)) {
my @Fld = $csv->fields;
my $col = 0;
foreach my $token (@Fld) {
$worksheet->write($row, $col, $token, $format3);
$col++;
}
$row++;
if ($row > 1){
$count = $count + 1;
$total = $count;
}
}
else {
my $err = $csv->error_input;
print "Text::CSV_XS parse() failed on argument: ", $err, "\n";
}
}
print "Adding sheet1\n";
This is how I am writing to the existing spreadsheet.
# Add a Format
my $format = $workbook->add_format();
#must set wrap for CCB comments and Description
$format->set_text_wrap();
$format->set_bold();
$format->set_bg_color('51');
$format->set_border();
$format->set_bottom();
$format->set_top();
$format->set_left();
$format->set_right();
$worksheet->set_column(0, 0, 11);
$worksheet->write(0, $col, "Identifier", $format,);
$worksheet->write(0, 1, "Team Comments", $format,);
$worksheet->write(0, 2, "Description", $format);
$worksheet->write(0, 3, "Status", $format);
$worksheet->write(0, 4, "Severity", $format);
$worksheet->write(0, 5, "Priority", $format);
$worksheet->write(0, 6, "CCBComments_encl", $format);
$worksheet->write(0, 7, "Primary-feature-team", $format);
$worksheet->write(0, 8, "Sub-feature-team", $format);
$worksheet->write(0, 9, "Project", $format);
$worksheet->write(0, 10,"Product", $format);
$worksheet->write(0, 11,"Products-targeted", $format);
$worksheet->write(0, 12,"Products-targed_del", $format);
$worksheet->write(0, 13,"Products-targetd_add", $format);
#This is the parser
my $oBook = Spreadsheet::ParseExcel::Workbook->Parse("filename.xls");
my($iR, $iC, $oWkS, $oWkC);
foreach my $oWkS (@{$oBook->{Worksheet}}) {
print "--------- SHEET:", $oWkS->{Name}, "\n";
for(my $iR = $oWkS->{MinRow} ;
defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
$iR++) {
for(my $iC = 11 ; $iC <=11; $iC++) {
if ( $oWkS->{Cells}[$iR][$iC]->Value != defined || warn "No
Data $iR"){
#Need to add something like this
# $worksheet->write($iR, $iC, "Platform",
$format2);
} else{
$oWkC = $oWkS->{Cells}[$iR][$iC];
print "( $iR , $iC ) =>", $oWkC->Value, "\n" if(
$oWkC);
}
Then close the book and rename it is the simplest way I know
I am only looking to write to one column which is column 11.
Thanks,
Pamela
------------------------------
Date: Fri, 29 Sep 2006 14:37:35 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Writing to a Parsed Excel Spreadsheet
Message-Id: <290920061437351059%jgibson@mail.arc.nasa.gov>
In article <1159554463.928320.113600@i42g2000cwa.googlegroups.com>, Pam
<pamelapdh@aol.com> wrote:
> J. Gleixner wrote:
> > Pam wrote:
> > > Hello:
> > >
> > > Here is a good one I wonder if anyone can answer.
> > >
> > >
> > > I am getting information from a data base, the response is put into a
> > > comma seperated file. I then use Text::CSV_XS to put that comma
> > > seperated info into a spreadsheet by using Spreadsheet::WriteExcel.
> > > This allows me to create a workbook and a worksheet which I can
> > > format and write to.
> > >
> > > I then parse that spreadsheet using Spreadsheet::ParseExcel to
> > > check for empty cells which work fine, but one thing I must do
> > > before I can parse the file is close the file. This is because I am
> > > writing to the same file in which I am trying to parse.
> >
> > Why not do all of your "empty cell" checks as you write it, correcting
> > them as you go? It doesn't really make sense to write it, then open it,
> > parse it, and write it again.
> >
> >
> > > Since I have closed the spreadsheet I wish to write to I seemed to have
> > > lost my scope. Meaning the information I got from the parse now needs
> > > to
> > > be put into the spreadsheet.
> > >
> > > If the cell is empty I want to write to it. Is it possible to write
> > > using
> > > Spreadsheet::ParseExcell info I have gathered?
> >
> > If you must, then parse it again, write it to a new XLS file, and rename
> > it when you're finished.
>
>
> Hi:
>
> Hmmm that is an idea, but this requirement was given to me after I did
> the writing
> and formating. I have a version of the script already running on a
> cron job
> I was adding more requirements and wanted to make every attempt not
> have to
> do a lot of modification to the code. The modules I am using are:
>
> use strict;
> use warnings;
> use Spreadsheet::ParseExcel;
> use Spreadsheet::WriteExcel;
> use Text::CSV_XS;
>
>
> I'm not aware of a way to check for a undef vlaue with out parsing it.
> The way
> it goes is I have to add the columns and formating first before I am
> able to check it if is
> empty. Logically it would make more sense to do it that way but my
> requirments
> don't allow me to.
Spreadsheet::ParseExcel reads spreadsheets and Spreadsheet::WriteExcel
writes them. Neither can be used to update an existing spreadsheet.
However, check out the Spreadsheet::ParseExcel::SaveParser module. It
purports to allow you to write data to an existing spreadsheet. I have
not used it and cannot comment on it.
You could also save the spreadsheet data in a two-dimensional array as
you write it, or just add a true value to a 2D array for each
spreadsheet cell you create. That way, after you have completed writing
the new spreadsheet, you can check the content of any spreadsheet cell
by checking the content of the array. In particular, you can ascertain
which cells have been written to and which have not.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
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 9783
***************************************