[15503] in Perl-Users-Digest
Perl-Users Digest, Issue: 2913 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 1 09:05:26 2000
Date: Mon, 1 May 2000 06:05:08 -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: <957186308-v9-i2913@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 May 2000 Volume: 9 Number: 2913
Today's topics:
Re: "@str" not printing first value of array back to st (Eric Bohlman)
#How to parse and strip perl comments? <phill@modulus.com.au>
[ANNOUNCE] MIME::Lite 1.140 now on CPAN <eryq@zeegee.com>
Re: [IMPORTANT] Content-type to download an image! <lr@hpl.hp.com>
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
ANNOUNCE - Math::Currency 0.6 <ZenoP@Ex-Pressnet.com>
ANNOUNCE - Math::FixedPrecision <ZenoP@Ex-Pressnet.com>
Re: Can't get 'require' to work <gellyfish@gellyfish.com>
Re: Create a file that Read/Write Properties are set to <care227@attglobal.net>
DBI Installation Win2K <fred@fred.com>
explain expression? <info@dk-web.com>
Re: how to "uudecode" binaries? <ub@europe.de>
How to know someone exit? <laoxiu100@hotmail.com>
Image::Size 2.902 uploaded to CPAN (Randy J. Ray)
Re: Is there a way to create a Perl executable. <gellyfish@gellyfish.com>
Re: Net:FTP module not working for me on perl win32... <gellyfish@gellyfish.com>
Re: php, embPerl, mod_perl, help. <anthony@outshine.com>
Re: Please Explain ... print "Location: http:etc."; <flavell@mail.cern.ch>
Re: Please Explain ... print "Location: http:etc."; (Randal L. Schwartz)
Re: program that prints itself (Philip 'Yes, that's my address' Newton)
Pulling my hair out! <waltonic@earbuzz.demon.co.uk>
Question on flock() <james@goodwill.globalnet.co.uk>
Re: Question on flock() (Tad McClellan)
This is sorted... sorry for wasting anyone's time! <waltonic@earbuzz.demon.co.uk>
Re: Weird locale error opening file <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 May 2000 07:49:43 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: "@str" not printing first value of array back to stdout? w/ actives..perl dos-prompt
Message-Id: <8ejcun$g8b$1@nntp9.atl.mindspring.net>
Tad McClellan (tadmc@metronet.com) wrote:
: On Sun, 30 Apr 2000 12:58:04 -0700, jb <jb@datatap.com> wrote:
:
: >2 Why doesn't the first value of the array show up in my MS-DOS window?
:
:
: I dunno.
It's a bug in the Win95/98 console output routines that causes the first
line output after inputting data to be swallowed under certain
circumstances. The only workaround I know of is to always output a blank
line after you're done reading from STDIN.
------------------------------
Date: Mon, 01 May 2000 18:26:38 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: #How to parse and strip perl comments?
Message-Id: <390D3FBE.7BE7@modulus.com.au>
Any clues, please, on how to parse a perl script for comments and remove
them?
It seemed kind of obvious, given perl's simple comment syntax, until I
considered:
1. #!usr/bin/perl
2. for ($i = 0; $i < $#somearray; $i++){
3. where docs
4. pod docs
5. print ' # ';
6. and nn other constructs which validly include '#' in a non-comment
context.
TIA.
--
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/
------------------------------
Date: Thu, 27 Apr 2000 10:43:52 -0400
From: Eryq <eryq@zeegee.com>
Subject: [ANNOUNCE] MIME::Lite 1.140 now on CPAN
Message-Id: <K4cP4.2784$7t.1525706@news-east.usenetserver.com>
A new MIME::Lite has been placed on CPAN.
You should upgrade if any of the following are true:
* Your MIME::Lite is older than 1.137
* You use send_by_smtp() -- it should now handle
multiple addresses, and To:/Cc:/Bcc:, etc. properly.
For those of you sending HTML messages, be sure to check out
the mime_postcard example. Documentation and code are online, at:
http://www.zeegee.com/company/perl.html
Enjoy. As always, yell if it breaks.
------------------------------
Date: Mon, 1 May 2000 00:34:13 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: [IMPORTANT] Content-type to download an image!
Message-Id: <MPG.1376d33d985b387998a9bc@nntp.hpl.hp.com>
In article <8eil15$ku5$1@nnrp1.deja.com> on Mon, 01 May 2000 01:01:32
GMT, Makau Divangamene <makau@multimania.com> says...
...
> my $logo = "logo.gif";
>
> open (IMAGE,$logo) or die $!;
> print "Content-type: application/download\n";
> print "Content-Disposition: attachment; filename=logo.gif\n\n";
> binmode(IMAGE);
> print <IMAGE>;
> close (IMAGE);
...
> PS : I didn't use your suggested read() function since I don't know how
> to use it.
binmode STDOUT;
print while read IMAGE, $_, 8192;
Or whatever size you think appropriate. It doesn't much matter.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 29 Apr 2000 16:31:42 +0000 (GMT)
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <g5cP4.2786$7t.1520513@news-east.usenetserver.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://www.cpan.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
For an alternative way to get answers, check out the Perlfaq website.
http://www.perlfaq.com/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://www.cpan.org/
http://www.perl.com/CPAN/
http://www.cpan.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 26 Apr 2000 02:02:42 +0000
From: John Peacock <ZenoP@Ex-Pressnet.com>
Subject: ANNOUNCE - Math::Currency 0.6
Message-Id: <v2cP4.2778$7t.1510763@news-east.usenetserver.com>
Math::Currency - Exact Currency Math with Formatting and Rounding
This is a major rewrite to enable the use of Math::FixedPrecision for
all math
functions instead of internal functions. It has also been configured to
try
to use Locale formatting if it can, or US defaults if it cannot. The
format
setttings can be considered at best experimental. I need a lot more
data from
other countries to know if what I have done is suffient. You are urged
to use
explicit format values for your country, rather than relying on the
built-in
system without further testing.
To install, do the usual:
perl Makefile.PL
make
make test
make install
Please see the POD for usage instructions...
John Peacock
jpeacock@univpress.com
------------------------------
Date: Wed, 26 Apr 2000 02:01:58 +0000
From: John Peacock <ZenoP@Ex-Pressnet.com>
Subject: ANNOUNCE - Math::FixedPrecision
Message-Id: <I1cP4.2775$7t.1514557@news-east.usenetserver.com>
Math::FixedPrecision - Decimal Math without Floating Point Errors
This module tries to deal with the common situation of not wanting to
use
floating point calculations for decimal numbers. One example is
currency
values, which should never contain partial units (e.g. cents in USD).
Another example is in scientific measurements, where the accuracy should
always be limited to the least accurate data point. A third example is
Floating Point notation errors (e.g., What is 100/9?).
I originally wrote Math::Currency to deal with the first issue; I have
used
it successfully internally for almost a year. I used it to convert from
one
warehouse/order entry system to another, and match the accounts
receivable to
the penny. This module is an attempt to generalize the case to handle
all
arbitrary precision calculations, all implemented internally by
Math::BigInt
values.
To install, do the usual:
perl Makefile.PL
make
make test
make install
Please see the POD file for more details. A new Math::Currency which
will use
this module as a wrapper will be available shortly at a CPAN site near
you...
John Peacock
jpeacock@univpress.com
------------------------------
Date: 27 Apr 2000 19:17:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can't get 'require' to work
Message-Id: <8ea079$1jr$1@orpheus.gellyfish.com>
On Wed, 26 Apr 2000 10:32:38 -0700 Jeff Zucker wrote:
> 4189058@my-deja.com wrote:
>>
>> When I run the script I get a message saying the line with the require
>> statement did not return a true value. Any help would be appreciated.
>
> Read the documentation on require. Notice that it says that your
> required file must return a true value. Usually this means that you
> should put something that evaluates to true as the last line in the
> required file.
>
> So just add something like this to your "include.pl" file at the very
> end of the file:
>
> 1; # this always evaluates to true
>
> Or if you want to be cute:
>
> "false"; # this always evaluates to true
Or if you want to avoid your script getting posessed by demons :
'I am the Lord of Hells Fire';
/J\
--
Lisa, tha mob's working on getting your saxophone back, but we've also
expanded into other important areas...World domination.
--
fortune oscar homer
------------------------------
Date: Mon, 01 May 2000 00:03:56 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Create a file that Read/Write Properties are set to yes
Message-Id: <390D022C.3FD38B16@attglobal.net>
Leroux wrote:
>
> open(OUTPUT_FILE, ">>/disk1/f/public_html//$flemail") or die("Unable to open
> Guestbook data file /disk1/f/public_html//$flemail");
Might $! contain some interesting information?
------------------------------
Date: Mon, 01 May 2000 12:59:52 GMT
From: "Fred" <fred@fred.com>
Subject: DBI Installation Win2K
Message-Id: <cdfP4.12519$x4.460079@newsread1.prod.itd.earthlink.net>
Hi, someone please help me install DBI on my server. I've tried multiple
times, with no luck.
There has to be an easy way to do this, but so far I haven't found this.
I've searched now for many hours and have finally given up on finding the
answer myself. The help would be greatly appreciated.
I've tried using nmake and dmake but they both return errors. I also tried
perl -MCPAN -e 'install Bundle::DBD::Informix'
No luck there either.
If I can't get this to work I'm going to have to turn to Visual Basic,
something I don't want to do.
Thanks in Advance.
John
------------------------------
Date: Mon, 01 May 2000 11:16:33 GMT
From: P-E Rath Holm <info@dk-web.com>
Subject: explain expression?
Message-Id: <k8pqgsosu0mah4le39j77o8echq23it3c6@4ax.com>
Sorry, I dont know much about this, yet.
Will someone try to explain this line for me:
push(@n_a_dates,$hits[($#db_cols+1) * $counter+2])
its the part [($#db_cols+1) * $counter+2] , that I am trying to
understand.
I know that $#db_cols gives the index value ofthe last element of
@db_cols, but the asterisk is not a multiplication?
$counter is just incremented one for each run.
The line puts the value of database column 2 into @n_a_dates
but I would really like to understand what is happening :-)
Køb Bornholmske varer: http://www.BornholmerShoppen.dk/
Sommerhuse på Bornholm: http://www.BornholmSommer.dk/
------------------------------
Date: Mon, 01 May 2000 10:32:08 +0200
From: Ulf Berger <ub@europe.de>
Subject: Re: how to "uudecode" binaries?
Message-Id: <390D4108.8D239A8F@europe.de>
update:
i found the error,
the "uudecode" code works fine under unix but not under windows.
does anyone have a working "uudecode" code for windows (mswin32-x86)?
------------------------------
Date: Mon, 1 May 2000 21:40:54 +0900
From: "sang" <laoxiu100@hotmail.com>
Subject: How to know someone exit?
Message-Id: <8ejtpf$32e$1@nn-os105.ocn.ad.jp>
Hi all
How do i know someone had left my homepage(CGI)?
Thanks in advance
------------------------------
Date: 26 Apr 2000 00:56:21 -0700
From: rjray@tsoft.com (Randy J. Ray)
Subject: Image::Size 2.902 uploaded to CPAN
Message-Id: <T3cP4.2781$7t.1522489@news-east.usenetserver.com>
This version corrects some minor bugs and adds a little more
functionality. An existing test failure was traced to actually being a
case of the test image having been corrupted in my CVS repository. A
new image is in use for that test, now.
Image::Size - Determine the size of images in several common formats
Version: 2.902 (See CHANGES below)
WHAT IS IT
Image::Size is a library based on the image-sizing code in the wwwimagesize
script, a tool that analyzes HTML files and adds HEIGHT and WIDTH tags to
IMG directives. Image::Size has generalized that code to return a raw (X, Y)
pair, and included wrappers to pre-format that output into either HTML or
a set of attribute pairs suitable for the CGI.pm library by Lincoln Stein.
Currently, Image::Size can size images in XPM, XBM, GIF, JPEG, PNG, TIFF
and the PPM family of formats (PPM/PGM/PBM).
I did this because my old WWW server generated a lot of documents on demand
rather than keeping them in static files. These documents not only used
directional icons and buttons, but other graphics to annotate and highlight
sections of the text. Without size attributes, browsers cannot render the
text of a page until the image data is loaded and the size known for layout.
This library enables scripts to size their images at run-time and include
that as part of the generated HTML. Or for any other utility that uses and
manipulates graphics. The idea of the basic interface + wrappers is to not
limit the programmer to a certain data format.
USING Image::Size IN YOUR SCRIPTS
Image::Size has pod documentation that gives a more complete overview, but
in a nutshell:
use Image::Size;
($x, $y) = imgsize("something.gif");
And ($x, $y) is now the width and height of something.gif. 95% of my usage of
this library is in conjunction with Lincoln Stein's CGI.pm:
use CGI ':all';
use Image::Size 'attr_imgsize';
#
# Emit an IMG tag with size attributes:
#
print img({-SRC => '/server/images/arrow.gif',
attr_imgsize('/server_root/server/images/arrow.gif')});
Alternately, if you are running under Apache and mod_perl:
# Assume $Q is an object of class CGI, $r is an Apache request object
$r->print($Q->img({ -src => $imgpath,
attr_imgsize($r->lookup_uri($imgpath)->
filename) }));
BUILDING/INSTALLING
This package is set up to configure and build like a typical Perl extension.
To build:
perl Makefile.PL
make && make test
If Image::Size passes all tests, then:
make install
You may need super-user access to install.
PROBLEMS/BUG REPORTS
Please send any reports of problems or bugs to rjray@tsoft.com.
CHANGES
This is version 2.902:
* Added a file, README.Win32, with special instructions for users on systems
that lack MakeMaker support.
* Worked on the regular expressions that are used on the text-based formats,
in hopes of further smoothing out the rift between UNIX and non-UNIX
systems.
* Added use of Cwd. Filenames passed in are prepended with the current dir
if they aren't already absolute pathnames. This was to fix a subtle problem
where different files with the same relative names (referenced from different
directories) would confuse the cache.
* Added the image type to the cached data. Previously, only dimensions were
cached. Now, a cache-hit returns the same triple returned originally.
* Also added the file's modification-time to the cache, as the (growing!) use
of Image::Size in Apache mod_perl environments found that if an image is
changed, the cache won't notice. Now it does.
* Added recognition of thumbnail-format pics from the popular viewer XV. The
value of image type for these is the string "XV".
* Integrated a patch that makes html_imgsize generate tags that are XHTML-
compliant. Same patch also caught a few doc bugs that I'd missed.
* Added more to the README file and the pod documentation, particularly
dealing with the Apache web server.
* Moved the full change history to a separate file.
CREDITS AND LICENSES
This package is copyright © 1996,1998 by Randy Ray (rjray@tsoft.com) and may be
distributed under terms of the Artistic License used to cover Perl itself.
See the file Artistic in the distribution of Perl 5.002 or later for details
of copy and distribution terms.
Perl module interface by Randy J. Ray (rjray@tsoft.com), original
image-sizing code by Alex Knowles (alex@ed.ac.uk) and Andrew Tong
(werdna@ugcs.caltech.edu), used with their joint permission.
Some bug fixes submitted by Bernd Leibing <bernd.leibing@rz.uni-ulm.de>.
PPM/PGM/PBM sizing code contributed by Carsten Dominik
<dominik@strw.LeidenUniv.nl>. Tom Metro <tmetro@vl.com> re-wrote the JPG
and PNG code, and also provided a PNG image for the test suite. Dan Klein
<dvk@lonewolf.com> contributed a re-write of the GIF code. Cloyce Spradling
<cloyce@headgear.org> contributed the TIFF sizing code and test images.
A fix for reading binary data on PC-ish operating systems was contributed by
Silas Dunsmore <silasd@psyber.com>. Aldo Calpini <a.calpini@romagiubileo.it>
sent in code that was easily adapted to support BMP images (Windows bitmaps).
Fix for a recurring problem with GIF87a files contributed by Matthias Schmitt
<matthias.schmitt@mmp.lu>. Fix for problems with PPM formats on some Win32
versions was contributed by Randy Kobes <randy@theory.uwinnipeg.ca>. The
tip leading to support for XV's thumbnail pics format came from
<inwap@jomis.Tymnet.COM>. A patch to allow html_imgsize to produce valid
output for XHTML, as well as some documentation fixes was provided by Charles
Levert <charles@comm.polymtl.ca>.
--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray rjray@tsoft.com
Campbell, CA randy@byz.org
<A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>
------------------------------
Date: 27 Apr 2000 19:57:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is there a way to create a Perl executable.
Message-Id: <8ea2jg$9kc$1@orpheus.gellyfish.com>
On 26 Apr 2000 01:09:20 GMT Sam Holden wrote:
> On Tue, 25 Apr 2000 17:57:24 -0700,
> Alan Hopper <aahopper@mailbox.ucdavis.edu> wrote:
>>
>>As I understand it Perl gets compiled just before each execution. Is there
>>a way to create Perl object code (i.e. an .exe ) program that does not
>>need to be compiled every time it is run?
>
> Is there anything preventing you from reading the FAQ that answers this
> question?
>
> perldoc perlfaq3
>
Yeah. perldoc compiles to 1.5 meg and comes up with an error :
String found where operator expected at /usr/lib/perl5/5.6.0/i686-linux/POSIX.pm line 24, near "XSLoader::load 'POSIX'"
(Do you need to predeclare XSLoader::load?)
When you run it ;-}
PS maybe an eversowafferthin patch to toke.c to cause that to wrap at just
less than 80 chars ;-}
/J\
--
Donuts. Is there anything they can't do?
--
fortune oscar homer
------------------------------
Date: 27 Apr 2000 19:45:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Net:FTP module not working for me on perl win32...
Message-Id: <8ea1s9$77u$1@orpheus.gellyfish.com>
In comp.lang.perl.misc Kourosh A Mojar <kmojar@bmjgroup.com> wrote:
>
> syntax error at C:/Perl/site/lib/Net/Config.pm line 86, near ">"
Something has gone horribly wrong here - in *my* Config.pm line 86
is *after* the __END__ - I would recommend that you reinstall with a
ppm install libnet
at some command prompt. Unfortunately without a working libnet you are
unlikely to be able to install via ppm over the net like that. You
should download the appropriate zip file from
<http://www.activestate.co/packages/zips/5.6.0/> (I think)
and unpack it then follow the instructions in the ppm documentation
about using a local file to install from.
/J\
--
Don't you ever, EVER talk that way about television.
--
fortune oscar homer
------------------------------
Date: Mon, 01 May 2000 01:42:01 -0700
From: Anthony Boyd <anthony@outshine.com>
Subject: Re: php, embPerl, mod_perl, help.
Message-Id: <anthony-E9B70F.01420101052000@news.slip.net>
nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar) wrote:
> Anthony Boyd <anthony@outshine.com> wrote:
>
> >1. Build .shtml files, use SSI calls to .pl files that use DBI to pull
> >data from mySQL. I like this because I can understand it, and it
> >separates Perl from HTML. But my guess is this is too slow.
>
> Probably too slow.
I'm starting to think I might try it anyway. At least to get me
started. With mod_perl and mySQL, I should be able to handle some
volume. At least I hope so, because I just spent the day trying to
validate pages with ASP, PHP, and even SSJS, and programs like HTML Tidy
and Homesite just barfed on it. I just can't make any progress with all
that code embedded right into the HTML.
> It's harder to write for mod_perl, but much more rewarding.
I went to the URL you suggested, and read until my eyes glazed over
about shared data -- how a global variable will persist across multiple
uses of the Perl programs, and so on. Ouch. It'll make my code cleaner
for certain, but that's a lot of pain for the performance boost. I'll
probably do it anyway.
> Buy "Apache Modules with Perl and C", Stein & MacEachern, O'Reilly.
Done. Thank you so much.
-Tony
------------------------------
Date: Mon, 1 May 2000 12:37:21 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Please Explain ... print "Location: http:etc.";
Message-Id: <Pine.GHP.4.21.0005011233170.3168-100000@hpplus01.cern.ch>
On Sun, 30 Apr 2000, Drew Simonis wrote:
> Where do you learn all this???
I don't think I can help you with that question (maybe it's off topic
anyway ;-). A few things I confidently understand, having picked them
up as I went along. Most of what I do every day is a complete muddle,
but you don't get to see much of that here (on those topics, I usually
play the part of a lurker).
--
Partake of distilled wisdom of Usenet - read the FAQs.
Before you ask.
------------------------------
Date: 01 May 2000 03:57:36 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Please Explain ... print "Location: http:etc.";
Message-Id: <m1r9bmleqn.fsf@halfdome.holdit.com>
>>>>> "Alan" == Alan J Flavell <flavell@mail.cern.ch> writes:
Alan> On Sun, 30 Apr 2000, Drew Simonis wrote:
>> Where do you learn all this???
Alan> I don't think I can help you with that question (maybe it's off topic
Alan> anyway ;-). A few things I confidently understand, having picked them
Alan> up as I went along. Most of what I do every day is a complete muddle,
Alan> but you don't get to see much of that here (on those topics, I usually
Alan> play the part of a lurker).
I think Alan's making a good point. Alan knows what he knows, and
knows when he doesn't know, and knows enough to shut up on the latter.
There are many others here (do I need to name names and aliases? :)
that don't know when they don't know, and speak anyway. Thus, Alan
comes out looking like a saint, and the others, well, you get the
drift.
Me, I'm somewhere in the middle. Most of the time when I'm confident,
I speak with authority, and am occasionally wrong (and accept
corrections gladly). Sometimes, when I'm guessing, I guess right, but
I at least label it a guess. Occasionally, when I think I don't have
a clue, I give it a whack anyway, and turn out fine, or at least learn
something in the process.
print "Just another Perl hacker," # and applied armchair philosopher... :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 01 May 2000 06:16:50 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: program that prints itself
Message-Id: <390c5c3d.17238074@news.nikoma.de>
On Sat, 29 Apr 2000 15:57:46 +0800, "John Lin" <johnlin@chttl.com.tw>
wrote:
>I wonder what the program would be like in Perl.
>Will you try to solve it?
My favourite prints itself to STDERR, not STDOUT:
Create a file called /tmp/quine.pl, containing the following line:
Illegal division by zero at /tmp/quine.pl line 1.
When run, it will produce itself as output. (This even works under
Windows; put the file into \tmp\quine.pl but call it as 'perl
/tmp/quine.pl'.)
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 1 May 2000 11:12:49 +0100
From: "Adam T Walton" <waltonic@earbuzz.demon.co.uk>
Subject: Pulling my hair out!
Message-Id: <957176011.20224.0.nnrp-13.d4e441b4@news.demon.co.uk>
Please help... this is the first time I have come across regular expressions
and I can't seem to get them to do what I want them to! I can get them to
work fine for boolean matches and testing, but when I try and extract the
matches the whole thing goes a bit pear-shaped!
All I want to do is extract double-quoted strings from an input string that
might contain a mixture of double quoted, and non-quoted strings...
eg.
"murry the hump" big leaves "terris" catatonia "60ft dolls"
a regexp that would extract "murry the hump", "terris" and "60ft dolls" and
stick them into an array.
I have been trying variations of:-
@chopped=/"([^"]+)"/g;
This works but totally ignores the first double-quoted string (ie. in the
above example @chopped would contain "terris" and "60ft dolls", but NOT
"murry the hump"!!!!)... why why why why????
I am almost certain that this is the Perl equivalent of taking your computer
to a repairman, only to be told that you need to plug it in and switch it on
for it to work... but, sometimes, the answer that is staring you in the face
is the hardest one to see!
Thanks in advance to anyone who has the inclination to help me
It will be MUCH appreciated :)
Adam
------------------------------
Date: Mon, 1 May 2000 10:47:00 +0100
From: "James Goodwill" <james@goodwill.globalnet.co.uk>
Subject: Question on flock()
Message-Id: <8ejk1k$35e$1@gxsn.com>
Hello,
I've written an application where two UNIX processes update the same UNIX
file.
I can achieve 'write' consistency by using flock exclusive (with blocking).
However one process also need to open the file for reading. How do I achieve
'read' consistency, i.e. when one process is updating the file, the other
process 'reading' it should wait for the update process to complete ?
I don't want the 'read' process to have access to the file while it is being
'updated', because it may 'capture' the data within the file in a
transitional state.
It what I require already being done (behind the scenes) by the operating
system ?
Any help gratefully appreciated.
Thanks.
------------------------------
Date: Mon, 1 May 2000 07:28:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Question on flock()
Message-Id: <slrn8gqqjg.116.tadmc@magna.metronet.com>
On Mon, 1 May 2000 10:47:00 +0100, James Goodwill <james@goodwill.globalnet.co.uk> wrote:
>I've written an application where two UNIX processes update the same UNIX
>file.
>
>I can achieve 'write' consistency by using flock exclusive (with blocking).
>
>However one process also need to open the file for reading. How do I achieve
>'read' consistency, i.e. when one process is updating the file, the other
>process 'reading' it should wait for the update process to complete ?
use flock shared (LOCK_SH) instead of exclusive (LOCK_EX)
exclusive locking will work for reading too, but is more
restrictive than need be.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 1 May 2000 12:29:08 +0100
From: "Adam T Walton" <waltonic@earbuzz.demon.co.uk>
Subject: This is sorted... sorry for wasting anyone's time!
Message-Id: <957180634.22590.0.nnrp-13.d4e441b4@news.demon.co.uk>
There was a 'hidden' problem earlier in the programme, but it's working
now...
/"([^"]+)"/g && "ed();
if the string matched the criteria in the regexp it sent it to a subroutine
to put the double quoted strings into an array... once I took the /g
modifier off the end of the test everything worked fine... I'm not sure
why... but I'm going to work it out!
Also, I've just taken the time to read through some of the other postings
here, and some of the guidelines for general postings to newsgroups, and
will ensure that I adhere to them in the future.
Thanks
------------------------------
Date: 27 Apr 2000 19:25:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Weird locale error opening file
Message-Id: <8ea0lu$33u$1@orpheus.gellyfish.com>
On Wed, 26 Apr 2000 17:18:22 +0200 Frank van Wensveen wrote:
> Dear Perlologists,
>
> I have a weird problems that seems to be related to locale files being
> not present. It looks like my program tries to open some locale libc
> file that isn't there, but I have no idea why my program tries to open
> it, and why the resulting $! mumbles about an invalid argument. If
> anyone knows what's going on here, a response would be appreciated.
>
>
> I'm trying to open a tied hash using the DB_File module for reading
> with the following call:
>
> $DB_BTREE->{'flags'} = R_DUP ;
> $dictfile = "/searchdata/search.idx";
> $x = tie (%dict, "DB_File", "$dictfile", O_RDONLY, 0644, $DB_BTREE) ||
> die ("Error opening $dictfile: $!\n");
>
> This works well, except while another Perl program is running in the
> background which updates the same file, i.e. has it open for writing,
> with the following call:
>
> $DB_BTREE->{'flags'} = R_DUP; # Enable duplicate keys
> tie (%dict, "DB_File", "$dictfile", O_RDWR|O_CREAT, 0644, $DB_BTREE)
> || die ("Error writing $dictfile: $!\n");
>
> This happens in Perl 5.004 under Slackware Linux 2.0.36, but not in
> Perl 5.005 under Solaris 2.7.
> I did an I/O trace (using 'strace') which shows the following:
>
> open("searchdata/search.idx", O_RDONLY) = 3
> fcntl(3, F_SETFD, FD_CLOEXEC) = 0
> fstat(3, {st_mode=S_IFREG|0644, st_size=1048576, ...}) = 0
> read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 24) = 24
> close(3) = 0
> stat("/etc/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such file
> or directory)
> stat("/usr/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such
> file or directory)
> stat("/usr/share/locale/libc/C", 0xbffff734) = -1 ENOENT (No such file
> or directory)
> stat("/usr/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No such
> file or directory)
> stat("/usr/local/share/locale/C/libc.cat", 0xbffff734) = -1 ENOENT (No
> such file or directory)
> write(2, "Error opening searchdata/search."..., 54Error opening
> searchdata/search.idx: Invalid argument) = 54
> sigprocmask(SIG_SETMASK, [], NULL) = 0
> _exit(22) = ?
>
This is a total red herring. What is the error message you get from
Perl ?
/J\
--
Safety? But sir! If truth be known, I actually caused more accidents
around here than any other employee, including a few doozies no one
every found out about.
--
fortune oscar homer
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 2913
**************************************