[19965] in Perl-Users-Digest
Perl-Users Digest, Issue: 2160 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 20 03:05:52 2001
Date: Tue, 20 Nov 2001 00:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006243511-v10-i2160@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 20 Nov 2001 Volume: 10 Number: 2160
Today's topics:
Re: Binary issues.. <mgjv@tradingpost.com.au>
Re: Binary issues.. <bart.lateur@skynet.be>
Re: Binary issues.. <mgjv@tradingpost.com.au>
Crypt::CBC for windows <sky@c237627-g.no.spam.moline1.il.home.com>
Currency formatting <mrp@hafatel.com>
Re: Currency formatting (Tad McClellan)
Re: How can i load my config setting from a file ? <tregan@monger.net>
How do I make several modules reference variables from <jazz450@hotmail.com>
Re: New Perl Journal <ahamm@programmer.net>
Re: Optimizing my Sub Coding <whataman@home.com>
OT: New Perl Journal <emarkert@netscape.net>
Re: OT: New Perl Journal <comdog@panix.com>
Pattern matching <bnswami@netscape.net>
Re: Pattern matching <mgjv@tradingpost.com.au>
Re: Perl generating JavaScript problem (Amer Neely)
Re: Perl generating JavaScript problem (Amer Neely)
Re: Perl generating JavaScript problem (Amer Neely)
Problems with Lite.pm file (Jamie)
Re: Sorting files by date on Win32 (Maynard)
TCPIP Delay <glodalec@yahoo.com>
Re: temporary file deleting too soon <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Nov 2001 02:23:29 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Binary issues..
Message-Id: <slrn9vjfm4.hmq.mgjv@verbruggen.comdyn.com.au>
On 19 Nov 2001 14:46:40 GMT,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> According to Martien Verbruggen <mgjv@tradingpost.com.au>:
>
> [...]
>
>> Then, the file is read in in chunks of 1kb (arbitrary size, can be
>
> [...]
>
>> variable is incremented, and the last length $marker bytes are saved to
>> prepend to the next buffer. This last operation is done to make sure
>> that we find a marker when it straddles the boundary between two reads.
>
> This imposes a lower limit on the buffer size: The buffer must be big
> enough to hold the longest value of $marker.
Indeed :)
Martien
--
|
Martien Verbruggen | The world is complex; sendmail.cf
Trading Post Australia Pty Ltd | reflects this.
|
------------------------------
Date: Tue, 20 Nov 2001 02:37:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Binary issues..
Message-Id: <pqfjvtgdu3ld4kopms3flh5c99u7emt6gk@4ax.com>
Martien Verbruggen wrote:
>But my code doesn't read in the _whole_ file in a single scalar. It
>reads the file bit by bit. The bits are defined as being separated by
>whatever is in $/:
>
>$/ = "</data>";
>
>The largest amount of memory used would be approximately twice the
>largest amount of data between </data> tokens.
This can easily run into several megabytes, if I understand the OP
correctly.
I'd be in favor of reading in smaller blocks, e.g. several (tens) kB,
and search for "</DATA>" myself. If it's not found, keep the trailing 7
bytes, read in the next chunk and append it, and try again. And again.
Until a "</DATA>" is found.
I'm sure somebody already proposed to use a scheme like this.
--
Bart.
------------------------------
Date: Tue, 20 Nov 2001 03:08:21 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Binary issues..
Message-Id: <slrn9vjia8.hmq.mgjv@verbruggen.comdyn.com.au>
On Tue, 20 Nov 2001 02:37:12 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Martien Verbruggen wrote:
>
>>But my code doesn't read in the _whole_ file in a single scalar. It
>>reads the file bit by bit. The bits are defined as being separated by
>>whatever is in $/:
>>
>>$/ = "</data>";
>>
>>The largest amount of memory used would be approximately twice the
>>largest amount of data between </data> tokens.
>
> This can easily run into several megabytes, if I understand the OP
> correctly.
>
> I'd be in favor of reading in smaller blocks, e.g. several (tens) kB,
> and search for "</DATA>" myself. If it's not found, keep the trailing 7
> bytes, read in the next chunk and append it, and try again. And again.
> Until a "</DATA>" is found.
>
> I'm sure somebody already proposed to use a scheme like this.
I did, upthread :)
Actually, what I did was provide a program that finds the markers, and
keeps track of the positions in the file. What you do with the various
seek()s after that determines how much actual memory is needed. The
code to do that is much harder to follow than what is under discussion
now, however, which is why I suggested this alternative.
The only size the OP has talked about, as far as I can recall, is the
total size of this file. Until then, the above estimate of the size is
as accurate as it gets :)
Martien
--
|
Martien Verbruggen | I'm just very selective about what I
Trading Post Australia Pty Ltd | accept as reality - Calvin
|
------------------------------
Date: Tue, 20 Nov 2001 03:04:57 GMT
From: "Teardrop Sky" <sky@c237627-g.no.spam.moline1.il.home.com>
Subject: Crypt::CBC for windows
Message-Id: <tLjK7.160417$My2.94570506@news1.mntp1.il.home.com>
I find it oddly strange there is no ppm package for Crypt::CBC, but there is
a package for blowfish and at least one or two other Crypt:: modules. i
thought it was recommended to use Crypt::CBC instead of the lower level
functions to perform encryption/decryption, and to tell you the truth, i
don't even know how to do it without Crypt::CBC.
can anyone help me in either 1. to learn how to use Blowfish without
Crypt::CBC, or 2. to tell me where i might be able to download a package for
Crypt::CBC for win32perl?
or more helpful might be a way to build modules using win32, but i've tried
this again and again and without purchasing visual c++ i think i am very
much a lost puppy trying to figure out how to make anything in windows with
open source compilers...
thanks
teardrop.
------------------------------
Date: Tue, 20 Nov 2001 14:55:00 +1000
From: "Mike Pierotti" <mrp@hafatel.com>
Subject: Currency formatting
Message-Id: <9tcnnb019ea@enews1.newsguy.com>
I need to convert format from text that is stored as a decimal to US
Currency and am not really sure how to do it.
Are there any existing perl modules designed to do this ?
TYIA
------------------------------
Date: Tue, 20 Nov 2001 06:12:09 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Currency formatting
Message-Id: <slrn9vjpsu.ibh.tadmc@tadmc26.august.net>
Mike Pierotti <mrp@hafatel.com> wrote:
>I need to convert format from text that is stored as a decimal to US
>Currency and am not really sure how to do it.
s/^/\$/; # put a dollar sign in front of it? :-)
>Are there any existing perl modules designed to do this ?
I'm not at all sure what "this" is that you want done.
Are you asking how to round to 2 decimal places?
perldoc -q round
"Does Perl have a round() function? What about ceil() and
floor()? Trig functions?"
Are you asking how to insert commas every 3 digits?
perldoc -q comma
"How can I output my numbers with commas added?"
If you are asking something else, then please try asking again.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 19 Nov 2001 22:19:05 -0500
From: tom regan <tregan@monger.net>
Subject: Re: How can i load my config setting from a file ?
Message-Id: <3BF9CBA9.D00538A@monger.net>
Try one of the Config:: modules. You can get them from cpan.perl.com. Just
click on the "modules" link. You should be able to find it from there.
I've never used any of these. Someone else may be able to give some tips on
which one to pick...
-------->tom
Robert wrote:
> Hi all
>
> I have a program calling many files, and depended on some files located on
> different directories. So at the beginig of my program i have some
> configuration setting like :
>
> my $MyFiles =$ENV{HOME}."/MyDir";
> my @search_path =("/opt/etc", $ENV{HOME}, '.');
> push @INC, "$ENV{HOME}/WORK/DATA";
>
> I want to put all these declarations in a separate file and load it when I
> am starting my program. But I don't know how can I load these configuration
> file. For example how can load these configuration if they were declared in
> a file called "myconfig.cfg".
>
> Thanks allot Robert
------------------------------
Date: Mon, 19 Nov 2001 21:11:34 -0800
From: john <jazz450@hotmail.com>
Subject: How do I make several modules reference variables from one file?
Message-Id: <EDE4D86B891C469E.AE7C209877C335F1.73BC73BDB3DA7A13@lp.airnews.net>
Hi All,
I'm new at perl, it's fun but there are areas I don't know well
yet. I inherited a previous programmer's code used to generate a bunch
of web pages. It uses TMPL and modules referencing modules all over the
place. I though variables were global but it seems that variables in
one module are not referenced across modules. I want to a config file
that all the various modules reference. I knows ways to do includes
with ASP and Javascript but not yet with perl. I'm sure perl does it.
I'm at loss to get several modules in several directories to reference
values in a single file.
Can you suggest anything?
Thanks.
------------------------------
Date: Tue, 20 Nov 2001 16:53:13 +1100
From: "Andrew Hamm" <ahamm@programmer.net>
Subject: Re: New Perl Journal
Message-Id: <3bf9effc$1_2@news.iprimus.com.au>
Erich Markert wrote in message <3BF9C776.2080207@netscape.net>...
>I know I'm probably going to get flamed for this, but it's really not
>meant to be a mean spirited post...
>
>I just got the latest edition of the Perl Journal...
>
>This is in no means a slight on the hard work that the authors, etc. put
>into this journal - because I've always enjoyed the journal and found it
>to be an extremely useful resource - but I have to say that I was less
>then impressed with the latest issue.
>
>I've been buying the Perl Journal for a number of years now and always
>looked forward to the next version. Past issues ALWAYS had tons of
>content but the latest is reduced to just a "special" section in Sys
>Admin - it's not even a separate mag anymore.
>
>Is this what we are to continue to expect from TPJ?
>
I know what you mean, but I don't understand the format you received it in.
In the last month, I've received two "free" issues of Sys Admin, with an
insert cajoling me to subscribe. Then I got a note (a separate letter or
another insert? I can't rembember) saying that TPJ will be a special section
of Sys Admin.
So that confused.
Then about a week ago I got thru the mail a complete, stand-alone copy of
TPJ which was small and somewhat simple compared to past efforts. It was not
wrapped with any copy of Sys Admin, and it did not mention Sys Admin
specifically. It was just an under-nourished TPJ from what I could see.
So I seem to have received a different format of mail from you? I'm in
Australia and another odd thing is that the mags and the inserts seem to be
re-mailed from a local company, as if they've taken on some contract to
handle it? Or perhaps they've been handling Sys Admin for a while now so
they take on the task of delivering TPJ?
Anyway, that's a summary of what I've seen regarding the physical
mailouts...
Moving to consider the contents of TPJ now, are you aware that TPJ suffered
from the collapse of (oh what were they called?) EarthWatch? Apparently they
were publishing it, but some company took them over and elected not to
continue with TPJ. Or something like that. That happened about a year ago at
least, and I've been waiting anxiously (so to speak) for further progress.
So just getting some output from TPJ is a wonderful thing in itself. I'm
certainly willing to excuse the simple offering this issue and even for
perhaps the next few issues if it gives them a chance to get back on their
feet and return to the excellent quality of product they used to supply.
I'm still confused about the Sys Admin connection and why an Australian
company is getting involved in my deliveries. I suppose a phone call or a
visit to a website would be a good idea.
Please, give TPJ a fighting chance. Since you know how good it used to be,
you'll surely want to see it return to it's former glory. I hope they get
there!
--
Space Corps Directive #723
Terraformers are expressly forbidden from recreating Swindon.
-- Red Dwarf
------------------------------
Date: Tue, 20 Nov 2001 04:47:35 GMT
From: "What A Man !" <whataman@home.com>
Subject: Re: Optimizing my Sub Coding
Message-Id: <3BF9E083.1E7E8A7@home.com>
Darn it! I just realized there *are* errors in the below after all. I'm
using Carpout to send errors to a log, and didn't notice any errors
until I refreshed the browser. ...and I tried to be so careful about
this before posting too...
Regards,
--Dennis
"What A Man !" wrote:
>
> After reviewing an old thread from Google, I modified my code below to a
> combination of what I deciphered from 2 different posters here.
> The below coding doesn't give any errors, but I have a feeling the code
> below still needs work; or can be done better. I'd also like to umask
> all the files and directories under $tmpdir to 0027; but am not quite
> sure where to put that. Any suggestions on this mess below are
> appreciated.
>
> ### fix files and directories under $tmpdir
> find \&fix_tempfiles, $tmpdir;
>
> sub fix_tempfiles {
> my $file = $_;
>
> ### now do the work
> &del_htaccess($file);
> &bad_chars($file);
> &fix_exes($file);
> &fix_perms($file);
> &chg_space;
> &chg_slash;
> }
>
> ### Delete any file with .htaccess or .htpasswd name
> sub del_htaccess {
> my ($file) = @_;
> my $newname = $file;
> return unless $newname =~ m/^(\.htaccess|\.htpasswd)$/i;
> unlink($newname) or die "Could Not Unlink $newname $!\n";
> }
>
> # Change "bad" characters found in file or directory name
> sub bad_chars {
> my $new = $_;
> return unless $new =~ s/[^\w.-]//g;
> if ( -e $new ) { return; }
> else {
> rename $_, $new or print "Could not delete chars from '$_':
> $!\n";
> }
> }
>
> ### Change all .exe files to .exe.txt
> sub fix_exes {
> my $file = @_;
> if ($file =~ /\.exe$/) { $_ =~ s/\.exe$/.exe.txt/ig;
> }
> }
>
> ### Change all file permissions to 644 for files
> ### and change all directories dirs to 755
> sub fix_perms {
> my ($file) = @_;
> if (-f $file ) {
> chmod 0644, $file
> or die "couldnt chmod $file to 0644: $!\n"
> }
> else { chmod 0775, $file
> or die "Couldnt chmod $file directory to 0775: $!\n";
> }
> }
>
> ### Change all spaces to underlines in files and directories
> sub chg_space {
> my ($file) = @_;
> my $new = ( $_ =~ s/ /\_/ );
> rename $_, $new or print "Could not change spaces
> to underlines: $!\n";
> }
>
> ### Change all %20 to slashes
> sub slash {
> my ($file) = @_;
> my $new = ( $_ =~ s/\%20/\// );
> rename $_, $new or print "Could not change %20 to slash: $!\n";
> }
>
>
> Regards,
> Dennis
------------------------------
Date: Tue, 20 Nov 2001 03:01:57 GMT
From: Erich Markert <emarkert@netscape.net>
Subject: OT: New Perl Journal
Message-Id: <3BF9C776.2080207@netscape.net>
I know I'm probably going to get flamed for this, but it's really not
meant to be a mean spirited post...
I just got the latest edition of the Perl Journal...
This is in no means a slight on the hard work that the authors, etc. put
into this journal - because I've always enjoyed the journal and found it
to be an extremely useful resource - but I have to say that I was less
then impressed with the latest issue.
I've been buying the Perl Journal for a number of years now and always
looked forward to the next version. Past issues ALWAYS had tons of
content but the latest is reduced to just a "special" section in Sys
Admin - it's not even a separate mag anymore.
Is this what we are to continue to expect from TPJ?
------------------------------
Date: Tue, 20 Nov 2001 00:41:30 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: OT: New Perl Journal
Message-Id: <comdog-A743A9.00413020112001@news.panix.com>
In article <3BF9C776.2080207@netscape.net>, Erich Markert
<emarkert@netscape.net> wrote:
> I've been buying the Perl Journal for a number of years now and always
> looked forward to the next version. Past issues ALWAYS had tons of
> content but the latest is reduced to just a "special" section in Sys
> Admin - it's not even a separate mag anymore.
complain to the publisher. it's not Readable Publications, which
is what you are seeing. complain to the new publisher.
> Is this what we are to continue to expect from TPJ?
no. don't expect anything.
at least, not until something new gets going. ;)
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Tue, 20 Nov 2001 09:48:13 +0530
From: "swami" <bnswami@netscape.net>
Subject: Pattern matching
Message-Id: <9tclc0$jm7$1@web1.cup.hp.com>
Hi,
I 'm doing a utility to remove comments from a c file(source/header)
What i need to do is to completely remove all C-style comments(/*
......... */)
over multilines also .
But the regexp for this pattern (/* with anything in between including \n
*/)
does not work inspite of trying all possible alternatives in s///,this
pattern does not match for
comments of the following form,for example:
/******************************************************************
*****************this is the text in between************
*************************************************************/
i am using the s///mg switch also..
maybe i have missed out on some idea
any ideas from regexp gurus?
Thanks
Swami
-
------------------------------
Date: Tue, 20 Nov 2001 04:47:18 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Pattern matching
Message-Id: <slrn9vjo3p.hmq.mgjv@verbruggen.comdyn.com.au>
On Tue, 20 Nov 2001 09:48:13 +0530,
swami <bnswami@netscape.net> wrote:
> Hi,
> I 'm doing a utility to remove comments from a c file(source/header)
> What i need to do is to completely remove all C-style comments(/*
> ......... */)
> over multilines also .
$ perldoc -q comment
Found in /usr/lib/perl5/5.6.0/pod/perlfaq6.pod
How do I use a regular expression to strip C style com
ments from a file?
Martien
--
|
Martien Verbruggen | Failure is not an option. It comes
Trading Post Australia Pty Ltd | bundled with your Microsoft product.
|
------------------------------
Date: 19 Nov 2001 23:35:02 -0800
From: aneely@softouch.on.ca (Amer Neely)
Subject: Re: Perl generating JavaScript problem
Message-Id: <331f54ba.0111192335.495dcc8c@posting.google.com>
Bart Lateur <bart.lateur@skynet.be> wrote in message news:<d7pgvtg216kqfjcdgkpr1n8740t61964m7@4ax.com>...
> Amer Neely wrote:
>
> >> > and like this:
> >> > my $SCRIPT_SRC = "http://127.0.0.1/cgi-bin/sql/mycd.js";
>
> Is this the proper URL for a browser coming from the outside world?
It is when you run a web server at home to do your development on.
127.0.0.1 is the IP address of the local machine. I develop my scripts
at home before uploading to a server, and my box at home is not on the
Internet, so I don't have to worry about the outside world.
------------------------------
Date: 19 Nov 2001 23:40:38 -0800
From: aneely@softouch.on.ca (Amer Neely)
Subject: Re: Perl generating JavaScript problem
Message-Id: <331f54ba.0111192340.7c1afcd6@posting.google.com>
Danny Aldham <danny@lennon.postino.com> wrote in message news:<9t9nov$1im$1@lennon.postino.com>...
> Amer Neely <aneely@softouch.on.ca> wrote:
> > "Mina Naguib" <spam@thecouch.homeip.net> wrote in message news:<Ar_I7.5771$Nq2.307478@weber.videotron.net>...
> >> On the web browser's side, do a "VIEW SOURCE". What does the above line get
> >> displayed as ?
>
> > It shows up as <script src="mycd.js"></script> or
> > <script src="http://127.0.0.1/cgi-bin/sql/mycd.js"></script> depending
> > on how I define it. In IE, the page loads fine, but as soon as a call
> [snip]
>
> You are expecting the webserver to parse & process this file like it
> would standard html. But because the file is not processed by the
> web server, the web server does not do the substitution you expect.
> You need to print out the contents of mycd.js in the output of your
> perl/cgi program.
Hmm. I've done this before in other scripts so I know it works. But
you may be onto something. Perhaps I've fiddled with how my browser
interprets .js code.
------------------------------
Date: 19 Nov 2001 23:59:04 -0800
From: aneely@softouch.on.ca (Amer Neely)
Subject: Re: Perl generating JavaScript problem
Message-Id: <331f54ba.0111192359.72f46554@posting.google.com>
Danny Aldham <danny@lennon.postino.com> wrote in message news:<9t9nov$1im$1@lennon.postino.com>...
> Amer Neely <aneely@softouch.on.ca> wrote:
> > "Mina Naguib" <spam@thecouch.homeip.net> wrote in message news:<Ar_I7.5771$Nq2.307478@weber.videotron.net>...
> >> On the web browser's side, do a "VIEW SOURCE". What does the above line get
> >> displayed as ?
>
> > It shows up as <script src="mycd.js"></script> or
> > <script src="http://127.0.0.1/cgi-bin/sql/mycd.js"></script> depending
> > on how I define it. In IE, the page loads fine, but as soon as a call
> [snip]
>
> You are expecting the webserver to parse & process this file like it
> would standard html. But because the file is not processed by the
> web server, the web server does not do the substitution you expect.
> You need to print out the contents of mycd.js in the output of your
> perl/cgi program.
Hmm. I've done this before so I know it works.
If I have to go to the bother of opening the file and reading it, I
may as well include it in the 'here' doc. The point of having an
external .js file is to have it available to other pages and to reduce
some clutter in the HTML.
------------------------------
Date: 19 Nov 2001 21:37:44 -0800
From: Jamie.Bates@jcu.edu.au (Jamie)
Subject: Problems with Lite.pm file
Message-Id: <2d9d4717.0111192137.549a0d1d@posting.google.com>
I recently installed MIME LITE on the server, for which it installed
successfully, but when I typed in "make test" it came up with all
these errors and if I put Lite.pm in any cgi scripts it stop on the
declaration line for it. If anyone has any help on what the error may
be telling me it would be greatly apreceated. This is what he erro
looks like:
Makefile:372: warning: overriding commands for target
`blib/lib/MIME/Lite.pm'
Makefile:364: warning: ignoring old commands for target
`blib/lib/MIME/Lite.pm'
PERL_DL_NONLAZY=1 /usr/local/bin/perl -I./blib/arch -I./blib/lib
-I/opt/LWperl5/
lib/perl5/sun4-solaris -I/opt/LWperl5/lib/perl5 -e 'use Test::Harness
qw(&runtes
ts $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/addrs.............Bare word found where operator expected at
lib/MIME/Lite.pm
line 496, near "m{\G\s*\Z}gco"
Unquoted string "co" may clash with future reserved word at
lib/MIME/Lite.pm lin
e 496.
Bare word found where operator expected at lib/MIME/Lite.pm line 498,
near "m{\G
$SEP$PHRASE\s*<\s*($ADDR)\s*>}gco"
Unquoted string "co" may clash with future reserved word at
lib/MIME/Lite.pm lin
e 498.
syntax error at lib/MIME/Lite.pm line 496, near "m{\G\s*\Z}gco"
BEGIN failed--compilation aborted at t/addrs.t line 3.
FAILED before any test output arrived
Test returned status 2 (wstat 512)
t/data..............Bare word found where operator expected at
lib/MIME/Lite.pm
line 496, near "m{\G\s*\Z}gco"
------------------------------
Date: 19 Nov 2001 20:04:26 -0800
From: rev_maynard3@hotmail.com (Maynard)
Subject: Re: Sorting files by date on Win32
Message-Id: <a4847dc.0111192004.7ed6fee6@posting.google.com>
Ah! This was officially my first Perl script. I'm still shaking some
bad habbits from other scripting languages (VBScript). Thank you
both.
------------------------------
Date: Tue, 20 Nov 2001 08:10:28 +0100
From: Marvin <glodalec@yahoo.com>
Subject: TCPIP Delay
Message-Id: <MPG.16642051a3e4f2c6989718@news.siol.net>
Hi !
I am using the following code, to send a message to a specified host,
which runs a program for receiving and displaying messages.
#!/usr/local/bin/perl
my $REMOTE_HOST="192.150.150.200";
my $REMOTE_PORT=5555;
$socket = IO::Socket::INET->new(PeerAddr => $REMOTE_HOST,
PeerPort => $REMOTE_PORT,
Proto => "tcp",
Type => SOCK_STREAM,
Timeout => 5)
or return 0;
print $socket "This is a message" ;
close ($socket);
If I run this script from Digital Unix machine, the host receives it
within a second.
Now, I need to run this script on a Solaris as well. No matter, that
this script finishes imediately (like on Digital machine), the program
detects connection after 8 seconds only, so all messages are very slow
from Solaris box. I think that must be something with TCP delay, ( all
packets being lost must not get in anymore, so wait a few sec..), and
with default values of IO::Socket::INET method.
Any clue ?
------------------------------
Date: Tue, 20 Nov 2001 01:44:25 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: temporary file deleting too soon
Message-Id: <3BF9FBC9.69E788E9@earthlink.net>
nobull@mail.com wrote:
>
> "Gregory Toomey" <nobody@nowhere.com> wrote in message news:<Lh_J7.369152$8x1.109170@newsfeeds.bigpond.com>...
> > "Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
> > news:3BF8658D.91D2216C@earthlink.net...
> >
> > > Best might be to *not* extract the image when generating the html,
> > > but instead have the image url point to a url for a cgi or
> > > mod-perl script which extracts the image and prints it out to the
> > > browser... For example:
> >
> > Thanks a lot for this suggestion. I never knew you could call a cgi
> > as part of an IMG tag - I thought you had to link directly to a gif
> > or jpg.
> >
> > After testing I found you need to: print "Content-Type:
> > image-gif\n\n" then just write the gif to stdout.
>
> IMNSHO this is definitely the 'B' answer. The 'A' answer is to use
> the temporary file because it is more cache-friendly. You can, of
> course, combine the approaches and have the IMG tag call a CGI which
> creates the temporary file if it does not already exist and then
> issues a redirect to the created file.
>
> There may also be an 'A+' answer that is the same as the 'B' answer
> but with suitable Etag and Last-Modified headers so that you can avoid
> temporary files without screwing the HTTP caching mechanism.
>
> None of this, of course, has anything whatever to do with Perl.
No, but it would have to do with perl if we mentioned CGI::Cache for a
B+ solution, and MIME::Lite for the multipart/related solution, and
MIME::Base64 as part of the data: solution.
--
Klein bottle for rent - inquire within.
------------------------------
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 2160
***************************************