[17195] in Perl-Users-Digest
Perl-Users Digest, Issue: 4607 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 13 14:05:38 2000
Date: Fri, 13 Oct 2000 11:05:19 -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: <971460319-v9-i4607@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 13 Oct 2000 Volume: 9 Number: 4607
Today's topics:
Re: "Commafying" numbers <tim@ipac.caltech.edu>
Re: [ Wildly OT ] Re: Japanese Girl Has PERL Request. <jeff@vpservices.com>
Re: [ Wildly OT ] Re: Japanese Girl Has PERL Request. <russ_jones@rac.ray.com>
Re: about sendmail <nospam@xepec.com>
Re: Can Perl or another language... nobull@mail.com
Re: Convert array to string? nobull@mail.com
Re: Cookieless operation <philipg@atl.mediaone.net>
Re: Cookieless operation <bart.lateur@skynet.be>
Re: Difference between '=' and '.=' operators (Sean McAfee)
Re: Difference between '=' and '.=' operators <uri@sysarch.com>
Re: Downloadable reference manual? nobull@mail.com
Re: Giant Array Delay (beginner) peliknish@my-deja.com
Re: Giant Array Delay (beginner) peliknish@my-deja.com
How can i execute program in dos <keisari_@hotmail.com>
Re: How can i execute program in dos <bart.lateur@skynet.be>
Re: How to extract a patteren from a text file? <kistler@gmx.net>
Re: How to get params after use Mod? (Mark-Jason Dominus)
Re: How to use bidirectional pipe at perl? <carfield@programmer.net>
Re: How to use bidirectional pipe at perl? nobull@mail.com
I need a DB solution <berube@odyssee.net>
Re: Japanese Girl Has PERL Request. <russ_jones@rac.ray.com>
Re: Keeping data structures private. nobull@mail.com
Re: looking for links to Perl+mysql how-to's - tutorial <kellikellin@netscape.net>
Re: Make a new directory in perl? <bart.lateur@skynet.be>
Re: Maximum file size? <jim@usjet.net>
Re: Maximum file size? <berube@odyssee.net>
Re: Maximum file size? <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Oct 2000 10:28:39 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: "Commafying" numbers
Message-Id: <39E74647.2AD1FE72@ipac.caltech.edu>
Johnno wrote:
>
> Before I spend time writing my own code to perform this task, is anyone aware
> of a module (or function included in the standard Perl 5.0 library) which
> will "commafy" a number? Ie, take a scalar such as 2150000 and insert commas
> in the appropriate places, thus turning it into 2,150,000? It would also
> need to accommodate floating point and negative numbers.
Well, not a module exactly. There is the dicumentation, though:
perl -q commas
=head1 Found in /usr/local/lib/perl5/5.6.0/pod/perlfaq5.pod
=head2 How can I output my numbers with commas added?
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Fri, 13 Oct 2000 09:30:43 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: [ Wildly OT ] Re: Japanese Girl Has PERL Request.
Message-Id: <39E738B3.71320892@vpservices.com>
Keith Calvert Ivey wrote:
>
> ebohlman@omsdev.com (Eric Bohlman) wrote:
> >Jeff Zucker <jeff@vpservices.com> wrote:
> >> I was making a reference about the time a few years back when the ACLU
> >> defended the right of the Ku Klux Klan (a group of racist *#*holes) to
> >> march in Skokie, Il. It wasn't a funny event. I know people who
> >> supported ACLU and others who went to Skokie to heckle the Klan and some
> >> who did both. (no smilie)
> >
> >Actually, it was the American Nazi Party.
Oh my goodness, you are of course correct, it was *that* group of racist
*#*holes.
> And I'm not sure whether 1977 counts as "a few years back".
> I guess it depends on how old one is.
Old enough to have memory lapses apparently. :-)
--
Jeff
------------------------------
Date: Fri, 13 Oct 2000 12:25:28 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: [ Wildly OT ] Re: Japanese Girl Has PERL Request.
Message-Id: <39E74588.1F92BF69@rac.ray.com>
Logan Shaw wrote:
>
>
> Why am I reminded of a scene from the movie "The Blues Brothers"?
Hey, where are all the white women? - Bart the Sherrif in Blazing
Saddles
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Fri, 13 Oct 2000 15:51:49 GMT
From: "Andrew Serukov" <nospam@xepec.com>
Subject: Re: about sendmail
Message-Id: <pcGF5.6338$uw4.216630@newsread2.prod.itd.earthlink.net>
The ways of doing that are in RFC2557 "MIME Encapsulation of Aggregate
Documents, such as HTML (MHTML)" :-
http://www.rfc-editor.org/rfc/rfc2557.txt
Again, I dont know of any MUAs / filters that could do that either.
--Andrew
"Grant Edwards" <ge@nowhere.none> wrote in message
news:frFF5.694$FU3.145149@ptah.visi.com...
> In article <8s61gv$747$1@provolone.cs.utexas.edu>, Logan Shaw wrote:
>
> >Furthermore, as far as I know, there is no URL type that refers
> >to othre attachments within a MIME message. If there were, one
> >could send an e-mail with images attached that were referred to
> >by an HTML file that was also attached, which would be very
> >close to sending a web page by e-mail.
>
> I've seen exactly that done. I don't believe it's a standard
> URL format, and I don't know how many MUAs impliment such a
> scheme, but some do.
>
> --
> Grant Edwards grante Yow! Why is everything
> at made of Lycra Spandex?
> visi.com
>
------------------------------
Date: 13 Oct 2000 18:27:56 +0100
From: nobull@mail.com
Subject: Re: Can Perl or another language...
Message-Id: <u94s2gzm5f.fsf@wcl-l.bham.ac.uk>
aaaaa@aaabaaa.aaa writes:
> Subject: Re: Can Perl or another language...
Congratulations - you win today's prize for most pointless
"Subject:". In case you handn't guessed, purpose of a subject line is
to give people a clue what you are writing about before they decide to
read it. FYI here is an extract from RFC822:
4.7. OTHER FIELDS
4.7.1. SUBJECT
This is intended to provide a summary, or indicate the
nature, of the message.
> I want to "steal" information from a redirection script. When i connect
> (LWP) to the script.pl i get back all the information from the page it
> redirected me to but how can i find out which url it redirected me to?
Override the redirect_ok method of LWP::UserAgent to record the URI
from the redirected request. Although it is not documented the
redirected request object is passed as an argument to redirect_ok().
If you want anything more than the redirect location from the redirect
response then you'll have to use the simple_request() method rather
than the request() method.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 13 Oct 2000 18:21:31 +0100
From: nobull@mail.com
Subject: Re: Convert array to string?
Message-Id: <u98zrszmg4.fsf@wcl-l.bham.ac.uk>
"Mike Balenger" <MBalenger@att.net> writes:
> You see that the => is actually used in an *array*. The array is then used
> to initialize the hash.
Bzzzt...! You mean *list* not *array* :-)
FAQ: "What is the difference between a list and an array?"
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Oct 2000 15:42:25 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: Cookieless operation
Message-Id: <B3GF5.15470$QB1.4116274@typhoon.southeast.rr.com>
<yossariancomputing@my-deja.com> wrote in message
news:8s77au$lpo$1@nnrp1.deja.com...
> Hi,
>
> I want to maintain state within a web application without using
> cookies, as personally I detest the things, and besides, I don't want
> to worry if a user hates them too and thus can't use my application
> because they've turned them off.
>
> So somehow I suppose I need to use a manually created sessionid of some
> sort.
>
> I'm using perl 5.006 (with libwww-perl), apache, mysql on a FreeBSD
> machine.
>
> Any tips?
Try Apache::Session. Use a hidden session_id field in your forms instead of
a cookie.
hth,
p
------------------------------
Date: Fri, 13 Oct 2000 17:53:48 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Cookieless operation
Message-Id: <acieusssg68rmt0usscknmetaim58pphf6@4ax.com>
yossariancomputing@my-deja.com wrote:
>I want to maintain state within a web application without using
>cookies, as personally I detest the things, and besides, I don't want
>to worry if a user hates them too and thus can't use my application
>because they've turned them off.
>
>So somehow I suppose I need to use a manually created sessionid of some
>sort.
>
>Any tips?
* $ENV{PATH_INFO}
You can append an extra "path" to the URL of your script. The script
will be called, and the environment variable PATH_INFO will be set to
this string.
http://your.domain/path/to/script.cgi/extra/path/info.html
This sometimes doesn't work on stupid MS servers. And then they pretend
that this failure is intentional.
* Move around in your site using an extra form variable, or by
appending "?session=blahblablah" to the URL.
I once found a CGI FAQ which described all this in a bit more detail.
Urm... Ah, yes.
<http://www.uni-giessen.de/faq/archiv/www.cgi-faq/msg00000.html>
Refer to question 3.12.
--
Bart.
------------------------------
Date: Fri, 13 Oct 2000 16:09:01 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Difference between '=' and '.=' operators
Message-Id: <xsGF5.6900$O5.144870@news.itd.umich.edu>
In article <x7aec9xt2s.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "SM" == Sean McAfee <mcafee@waits.facilities.med.umich.edu> writes:
> SM> while (($key, $value) = some_func()) {
> SM> exists $hash{$key} ? ($hash{$key} .= "\n$value") : ($hash{$key} = $value);
> SM> }
>you should really use an anon array like you said. it makes life so much
>easier than a concatenated string of keys.
In general I would, but the keys and values in this case represent mail
header fields. A key will recur if the associated header field does, and
pretty much the only header field that commonly repeats is "Received", so
it seems wasteful to me to use an anonymous array when most of them will
only have one element. This code is for an interactive mail client, so
parsing speed is of the essence. Also, filtering and sorting expressions
can be specified by the user at run time, and pattern matching is the most
common operation that will be performed. I think it's more reasonable to
require the user to type:
Subject =~ /perl/
(not caring which of any repeated header fields matched) than:
0 < grep /perl/, @{ Subject() }
A user who cares about individual repeated fields can use split().
> SM> perl -le '$a{foo} = exists $a{foo} && "bar"; print $a{foo}'
> SM> ...prints nothing, as expected. Even this prints nothing:
> SM> perl -le '$a{foo} = $a{foo} . (exists $a{foo} && "bar"); print $a{foo}'
> SM> So does anyone know why .= is so different?
>remember, .= like other assignment ops are really not the same as their
>logical expansion. they do internal shortcuts for speed as they know
>stuff like in this case $a{foo} is going to be a string. so it needs to
>have a string value to append to and it will coerce an undef value to
>''. so it then has to set the key in the hash for that value of '' so
>exists is now true. make sense? in your two examples above, $a{foo} is
>not created until the full expression is evaluated and then the key is
>made. with .= the left side is forced into a string before the
>expression is evaluated as it know it will be one.
Okay, that makes sense, but the hash value is created with a value of
undef, not "", as evinced by the fact that I get the results I want by
using defined().
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Fri, 13 Oct 2000 17:38:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Difference between '=' and '.=' operators
Message-Id: <x7zok8wsi6.fsf@home.sysarch.com>
>>>>> "SM" == Sean McAfee <mcafee@waits.facilities.med.umich.edu> writes:
SM> In general I would, but the keys and values in this case represent mail
SM> header fields. A key will recur if the associated header field does, and
SM> pretty much the only header field that commonly repeats is "Received", so
SM> it seems wasteful to me to use an anonymous array when most of them will
SM> only have one element. This code is for an interactive mail client, so
SM> parsing speed is of the essence. Also, filtering and sorting expressions
SM> can be specified by the user at run time, and pattern matching is the most
SM> common operation that will be performed. I think it's more reasonable to
SM> require the user to type:
SM> Subject =~ /perl/
SM> (not caring which of any repeated header fields matched) than:
SM> 0 < grep /perl/, @{ Subject() }
SM> A user who cares about individual repeated fields can use split().
that puts the programming burden on the user. but it's your design
decision.
SM> Okay, that makes sense, but the hash value is created with a value of
SM> undef, not "", as evinced by the fact that I get the results I want by
SM> using defined().
but remember that .= will coerce the undef to '' before
concatenating. '' is a defined value.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 13 Oct 2000 18:20:02 +0100
From: nobull@mail.com
Subject: Re: Downloadable reference manual?
Message-Id: <u9aec8zmil.fsf@wcl-l.bham.ac.uk>
dha@panix.com (David H. Adler) writes:
> On 10 Oct 2000 09:31:34 +0100, nobull@mail.com <nobull@mail.com>
> wrote:
>
> >If you have Perl you already have an abbridged version of the Camel
> >book available via the perldoc mechanism.
>
> Abridged??
OK, "concise".
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Oct 2000 15:50:46 GMT
From: peliknish@my-deja.com
Subject: Re: Giant Array Delay (beginner)
Message-Id: <8s7b0i$p5i$1@nnrp1.deja.com>
In article <slrn8ue3q8.jlo.tjla@thislove.dyndns.org>,
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:
> I was shocked! How could peliknish@my-deja.com <peliknish@my-deja.com>
> say such a terrible thing:
> >howdy,
> >Just starting to learn perl/cgi.
> >
> >Got a script working (by Matt Wright) that picks random strings from
a
> >list of strings in a text file delimited by whatever.
>
> Here's a hint. Don't use any script by Matt Wright. Ever. Ever. Ever.
> Everytime I see some excrescence by this person it makes me want to be
> physically ill. I have no idea why his script is not working, possibly
> (since it loads the whole file into memory at once) it has simply run
> out of memory. Anyway try this version instead, unlike his, it will
> require a version of perl starting with the digit '5'. It also
supports
> multiple files, uses less memory and is possibly faster. It also works
> for me :)
>
> #!/usr/bin/perl -w
> use strict;
> use CGI qw(:standard);
> use CGI::Carp qw(fatalsToBrowser);
>
> # change this to the name of the directory
> # and the name of the files in that directory that
> # you are getting the lines from
> @ARGV = map { '/usr/share/games/fortunes/' . $_ }
> qw(education cookie computers wisdom work);
>
> # change this to whatever the delimiter is supposed to be
> $/ = "\n%\n";
>
> my $line;
>
> # see "perldoc -q 'random line'"
> rand ($.) < 1 && ($line = $_) while (<>);
>
> chomp $line;
>
> print header,
> start_html('Fortune Cookies'),
> h1('A New Fortune Cookie'),
> pre,
> $line,
> end_html;
Thanks for the code Gwyn. Now if you could just give me a couple more
bits of information you can save me from actually having to learn
anything from a book.
Could you show me how the name of the text file, let's call
it "word_list.txt", plugs into
@ARGV = map { '/usr/share/games/fortunes/' . $_ }
qw(education cookie computers wisdom work);
And is it implemented on an .html page like this?:
<!--#exec cgi="/cgi-bin/gwynjudds_script.pl"-->
Thanks again,
kurt
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 13 Oct 2000 15:58:30 GMT
From: peliknish@my-deja.com
Subject: Re: Giant Array Delay (beginner)
Message-Id: <8s7bf0$pk4$1@nnrp1.deja.com>
In article <slrn8ue3q8.jlo.tjla@thislove.dyndns.org>,
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:
> I was shocked! How could peliknish@my-deja.com <peliknish@my-deja.com>
> say such a terrible thing:
> >howdy,
> >Just starting to learn perl/cgi.
> >
> >Got a script working (by Matt Wright) that picks random strings...
By the way, I didn't mean this to be a criticism of Matt Wright. I
know nothing about Matt Wright's scripting skill.
ciao
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 13 Oct 2000 18:15:23 +0300
From: joonas <keisari_@hotmail.com>
Subject: How can i execute program in dos
Message-Id: <39E7270B.166E11B3@hotmail.com>
How can i execute program "capture.exe" with Perl-script every 15
minutes.
I think its some king of wait function.
My platform is MS-DOS.
Joonas.
------------------------------
Date: Fri, 13 Oct 2000 17:57:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How can i execute program in dos
Message-Id: <63jeuso0ik3qaffeukaotdacfsgbesaqvv@4ax.com>
joonas wrote:
>How can i execute program "capture.exe" with Perl-script every 15
>minutes.
>I think its some king of wait function.
>My platform is MS-DOS.
See if you can find a "cron" utility for DOS. Your best chance is under
DJGPP (GNU for DOS).
Well, this FTP directory looks promising.
<http://sunsite.org.uk/packages/dos/simtel/msdos/cron/>
--
Bart.
------------------------------
Date: Fri, 13 Oct 2000 16:54:31 +0200
From: Per Kistler <kistler@gmx.net>
To: qureshii@my-deja.com
Subject: Re: How to extract a patteren from a text file?
Message-Id: <39E72227.D3643278@gmx.net>
#!/usr/bin/perl -n
$_ =~ s/^\s*#include\s*<(.*?)>.*$/$1/ or next; print;
Used as:
prog *.cpp
Per.
qureshii@my-deja.com wrote:
>
> Hi I am a new perl student and what I need to do it to write a script
> which takes in a C++ file and print out all the files listed only in
> #include<iostream.h>
> #include<hello.c>
------------------------------
Date: Fri, 13 Oct 2000 15:46:17 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: How to get params after use Mod?
Message-Id: <39e72e49.441c$24b@news.op.net>
In article <8s6rso$q5u$1@lublin.zrz.tu-berlin.de>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>It does?
It doesn't; I was mistaken. I had forgotten that I only showed how to
use the Exporter.
Sorry!
------------------------------
Date: Sat, 14 Oct 2000 01:25:25 +0800
From: Carfield Yim <carfield@programmer.net>
To: Per Kistler <kistler@gmx.net>
Subject: Re: How to use bidirectional pipe at perl?
Message-Id: <39E74585.5F330622@programmer.net>
Per Kistler wrote:
>
> For instance:
>
> use IPC::Open2;
>
> $pid = open2(\*R,\*W,"bc");
> $pid || die "did not work as expected:$!";
>
> print W "8*3\n";
> print $answer = <R>;
> print W "quit\n";
>
> Per.
>
Thx a lot!! But I still have problem, I successful run your example, but
when I run the following example:
use IPC::Open2;
print "before open\n";
$pid = open2(\*R, \*W, "wc -w");
$pid || die "did not work as expected:$!";
$word = "Hello World\n";
print W "echo $word";
print $ans = <R>;
The process is hold and like to wait for something, how can I solve this
problem?
------------------------------
Date: 13 Oct 2000 18:45:06 +0100
From: nobull@mail.com
Subject: Re: How to use bidirectional pipe at perl?
Message-Id: <u9wvfcy6sd.fsf@wcl-l.bham.ac.uk>
Carfield Yim <carfield@programmer.net> writes:
> use IPC::Open2;
>
> print "before open\n";
> $pid = open2(\*R, \*W, "wc -w");
> $pid || die "did not work as expected:$!";
>
> $word = "Hello World\n";
> print W "echo $word";
> print $ans = <R>;
>
> The process is hold and like to wait for something, how can I solve this
> problem?
Close W before you try to read from R since "wc -w" won't produce any
ouput until it has read all its input.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Oct 2000 12:38:46 -0400
From: "Neb" <berube@odyssee.net>
Subject: I need a DB solution
Message-Id: <yRGF5.8$a8.1312@news.globetrotter.net>
Ok,
I don't have anymore choice, I need a DB for my web site (which now has more
than 600 members).
Here are the facts: my web site "engine" is in Perl, that I develop on my PC
(Windows 98). My site is hosted by a "free" server on the internet (so, I
don't have the control on the server) which is running some flavor of Unix.
Since I entend for my site to have one day thousands of members, I need a DB
that I could change for something like SQL Server using ODBC. But for now,
I would maybe like to use Access, since I have it, plus it's easy to
manipulate the data in it.
But if I don't have much access to my internet server, plus it's Unix, is it
a good idea to use Access (and how)?!
Or is there an other DB I can use that I don't need some kind of DB server
to access it (not like MySql which needs to install a server to access a DB)
? Some DB that can be used under Windows and Unix ?
Thanks for the help!
neb
------------------------------
Date: Fri, 13 Oct 2000 12:22:52 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Japanese Girl Has PERL Request.
Message-Id: <39E744EC.1E00395D@rac.ray.com>
brian d foy wrote:
>
> you should thank porn site operators. they are the ones that
> push the technology. seriously. you should see some of the
> network setups the big sites have. they push a serious amount
> of bits.
>
Brian's got a point. Home VCR technology was greatly influenced by the
porn industry, and particularly by Sony's reluctance to license the
superior Beta format. I remember reading a report that said that some
massive percent of all web traffic was porn. And they've sure been
leaders in pop-up browser window technology. (So I've been told.)
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: 13 Oct 2000 18:19:16 +0100
From: nobull@mail.com
Subject: Re: Keeping data structures private.
Message-Id: <u9d7h4zmjv.fsf@wcl-l.bham.ac.uk>
13_hellfish@my-deja.com writes:
> How do I keep a data structure private? I need to access both a hash
> and an array in a subroutine. So, I'm passing references to the
> subroutine via \.
>
> Now in the subroute, It's easy to to get at the data, with @$, but I
> would like this data read only. I'm not yet so great of a coder and
> would like this extra protection.
One solution would be to use Tie::Watch with callbacks that carp() for
all operations that modify the variable.
This has quite a significant a performance impact so you'd probably
want to remove it again in production code.
#!/usr/bin/perl -w
use strict;
use constant DEBUGGING => 1;
sub readonly_callback {
require Carp;
local $Carp::CarpLevel = 1;
Carp::carp('Tried to modify read-only value');
}
sub readonly {
return unless DEBUGGING;
require Tie::Watch;
Tie::Watch->new(
-variable => $_,
-clear => \&readonly_callback,
-extend => \&readonly_callback,
-pop => \&readonly_callback,
-push => \&readonly_callback,
-shift => \&readonly_callback,
-splice => \&readonly_callback,
-storesize => \&readonly_callback,
-unshift => \&readonly_callback,
-store => \&readonly_callback,
-delete => \&readonly_callback
) for @_;
}
sub foo {
my ($array) = @_;
readonly $array;
$array->[0]=1;
}
foo([1]);
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 13 Oct 2000 10:25:23 -0500
From: kelli norman <kellikellin@netscape.net>
Subject: Re: looking for links to Perl+mysql how-to's - tutorials etc
Message-Id: <39E72963.EC99B563@netscape.net>
"Jon S." wrote:
>
> On Sat, 7 Oct 2000 12:00:59 +1000, "Robert Chalmers"
> <robert@chalmers.com.au> wrote:
>
> >Looking for links to sites with howto's - tutorials - examples - code
> >examples and so on.
> >
> >Does anyone know of a couple of good ones they can recommend. I know - I
> >could spend hours searching but maybe someone can offer a short cut.
>
> I'm just a newbie, but...
>
> I mainly found links for PHP and MySQL. My standard places _online_
> are the OReilly online chapter for the mSQL/MySQL book, the DBI/DBD
> docs, and www.mysql.com. You can also try slashcode.com for many
> examples. But, they're hard to grok if you're new at it, and not
> necessarily the best form, etc. by nature.
>
> But, the best tutorial I've found was "Programming the Perl DBI" from
> OReilly. A great book for the beginner who knows a little (or a lot?)
> of Perl already.
>
> Jon
another good place is the mysql manual (located online at
www.mysql.com). look under the section entitled 'mysql client tools and
apis' - there's a subsection entitled 'mysql perl api'. i'm using mysql
+ perl to collect and serve info via the web. good luck.
------------------------------
Date: Fri, 13 Oct 2000 17:39:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Make a new directory in perl?
Message-Id: <u4ieus8i0j7ivajnqn317hepedb7cgse3j@4ax.com>
Tony Curtis wrote:
>> Nope, what it was (just phoned host) is a security
> ^^^^
>> measure. They have now some how enabled me to do
>> this. Works ok now.
>
>So this is really a CGI question then?
No.
CGI questions are only those questions related to the interface between
your script and a web server.
This is just as much not a CGI question as it is not a Perl question.
--
Bart.
------------------------------
Date: Fri, 13 Oct 2000 11:12:00 -0500
From: "Jim Gaasedelen" <jim@usjet.net>
Subject: Re: Maximum file size?
Message-Id: <MuGF5.118$yP.145974@news.uswest.net>
"Neb" <berube@odyssee.net> wrote in message
news:alDF5.1$eO1.454@news.globetrotter.net...
> Hi,
>
> I have a web site where I store all my members in a flat file (no DB).
> Everytime a new user become a member, I add his information in the file by
> reading all the file content in memory, make sure he doesn't exist yet,
and
> then store all content back on disk. When the user logs in, I read all
file
> in memory, and make sure he is a real member. So far, the file size is of
> 90 KB and the time to read in memory and write on disk the file content is
> fast.
>
> My question: is there a maximum size where I will start to see some
problems
> using this method? Is 1 Meg file size start to be a problem ?
>
> Thanks,
>
> neb
>
>
>
It depends on the amount of RAM memory available to you. If this is your
computer and you can change the memory, you are only limited by the limits
on the computers memory. If the computer that is hosting your
web site belongs to your ISP or hosting service, you will start to bog down
their computer past a certain unknown point. Reading large files into memory
for processing is never a very elegant solution but I'm sure you know that.
There are many freeware algorithms out there that have been developed by
persons for whom it is not an option to read everything into memory. You
should put in place a more scalable solution that does not require that the
entire file be read into memory. But as I said, if you own the computer and
it is totally dedicated to your web site, you can put a gig of memory (in
some computers) into it and read huge files without a problem.
------------------------------
Date: Fri, 13 Oct 2000 12:41:25 -0400
From: "Neb" <berube@odyssee.net>
Subject: Re: Maximum file size?
Message-Id: <_TGF5.9$a8.1353@news.globetrotter.net>
Thanks for the help, but I don't think MySQL runs under Windows, rigth ?
Plus, I can't install MySQL server on an Internet Server which is not my
computer. Is there an other solution ?
neb
Rafael Garcia-Suarez <rgarciasuarez@free.fr> a écrit dans le message :
slrn8ue3be.4tb.rgarciasuarez@rafael.kazibao.net...
> Neb wrote in comp.lang.perl.misc:
> >Hi,
> >
> >I have a web site where I store all my members in a flat file (no DB).
> >Everytime a new user become a member, I add his information in the file
by
> >reading all the file content in memory, make sure he doesn't exist yet,
and
> >then store all content back on disk. When the user logs in, I read all
file
> >in memory, and make sure he is a real member. So far, the file size is
of
> >90 KB and the time to read in memory and write on disk the file content
is
> >fast.
> >
> >My question: is there a maximum size where I will start to see some
problems
> >using this method? Is 1 Meg file size start to be a problem ?
>
> This is not a good idea to store such data in files. 90 kB is large
> enough and you should upgrade now to a DB.
>
> Advantages of a DB :
> - much faster access.
> - concurrent access (with your current method, if two processes want
> to open the file for writing at the same time, one will be locked
> out, waiting for the other to complete).
> - ability to store much complex information when your site will evolve
>
> If you really don't want to (or if you cannot) use a DB, at least
> rewrite your scripts so that they don't load the whole file in memory.
>
> A good DB for your purpose might be MySQL (http://www.mysql.com/), which
> is free software.
>
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 13 Oct 2000 09:57:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Maximum file size?
Message-Id: <39E73F0B.585783EA@stomp.stomp.tokyo>
Neb wrote:
> Thanks for the help, but I don't think MySQL runs under Windows, rigth ?
> Plus, I can't install MySQL server on an Internet Server which is not my
> computer. Is there an other solution ?
(snipped)
Split your data base into twenty-six data files
based upon the first letter of a member's last
name then open a correct data file based upon
a match for the first letter of a last name.
Be careful about uppercase / lowercase sensitivity
and incorrect input such as number instead of a
letter for the first character of a last name.
@Members = (A .. Z);
foreach $member (@Members)
{
if ($member_last_name =~ /^$member/)
open (MEMBER, "/your/path/to/$member.dat"); #optional error check
.. do whatever
}
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
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 4607
**************************************