[19127] in Perl-Users-Digest
Perl-Users Digest, Issue: 1322 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 18 06:06:10 2001
Date: Wed, 18 Jul 2001 03:05:11 -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: <995450711-v10-i1322@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 18 Jul 2001 Volume: 10 Number: 1322
Today's topics:
Re: #### ADD 6 INCHES TO YOUR PENIS ##### 2830 <Georg.Vassilopulos@SoftwareAG.de>
Re: #### ADD 6 INCHES TO YOUR PENIS ##### 2830 (Bernard El-Hagin)
Re: about fcntl <goldbb2@earthlink.net>
about image::Magick quality please ! <shijialee@yahoo.com>
Re: about image::Magick quality please ! <stumo@bigfoot.com>
Re: Advice REQ for newbie <pne-news-20010718@newton.digitalspace.net>
Re: Advice REQ for newbie <bloke6789@hotmail.com>
Re: All computers in world MUST sync with ATOMIC clock <hafner-usenet@ze.tu-muenchen.de>
Re: All computers in world MUST sync with ATOMIC clock <william-news-102374@pota.to>
Re: All computers in world MUST sync with ATOMIC clock (mc)
Re: All computers in world MUST sync with ATOMIC clock <pne-news-20010718@newton.digitalspace.net>
Re: Debugger -- ActivePerl / Perl Builder / Perltk / <stumo@bigfoot.com>
FAQ: How can I make my Perl program run faster? <faq@denver.pm.org>
Getting always corrupt files while uploading (cgi) <Georg.Vassilopulos@SoftwareAG.de>
Re: How to make a text or html file into an image <addi@umich.edu>
Re: How to run Perl on MS-DOS <pne-news-20010718@newton.digitalspace.net>
Re: How to run Perl on MS-DOS (Tim Hammerquist)
Re: How to time out on a socket read (Logan Shaw)
Re: Including flock in code while developing in Windows <m.grimshaw@salford.ac.uk>
Re: Obtaining remote users ip <hafner-usenet@ze.tu-muenchen.de>
Re: Perl or PHP? <bart.lateur@skynet.be>
Re: Perl or PHP? (Tim Hammerquist)
Re: Perl or PHP? <hafner-usenet@ze.tu-muenchen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Jul 2001 11:16:42 +0200
From: "Georg Vassilopulos" <Georg.Vassilopulos@SoftwareAG.de>
Subject: Re: #### ADD 6 INCHES TO YOUR PENIS ##### 2830
Message-Id: <9j3k5r$u2f$1@gamma.ecomp.net>
With Perl?
Please let me know the module name.
penis_enlargenment_perl_scripts@viot.de
vrespd@nowhere.com wrote in message ...
>click here to add 6 inches to your cock
>
>http://www.citedusexe.com/hugecock/
>
>
>
>
>
>llnjdnfxtsiimklbklytlxzktucg
>
------------------------------
Date: Wed, 18 Jul 2001 09:51:07 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: #### ADD 6 INCHES TO YOUR PENIS ##### 2830
Message-Id: <slrn9laml6.aig.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 18 Jul 2001 11:16:42 +0200, Georg Vassilopulos
<Georg.Vassilopulos@SoftwareAG.de> wrote:
>vrespd@nowhere.com wrote in message ...
>>click here to add 6 inches to your cock
>>
>>http://www.citedusexe.com/hugecock/
>
>With Perl?
>
>Please let me know the module name.
>penis_enlargenment_perl_scripts@viot.de
Who needs a module?
$your_cock += 6;
Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'
------------------------------
Date: Wed, 18 Jul 2001 00:18:23 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: about fcntl
Message-Id: <3B550E0F.AD79679B@earthlink.net>
sarah wrote:
>
> I use perl 5.0 in Solaris.
> And I think the third parameter of fcntl(FILEH,F_SETLK,?) should not
> be a simple variable,but I don't know what to fill in, maybe a hash or
> a array.
> There is no function prototype in perl,which is different from C.
>
> But if I wrtite:
>
> use Fcntl;
> my ($ret_1, $ret_2, %lockret);
> if (open(FILEH,">t2"))
> {
> %lockret=(type=>F_UNLCK,whence=>SEEK_SET,start=>0, len=>0);
> $ret_1=fcntl(FILEH, F_GETLK, %lockret);
> %lockret=(type=>F_WRLCK,whence=>SEEK_SET,start=>0, len=>0);
> $ret_2=fcntl(FILEH, F_SETLK, %lockret);
> }
> The value of ret_1 and ret_2 are still undefined, why?
Because the structure isn't a hash, it's a packed struct, as in Samuel
Kilchenmann's post. Try:
my $fl_struct = "SSLLSS";
my @fl_struct = qw(type offset whence len pid xxx);
if (open(FILEH,">t2")) {
my ($lockret, %lockret);
# this creates a hash which mimics an flock struct
%lockret=(type=>F_WRLCK,whence=>SEEK_SET,start=>0, len=>0);
# this turns the hash into an actual flock struct.
$lockret = pack $fl_struct, @lockret{@fl_struct};
print "Setting lock: with struct\n";
print "$_ -> $lockret{$_}\n" for @fl_struct;
# this call fcntl with the struct, setting the lock.
print fcntl(FILEH, F_SETLK, $lockret), "\n";
print "Querying lock...\n";
# this queries to find whatever lock exists
print fcntl(FILEH, F_GETLK, $lockret), "\n";
# this unpacks it and puts it in a structure.
@lockret{@fl_struct} = unpack $fl_struct, $lockret;
print "Got struct:\n"
print "$_ -> $lockret{$_}\n" for @fl_struct;
print "\n";
# this creates a hash which mimics an flock struct
%lockret=(type=>F_UNLCK,whence=>SEEK_SET,start=>0, len=>0);
# this turns the hash into an actual flock struct.
$lockret = pack $fl_struct, @lockret{@fl_struct};
print "Clearing lock with struct:\n";
print "$_ -> $lockret{$_}\n" for @fl_struct;
# this call fcntl with the struct, setting the lock.
print fcntl(FILEH, F_SETLK, $lockret), "\n";
}
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Wed, 18 Jul 2001 07:13:09 GMT
From: "James" <shijialee@yahoo.com>
Subject: about image::Magick quality please !
Message-Id: <9Ga57.205298$Mf5.56805120@news3.rdc1.on.home.com>
question again,
i am trying to resize image and lower the quality in order to make a smaller
thumbnail. i am specifically dealing with JPEG file now. My problem is that
the
size of the image seems not to be affected no matter what number i set
for the quality. even with nothing set for the quality! the size always
remains the same.
btw, i used GD to do the same job, but end up with losing much quality of
the image.
_______________________________________________
use Image::Magick;
$image = Image::Magick->new;
$image->Read('1012.jpg');
$test = $image->Clone();
my ($w,$h) = $test->Get('width','height');
&getNewSize;
$test->Resize(width=>$w,height=>$h);
$test->Write(quality=>'50',filename=>'copy.jpg');
-----------------------------------------------
i am new to perl , please give me any thought you may have, thanks!
James
------------------------------
Date: Wed, 18 Jul 2001 10:29:41 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Re: about image::Magick quality please !
Message-Id: <8Fc57.46382$WS4.7113819@news6-win.server.ntlworld.com>
James <shijialee@yahoo.com> wrote in message
news:9Ga57.205298$Mf5.56805120@news3.rdc1.on.home.com...
> use Image::Magick;
>
> $image = Image::Magick->new;
> $image->Read('1012.jpg');
> $test = $image->Clone();
>
> my ($w,$h) = $test->Get('width','height');
>
print "$w,$h\n";
> &getNewSize;
print "$w,$h\n";
>
> $test->Resize(width=>$w,height=>$h);
> $test->Write(quality=>'50',filename=>'copy.jpg');
>
Is &getNewSize meant to alter $w and $h? Use the print statements to see if this
is the case. My bet is that the subroutine can't change $w and $h for some
reason. Assuming you're using $w and $h in &getNewSize, then at the end of
getNewSize put
return $w,$h;
And replace the getNewSize above with
($w,$h)=getNewSize();
(same as ($w,$h)=&getNewSize;)
Hope that helps
------------------------------
Date: Wed, 18 Jul 2001 07:05:03 +0200
From: Philip Newton <pne-news-20010718@newton.digitalspace.net>
Subject: Re: Advice REQ for newbie
Message-Id: <im4altordp60nb5krbd3fleatfdl0fetae@4ax.com>
On Wed, 18 Jul 2001 03:57:43 GMT, nospam@home.com (mc) wrote:
> Assuming that's all you want to do, you can do this --
> with results more like you expected -- from the command line:
>
> perl -i -pe 's/^\s*\d{1,2}$//' FILES
>
> This would print the output directly back into your file.
Since the OP is using Outlook Express, it's safe to assume that he's
using MSWin32. And AFAIK you can't do in-place editing on that operating
system (perhaps because you can't delete a file that you have a handle
open on) -- at least my ActivePerl refused to do so. So you'd need an
extension or a substitution after the -i, such as -i.bak or whatever.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 18 Jul 2001 09:36:33 +0100
From: "Pete" <bloke6789@hotmail.com>
Subject: Re: Advice REQ for newbie
Message-Id: <c1c57.46228$WS4.7098239@news6-win.server.ntlworld.com>
"Philip Newton" <pne-news-20010718@newton.digitalspace.net> wrote in message
news:im4altordp60nb5krbd3fleatfdl0fetae@4ax.com...
> On Wed, 18 Jul 2001 03:57:43 GMT, nospam@home.com (mc) wrote:
>
> > Assuming that's all you want to do, you can do this --
> > with results more like you expected -- from the command line:
> >
> > perl -i -pe 's/^\s*\d{1,2}$//' FILES
> >
> > This would print the output directly back into your file.
>
> Since the OP is using Outlook Express, it's safe to assume that he's
> using MSWin32. And AFAIK you can't do in-place editing on that operating
> system (perhaps because you can't delete a file that you have a handle
> open on) -- at least my ActivePerl refused to do so. So you'd need an
> extension or a substitution after the -i, such as -i.bak or whatever.
>
> Cheers,
> Philip
> --
> Philip Newton <nospam.newton@gmx.li>
> That really is my address; no need to remove anything to reply.
> If you're not part of the solution, you're part of the precipitate.
Thanks all for your help (and tolerance). I had a bit of diffs with the
command line method (windoze user) because I wasn't sure what I was doing. I
went into the perldoc and extracted some code, messed about with it and
eventually got it to do the job. Here's the code, please can you tell me why
it works as it stands, but not if I put "\d{1,2,3}" (no quotes), as an
attempt to remove 98 99 _and_ 100? Excuse the hard coding - this is a demo.
$old = "old.html";
$new = "new.html";
open(OLD, "< $old") or die "can't open $old: $!";
open(NEW, "> $new") or die "can't open $new: $!";
while (<OLD>) {
s/^\s*\d{1,2}$//;
(print NEW $_) or die "can't write to $new: $!";
}
close(OLD) or die "can't close $old: $!";
close(NEW) or die "can't close $new: $!";
Pete
------------------------------
Date: 18 Jul 2001 09:19:45 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: All computers in world MUST sync with ATOMIC clock before 12:00 AM 21July 2001
Message-Id: <srj1yne1z72.fsf@w3proj1.ze.tu-muenchen.de>
alavoor <alavoor@yahoo.com> writes:
OK, i won't comment on that laughable troll, but:
> This clock is the official
> time USA and for the world.
*ROTFLBTC*
I *knew* Americans where USA-centric, but that beats it all.
Nwsgroups: line trimmed.
-Walter [syncing his servers to the Braunschweig caesium clock for >5
years now. Sorry if that's rude to you Americans. :-)]
------------------------------
Date: Wed, 18 Jul 2001 01:50:15 -0700
From: William Pietri <william-news-102374@pota.to>
Subject: Re: All computers in world MUST sync with ATOMIC clock before 12:00 AM 21July 2001
Message-Id: <tlajeape46r74f@corp.supernews.com>
alavoor wrote:
>
> All computers in the world MUST sync with ATOMIC clock before 12:00 AM
> 21 July 2001!!!
And why must we do that? Will the UFOs leave us behind if we are not in
perfect isocrhronal synchrony? Must our computers be temporally harmonized
to properly receive the waves of spiritual energy when you immanentize the
eschaton? And in which time zone do you mean? There are 24 different 12:00
AMs on July 21.
I haven't been reading the papers lately, so I'm very behind in all this.
Please bring me up to date.
> hello:
> You must sync your PC's date and time with Cesium Atomic clock.
>
> Use this very small and tiny program written in PHP.
>
> Do you know that Cesium Atomic clock located in Boulder, Colarado, USA
> is the world's most accurate clock!! It does not lose or gain one second
> even after running for 25 MILLION YEARS!!! This clock is the official
> time USA and for the world.
I am sorry to inform you that there is now a more accurate clock.
http://dailynews.yahoo.com/h/abc/20010713/ts/opticalclock010713_1.html
The mercury ion clock will only slip one second every 30 billion years,
which is much better. Does this mean we will have longer to install the
program you mention? I'd think it would give us at least until Tuesday.
> There are also similar Atomic clocks in France, UK, Germany and Japan.
>
> This program runs on MS Windows 95/98/NT/2000/XP/ME and MS Windows 3.11.
>
> This program also runs on all flavors of Unix and Linux and Apple Mac.
>
> Please download the program from:
> http://phpclasses.upperdesign.com/browse.html/package/285
I will take a look immediately. Oh, and given your interest in timekeeping,
you may find this site helpful; I know I've found it very interesting:
http://www.timecube.com/
Regards,
William Pietri
Field Researcher
Institute for Psychoceramics
------------------------------
Date: Wed, 18 Jul 2001 04:14:40 GMT
From: nospam@home.com (mc)
Subject: Re: All computers in world MUST sync with ATOMIC clock before 12:00 AM 21July 2001
Message-Id: <3b550cb4.389343274@news>
On Wed, 18 Jul 2001 12:45:42 +0930, "Wyzelli" <wyzelli@yahoo.com>
wrote:
>"alavoor" <alavoor@yahoo.com> wrote in message
>news:3B54F753.7B166886@yahoo.com...
>>
>> All computers in the world MUST sync with ATOMIC clock before 12:00 AM
>> 21 July 2001!!!
>
>Or what?
>
>> hello:
>
>hello?
>
>> You must sync your PC's date and time with Cesium Atomic clock.
>
>I must?
>
>> Use this very small and tiny program written in PHP.
>
>I sense a sales pitch.
>
>> Do you know that Cesium Atomic clock located in Boulder, Colarado, USA
>> is the world's most accurate clock!! It does not lose or gain one second
>
>Indeed. More accurate than any other Cesium Atomic clock?
>
>> even after running for 25 MILLION YEARS!!! This clock is the official
>> time USA and for the world.
>
>Gee who was around to start it back then?
Hey get with the program. Cesium clocks are passe.
And they slip by a second every 30 million years.
There is a clock 100,000 times better:
http://dailynews.yahoo.com/h/abc/20010713/ts/opticalclock010713_1.html
------------------------------
Date: Wed, 18 Jul 2001 08:43:41 +0200
From: Philip Newton <pne-news-20010718@newton.digitalspace.net>
Subject: Re: All computers in world MUST sync with ATOMIC clock before 12:00 AM 21July 2001
Message-Id: <nh7altkd9v3tm5tnb71do5bth5ke93agah@4ax.com>
On Wed, 18 Jul 2001 12:45:42 +0930, "Wyzelli" <wyzelli@yahoo.com> wrote:
> "alavoor" <alavoor@yahoo.com> wrote in message
> news:3B54F753.7B166886@yahoo.com...
> >
> > Do you know that Cesium Atomic clock located in Boulder, Colarado, USA
> > is the world's most accurate clock!! It does not lose or gain one second
>
> Indeed. More accurate than any other Cesium Atomic clock?
And how accurate will your clock be if TCP packets take 1.5 seconds to
go from there to your computer? Does the PHP applet take round-trip time
into account and correct the reading? I rather doubt it. So much for the
accuracy, then. "My computer clock doesn't keep the exact time, but at
least it's always *exactly* 738ms slow!"
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 18 Jul 2001 10:50:45 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Re: Debugger -- ActivePerl / Perl Builder / Perltk /
Message-Id: <UYc57.46464$WS4.7121453@news6-win.server.ntlworld.com>
Joe Chung <m_010@yahoo.com> wrote in message
news:3b54dc5a.112633906@enews.newsguy.com...
> I found 3 popular perl debugger, which one is the best?
I use the one built in with ActivePerl myself, works fine.
>
> I perfer writing perl code on windows and run on Unix. I wonder if
> perl code is portable across different platform, like Java code?
>
> Does ActivePerl come with the standard perl interpreter? so that I
> can write code using ActivePerl, then run it on unix's perl. Any
> compatiblity problem?
99% of it's the same. One thing that's tripped me up a few times is that
ActivePerl says the second argument of mkdir is optional, whereas the unix perl
I've run it on doesn't like that; there may be others along the same vein. I
think perlfunc has a list of some stuff that doesn't work on Win, however
anything that works in ActivePerl is likely to work on unix perl, the other
direction can be more problematic if you're using any of these functions.
Also check that any modules you've used are available on the Unix version.
Stuart
------------------------------
Date: Wed, 18 Jul 2001 06:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I make my Perl program run faster?
Message-Id: <xR957.6$pQ2.170987520@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How can I make my Perl program run faster?
The best way to do this is to come up with a better algorithm. This can
often make a dramatic difference. Jon Bentley's book ``Programming
Pearls'' (that's not a misspelling!) has some good tips on optimization,
too. Advice on benchmarking boils down to: benchmark and profile to make
sure you're optimizing the right part, look for better algorithms
instead of microtuning your code, and when all else fails consider just
buying faster hardware.
A different approach is to autoload seldom-used Perl code. See the
AutoSplit and AutoLoader modules in the standard distribution for that.
Or you could locate the bottleneck and think about writing just that
part in C, the way we used to take bottlenecks in C code and write them
in assembler. Similar to rewriting in C, modules that have critical
sections can be written in C (for instance, the PDL module from CPAN).
In some cases, it may be worth it to use the backend compiler to produce
byte code (saving compilation time) or compile into C, which will
certainly save compilation time and sometimes a small amount (but not
much) execution time. See the question about compiling your Perl
programs for more on the compiler--the wins aren't as obvious as you'd
hope.
If you're currently linking your perl executable to a shared *libc.so*,
you can often gain a 10-25% performance benefit by rebuilding it to link
with a static libc.a instead. This will make a bigger perl executable,
but your Perl programs (and programmers) may thank you for it. See the
INSTALL file in the source distribution for more information.
Unsubstantiated reports allege that Perl interpreters that use sfio
outperform those that don't (for I/O intensive applications). To try
this, see the INSTALL file in the source distribution, especially the
``Selecting File I/O mechanisms'' section.
The undump program was an old attempt to speed up your Perl program by
storing the already-compiled form to disk. This is no longer a viable
option, as it only worked on a few architectures, and wasn't a good
solution anyway.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
03.16
--
This space intentionally left blank
------------------------------
Date: Wed, 18 Jul 2001 11:19:26 +0200
From: "Georg Vassilopulos" <Georg.Vassilopulos@SoftwareAG.de>
Subject: Getting always corrupt files while uploading (cgi)
Message-Id: <9j3kav$u2g$1@gamma.ecomp.net>
Hi People,
Just a simple piece of code, but not working.
What is the bug here?
use CGI qw(:standard);
my $file = $query->param('Datei');
open (UPFILE, ">$myFile");
while (read($file, $buffer, 1024)) { print UPFILE $buffer; };
close (UPFILE);
Help would be wonderfull....
Thanks
Georg
georg.vassilopulos@softwareAG.com
------------------------------
Date: Wed, 18 Jul 2001 06:16:58 GMT
From: Arnar M Hrafnkelsson <addi@umich.edu>
Subject: Re: How to make a text or html file into an image
Message-Id: <m3y9pmyfur.fsf@steypa.ast.is>
"Enrico Ng" <mail@enricong.com> writes:
> I want to make a post on a message board and have it automatically
> update with the latest info from a news script I have. I can only write
> messages and post images. so I figured I would have something that
> would convert my news to an image everytime I updated it. then,
> whenever anyone went to my post, it would be updated. I have seen
> places on the web that would do things like put my name on a picture of
> a creditcard to see what it looks like, or places that allowed me to see
> what a business card looks like on the web and try out different styles.
>
> --
> --
> Enrico Ng <mail@enricong.com>
> "Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
> news:87n1685hmu.fsf@limey.hpcc.uh.edu...
> > >> On Fri, 13 Jul 2001 21:57:12 -0500,
> > >> "Enrico Ng" <mail@enricong.com> said:
> >
> > > Is there a way I can have a perl script take text such
> > > as an html file and make it into an image.
> >
> > You could convert it into Postscript I suppose.
> >
> > Your question is too vague for anyone to formulate a
> > useful answer.
> >
> > --
> > Beep beep! Out of my way, I'm a motorist!
check out the modules, Imager, GD and Image::Magick.
You can also use the various shell utilities (pnm* things).
-- Arnar.
------------------------------
Date: Wed, 18 Jul 2001 07:05:02 +0200
From: Philip Newton <pne-news-20010718@newton.digitalspace.net>
Subject: Re: How to run Perl on MS-DOS
Message-Id: <bh4altkorvsnlr8qu6m7hgulihe7gk28ml@4ax.com>
On Tue, 17 Jul 2001 23:19:56 GMT, tim@vegeta.ath.cx (Tim Hammerquist)
wrote:
> C:\> type somefile.txt | more # pray that more is present
You should get a Useless Use of cat^H^H^Htype Award from Randal for that
one: it's the same as "more <somefile.txt" (and "more somefile.txt"
should also work). And more should come standard with the operating
system, unless they've mucked around with the PATH variable or deleted
files from C:\DOS, C:\WINDOWS\COMMAND, or whatever.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 18 Jul 2001 05:08:37 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: How to run Perl on MS-DOS
Message-Id: <slrn9la74h.vj8.tim@vegeta.ath.cx>
Me parece que Philip Newton <pne-news-20010718@newton.digitalspace.net> dijo:
> On Tue, 17 Jul 2001 23:19:56 GMT, tim@vegeta.ath.cx (Tim Hammerquist)
> wrote:
>
> > C:\> type somefile.txt | more # pray that more is present
>
> You should get a Useless Use of cat^H^H^Htype Award from Randal for that
> one: it's the same as "more <somefile.txt" (and "more somefile.txt"
> should also work). And more should come standard with the operating
> system, unless they've mucked around with the PATH variable or deleted
> files from C:\DOS, C:\WINDOWS\COMMAND, or whatever.
* smacks head * Duh! I guess it just comes from this:
C:\> type somefile.txt
[ text scrolls well off screen. ]
C:\> <Up> | more # DOSKEY has it's advantages. =)
After a while, it just becomes 'type file | more'
Not a huge deal anyway. TYPE is a built-in command in COMMAND.COM. It
doesn't load an external .EXE or .COM.
--
Be different: conform
-- fortune-mod version 9708
------------------------------
Date: 18 Jul 2001 00:35:58 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How to time out on a socket read
Message-Id: <9j377u$rga$1@charity.cs.utexas.edu>
In article <3B54C35A.FDF38878@mediaone.net>,
Sofia Villanueva <svillan@mediaone.net> wrote:
>Folks:
>
> I followed the advice in the perlipc man page for a timing out a
>response using SIG{ALRM} and alarm. Their example works great. The
>problem is when I replace the
>
> $input=<>;
>
>with a
>
> $input=<$socket>;
>
>or any of the other reading methods, such as getline, read, recv, etc.
>
>Basically I am attempting to protect reads/writes from timeouts (which I
>am taking to be a hangup from the client). I wonder if I am being a bit
>more cautious than I need to here.
Look into select(), which can wait for an I/O to come ready but with a
timeout:
$vector = '';
vec ($vector, fileno($socket), 1) = 1;
if (select ($vector, undef, undef, 2.7) > 0)
{
# do a sysread() here.
}
else
{
# it timed out after 2.7 seconds.
}
The IO::Select module can be helpful in making select() easier
to deal with.
Hope that helps.
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: Wed, 18 Jul 2001 10:24:37 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Including flock in code while developing in Windows for Unix??
Message-Id: <3B5555D5.AC4138CD@salford.ac.uk>
Jeff Zucker wrote:
>
> Mark Grimshaw wrote:
> >
> > I've just done the same thing for a friend of mine: writing (on WinNT
> > ActiveState) an OOP package that opens/closes and locks database
> > files/ancilliary files and passing it on to my friend who uses Win98 -
> > eventually it'll all go on UNIX. Hence I needed to test the operating
> > system to see whether I can use flock. Given that flock works on
> > WinNT/2000 but not Win9x and that $^O reports 'MSWin32' on both, is
> > there any way to tell the two apart from within perl?
>
> But if you want to test for flock(), why not test for flock() instead of
> testing for the OS? What about other OSs that don't support flock()?
> The simplest thing is to do an eval on flock() as I suggested earlier in
> this thread. That will give you a HAS_FLOCK constant on all OSs that
> support flock() and won't on those that do not support it and you don't
> even have to know which is which. Portable code shouldn't be OS
> dependendant or need to test for OS. Code that works only on Windows
> and *nix is not portable code. (though obviously, it's a good start
> :-)).
That's what I'm trying but I'm getting conflicting results with the
following snippet:
#!E:/perl/bin/perl -w
package ad_STUDIO;
use strict; use diagnostics;
# check operating system - Win98 has no flock!
BEGIN {
if(eval "use Fcntl qw(:flock)") # has flock()
{
$ad_STUDIO::ad_flock = 1;
print "has flock: $@\n\n";
}
else # no flock()
{
use Fcntl;
$ad_STUDIO::ad_flock = 0;
print "no flock: $@\n\n";
}
}
<snip>
on WinNT ActiveState, this prints:
no flock:
with nothing in $@ yet I can lock a filehandle with LOCK_EX... Any idea
what I'm doing wrong?
------------------------------
Date: 18 Jul 2001 09:25:14 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: Obtaining remote users ip
Message-Id: <srjy9pmzokl.fsf@w3proj1.ze.tu-muenchen.de>
gorilla@elaine.furryape.com (Alan Barclay) writes:
> In article <srj66csm32i.fsf@w3proj1.ze.tu-muenchen.de>,
> Walter Hafner <hafner-usenet@ze.tu-muenchen.de> wrote:
> >Hiho!
> >
> >Remember, that most Proxies rewrite the IP address and send the original
>
> s/most/some/;
>
> The original client might not even have an IP address, and even if it
> does, it may be a private address, which has no meaning outside
> of a private network.
That's right. But for logging purposes i'd rather have a few private
network addresses in my database than just the addresses of the AOL
proxies. :-)
And you can always filter out _proper_ private addresses by their
netmask.
Regards
-Walter
------------------------------
Date: Wed, 18 Jul 2001 05:14:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl or PHP?
Message-Id: <aq6alt8tg6jhp4oeeearrg1rf5i1uamekf@4ax.com>
Martin Jericho wrote:
>The basic thrust of my question was to find out (from a perl advocate's
>perception) why PHP was even invented when it seems that they are so
>similar, perl can do everything it can, and has been around for so much
>longer.
PHP originally was a script written in Perl, conceptually similar to,
say, Mason and embPerl. It's only later that it got rewritten in C (?).
--
Bart.
------------------------------
Date: Wed, 18 Jul 2001 05:17:23 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Perl or PHP?
Message-Id: <slrn9la7kv.vj8.tim@vegeta.ath.cx>
Me parece que Martin Jericho <mjericho.nospam@gmx.net> dijo:
> > On Wed, 18 Jul 2001 00:08:06 +0930, "Martin Jericho"
> > <mjericho.nospam@gmx.net> wrote in comp.lang.perl.misc:
>
> Is this (eperl or mason) as nicely integrated as with PHP?
I haven't looked myself, but does PHP have Apache API hooks, like
mod_perl does?
> Has something been done about the problem that the perl interpreter is too
> "fat"? Is it loaded into common memory now or some other trick?
The perl executable could easily be made as small as PHP, but then it
wouldn't be able to do much more than PHP.
> > Other languages to consider for use on web servers are Python, Ruby and
> > Java (for all platforms) and VisualBasic Script (for Microsoft IIS ASP
> > pages).
> (snip)
>
> The basic thrust of my question was to find out (from a perl advocate's
> perception) why PHP was even invented when it seems that they are so
> similar, perl can do everything it can, and has been around for so much
> longer.
IMNERHO, PHP was created for the same reason M$ FrontPage 98 was. Infer
from that what you will.
But can PHP do everything that Perl can do? Does PHP have the same
level of support as Perl?
--
I respectfully decline the invitation
to join your hallucination.
-- Dilbert
------------------------------
Date: 18 Jul 2001 09:12:10 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: Perl or PHP?
Message-Id: <srj66cq1zjp.fsf@w3proj1.ze.tu-muenchen.de>
someone@home.com (Chris) writes:
> On Wed, 18 Jul 2001 00:08:06 +0930, "Martin Jericho"
> <mjericho.nospam@gmx.net> wrote in comp.lang.perl.misc:
>
> >1. What are the main differences/advantages between perl and PHP? As I
> >understand it, PHP is used inline in HTML and perl is purely a CGI language.
> >In that case, what is the advantage of perl over PHP?
>
> PHP is a scripting language that is exclusively (AFAIK) interpreted by the
> web server. It has no other use other than to generate web pages. It
> performs this task well.
Not quite. Although PHP is frequently embedded in the Apache executable
(similar to mod_perl), it can be compiled to an executable, just like
Perl.
The main difference for me is:
1) Normally you embed PHP code in HTML Pages.
2) Normally you embed HTML in Perl scripts.
Therfore i use PHP when i have much HTML output with few program logic
behind. Say, a personal greeting in an otherwise static page.
OTOH i use Perl when i have much program logic in mostly dynamic pages,
e.g. for greeting cards.
I know, that this is a matter of personal preference. I could use Perl
for static pages, too, using one of the many template modules. Same goes
with PHP.
It just seems more natural to me to select the language by the task to
do. But that's just me ...
As for the _typical_ Web tasks: You can solve them in each of the two
languages. Imho it's just a matter of personal preferences.
-Walter
------------------------------
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 1322
***************************************