[22347] in Perl-Users-Digest
Perl-Users Digest, Issue: 4568 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 14 18:06:23 2003
Date: Fri, 14 Feb 2003 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 14 Feb 2003 Volume: 10 Number: 4568
Today's topics:
Re: amateur needs pattern matching example <tore@aursand.no>
Re: amateur needs pattern matching example <usenet@dwall.fastmail.fm>
Copying the contents of a directory <porter96@lycos.com>
Re: Copying the contents of a directory <rag616@fastserve.net>
Re: Copying the contents of a directory <porter96@lycos.com>
Re: Easy filter running for Win32 GUI users <w_ichmann@uni-wuppertal.de>
Getting list from FTP <cb@sebaw.com>
Re: Getting list from FTP (Helgi Briem)
Re: Getting list from FTP (Randy Kobes)
Re: Help with Script <glex_nospam@qwest.net>
Re: Help with Script <abigail@abigail.nl>
how to do string concatenation (eWisdom)
Re: how to do string concatenation <laocoon@eudoramail.com>
Re: how to do string concatenation <krahnj@acm.org>
Re: how to do string concatenation (Malcolm Dew-Jones)
Re: Perl Metacharacters and replacement text (Tad McClellan)
Re: Perl Metacharacters and replacement text <nobull@mail.com>
read content_len with use:cgi <user@someserver123abc.com>
Re: read content_len with use:cgi (Malcolm Dew-Jones)
Re: regex <mbudash@sonic.net>
String Compare Help <ryanscheller@comcast.net>
Re: String Compare Help <eric.schwartz@hp.com>
Re: String Compare Help <usenet@dwall.fastmail.fm>
Re: String Compare Help <noreply@gunnar.cc>
sysread and length <demetros@edamail.fishkill.ibm.com>
Re: sysread and length (Anno Siegel)
Re: weak references and dclone (via WeakRef and Storabl <rgarciasuarez@free.fr>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 14 Feb 2003 20:49:52 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: amateur needs pattern matching example
Message-Id: <pan.2003.02.14.19.38.52.759796@aursand.no>
On Fri, 14 Feb 2003 11:25:01 +0000, Helgi Briem wrote:
>> However, there are modules which comes to rescue; Download
>> HTML::Parser from CPAN (www.cpan.org). It's a very handy
>> module.
> Well, unless you *are* a rocket scientist, HTML::Parser
> can be a little tricky.
Not really; it's just not so well-documented as you'd wish. Have a look
at the test scripts (ie. examples) which comes with the module. Lots of
nice stuff to learn from there.
However: It's nice to see that there are modules "built on other" modules
which simplifies the most common tasks.
--
Tore Aursand - tore@aursand.no - http://www.aursand.no/
------------------------------
Date: Fri, 14 Feb 2003 20:59:00 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: amateur needs pattern matching example
Message-Id: <Xns9322A297CE78Fdkwwashere@216.168.3.30>
Helgi Briem <helgi@decode.is> wrote on 14 Feb 2003:
> HTML::TokeParser provides a simpler interface for
> it that many find easier to use
>
> HTML::TokeParser::Simple is even easier.
Hmm. I didn't know it existed. Love the "is_comment" comment.
> I am still waiting for
> HTML::TokeParser::DeadSimpleEvenForMorons ;-)
I thought that was called a browser.
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Fri, 14 Feb 2003 12:56:53 -0800
From: "Steve" <porter96@lycos.com>
Subject: Copying the contents of a directory
Message-Id: <v4qfb8qta4i180@corp.supernews.com>
I've been able to successfully copy individual files from one directory to
another using
use File::Copy;
copy("$sourcedir/$filename", "$destinationdir/" . "$filename");
but have had no luck copying the entire contents of the directory.
I would appreciate any suggestions.
Thanks,
Steve
------------------------------
Date: Fri, 14 Feb 2003 14:12:02 -0600
From: "Randy Gentry" <rag616@fastserve.net>
Subject: Re: Copying the contents of a directory
Message-Id: <v4qjcngkqe785f@corp.supernews.com>
This works on my Win98SE
--------------------------------------
use File::Copy;
$sourcedir = "folder1";
$destinationdir = "folder2";
opendir(SOURCE, "$sourcedir") || die "$!";
@files = readdir SOURCE;
closedir(SOURCE);
foreach $filename(@files){
copy("$sourcedir\\$filename", "$destinationdir\\$filename");
}
--------------------------------------
Good luck!
Steve <porter96@lycos.com> wrote in message
news:v4qfb8qta4i180@corp.supernews.com...
> I've been able to successfully copy individual files from one directory to
> another using
>
> use File::Copy;
> copy("$sourcedir/$filename", "$destinationdir/" . "$filename");
>
> but have had no luck copying the entire contents of the directory.
>
> I would appreciate any suggestions.
>
> Thanks,
> Steve
>
>
------------------------------
Date: Fri, 14 Feb 2003 15:00:36 -0800
From: "Steve" <porter96@lycos.com>
Subject: Re: Copying the contents of a directory
Message-Id: <v4qmj5hug3d1c4@corp.supernews.com>
Randy:
That was basically just cut and paste. Thank you very much for your help.
Steve
------------------------------
Date: Fri, 14 Feb 2003 17:17:28 +0100
From: Ingo Wichmann <w_ichmann@uni-wuppertal.de>
Subject: Re: Easy filter running for Win32 GUI users
Message-Id: <3E4D1698.3030902@uni-wuppertal.de>
Phil Hibbs schrieb:
> I have written a few perl scripts to reformat text, and I want to make
> them easy to use for end users that don't like the Command Line on
> their Windows machines.
>
> Currently, the script takes stdin and prints to stdout, but that means
> the user has to put '< input.dat > output.dat' at the end of the
> command line, which is less than friendly. Ideally, I'd like them to
> be able to do it all with the mouse.
>
> Any ideas how I can set this up?
Why not Tk?
use strict;
use warnings;
use Tk;
my $mw = MainWindow->new;
my $infile = $mw->getOpenFile(-title=>'Input File');
my $outfile = $mw->getOpenFile(-title=>'Output File');
print $infile,' ',$outfile;
Ingo
--
Meine Mailadresse enthält keinen Unterstrich
------------------------------
Date: Fri, 14 Feb 2003 15:18:00 GMT
From: "Dartnagnan" <cb@sebaw.com>
Subject: Getting list from FTP
Message-Id: <IM73a.4328914$6N5.566178@post-03.news.easynews.com>
How do I grab a list of available files via ftp and then only grab the ones
that match a particular criteria?
I do it with directory browsing using opendir... but I am not sure how to
handle it with FTP. I thought that potentially I could do it something like
this.
$ftp->ls(/ftp/test/):
opendir(DH,$ftp) || die "Couldn't open the current directory:$!";
while ($_ = readdir(DH)){
next if $_ eq "." or $_ eq "..";
my @test = $_;
Any ideas?
George Wang
"The true threat to the future of software is not the microsoft's of the
world, but the Big Blue's."
------------------------------
Date: Fri, 14 Feb 2003 15:28:52 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Getting list from FTP
Message-Id: <3e4d0a43.617694497@news.cis.dfn.de>
On Fri, 14 Feb 2003 15:18:00 GMT, "Dartnagnan"
<cb@sebaw.com> wrote:
>How do I grab a list of available files via ftp and then only grab
>the ones that match a particular criteria?
Here's one way:
#!/usr/bin/perl
use warnings;
use strict;
use Net::FTP;
# Set the parameters
my $host = 'ftp.domain.com';
my $password = 'password';
my $username = 'username';
my $path = '/path/to/my/files';
my $criterion = 'pattern';
my $ftp = Net::FTP->new($host, Timeout=>10) or
die "could not connect to $host :
$!";
$ftp->login($username, $password);
$ftp->cwd($path);
my @files = grep /$criterion/, $ftp->ls;
foreach my $file (@files)
{
$ftp->get($file);
}
$ftp->quit;
>I do it with directory browsing using opendir...
Not through FTP you can't.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: 14 Feb 2003 17:04:10 GMT
From: randy@theoryx5.uwinnipeg.ca (Randy Kobes)
Subject: Re: Getting list from FTP
Message-Id: <slrnb4q7v6.7a6.randy@theoryx5.uwinnipeg.ca>
On Fri, 14 Feb 2003 15:18:00 GMT, Dartnagnan <cb@sebaw.com> wrote:
>How do I grab a list of available files via ftp and then only
>grab the ones that match a particular criteria?
It depends on the criteria ... Here's a couple of ways:
=============================================================
use strict;
use Net::FTP;
my $ftp = Net::FTP->new('ftp.cpan.org');
$ftp->login('anonymous', 'user@somewhere.edu');
$ftp->cwd('pub/CPAN');
my @files = $ftp->ls;
print "@files\n";
my @listing = $ftp->dir;
use File::Listing;
for (parse_dir(\@listing)) {
my ($name, $type, $size, $mtime, $mode) = @$_;
next unless $type eq 'f'; # only get plain files
print "$name has size $size\n";
}
$ftp->close;
======================================================
--
best regards,
randy kobes
------------------------------
Date: Fri, 14 Feb 2003 10:18:36 -0600
From: Jeff D Gleixner <glex_nospam@qwest.net>
Subject: Re: Help with Script
Message-Id: <vD83a.65$1q6.18574@news.uswest.net>
Ronald Davies wrote:
[...]
> Find out the location of the temporary Internet files on the PC. Take a
> snapshot of that directory, total up the amount of space used, and delete
> only those files that are more than 7 days old from the time the script is
> run. Then, after the utility has finished working, take another snapshot of
> the directory to show how much space you've freed up. Write the date the
> script was run as well as each snapshot recording the before and after
> condition of the directory's contents.
>
> I am new to Perl scripting and could use some help with this. I have got the
> part about the "date the script was run." I would like to have this script
> run on any version or Windows.
>
> Thanks for the help...
> Ron
File::Find will provide you with the file info.
http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Find.pm
------------------------------
Date: 14 Feb 2003 22:03:38 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Help with Script
Message-Id: <slrnb4qptp.asa.abigail@alexandra.abigail.nl>
Ronald Davies (rdavies@kos.net) wrote on MMMCDLIV September MCMXCIII in
<URL:news:3e4ce7af@news.kos.net>:
][ Good morning,
][
][ I am trying to write a script that will do the following:
][
][ Find out the location of the temporary Internet files on the PC. Take a
][ snapshot of that directory, total up the amount of space used, and delete
][ only those files that are more than 7 days old from the time the script is
][ run. Then, after the utility has finished working, take another snapshot of
][ the directory to show how much space you've freed up. Write the date the
][ script was run as well as each snapshot recording the before and after
][ condition of the directory's contents.
This smells like homework to me.
][ I am new to Perl scripting and could use some help with this. I have got the
][ part about the "date the script was run." I would like to have this script
][ run on any version or Windows.
I wouldn't bother with Perl. This sort of thing is where the Unix
toolkit shines, and Perl would just get in the way.
DIR="..." # Whatever directory you're interested in.
BEFORE_SIZE=`du -sk $DIR | cut -f 1`
find $DIR -mtime +7 -exec rm {} \;
AFTER_SIZE=`du -sk $DIR | cut -f 1`
echo `expr $BEFORE_SIZE - $AFTER_SIZE`
As for running it under Windows, just install a Unix toolkit (for
instance the freely available cygwin toolkit) on it. That would be a
major improvement to the box anyway.
Abigail
--
print v74.117.115.116.32.97.110.111.116.104.101.114.
v32.80.101.114.108.32.72.97.99.107.101.114.10;
------------------------------
Date: 14 Feb 2003 14:20:35 -0800
From: hemen.oza@med.ge.com (eWisdom)
Subject: how to do string concatenation
Message-Id: <df4dcc52.0302141420.47efce3e@posting.google.com>
I am trying to add two strings like,
$str1 = "FirstName";
$str2 = "LastName";
$str3 = $str1 + " " + $str2;
How can I do this in perl?
------------------------------
Date: Fri, 14 Feb 2003 23:47:45 +0100
From: Lao Coon <laocoon@eudoramail.com>
Subject: Re: how to do string concatenation
Message-Id: <Xns9322F222876D3Laocoon@62.153.159.134>
hemen.oza@med.ge.com (eWisdom) wrote in
news:df4dcc52.0302141420.47efce3e@posting.google.com:
> I am trying to add two strings like,
> $str1 = "FirstName";
> $str2 = "LastName";
> $str3 = $str1 + " " + $str2;
>
> How can I do this in perl?
with a .
$str3 = $str1 . " " . $str2;
perldoc perlintro
Lao
------------------------------
Date: Fri, 14 Feb 2003 22:52:33 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: how to do string concatenation
Message-Id: <3E4D72F6.9AFC7E83@acm.org>
eWisdom wrote:
>
> I am trying to add two strings like,
> $str1 = "FirstName";
> $str2 = "LastName";
> $str3 = $str1 + " " + $str2;
>
> How can I do this in perl?
Perl uses the period character for string concatenation.
$str3 = $str1 . ' ' . $str2;
Or you could use the interpolation properties of double quoted strings.
$str3 = "$str1 $str2";
John
--
use Perl;
program
fulfillment
------------------------------
Date: 14 Feb 2003 14:54:28 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: how to do string concatenation
Message-Id: <3e4d73a4@news.victoria.tc.ca>
eWisdom (hemen.oza@med.ge.com) wrote:
: I am trying to add two strings like,
: $str1 = "FirstName";
: $str2 = "LastName";
: $str3 = $str1 + " " + $str2;
: How can I do this in perl?
After you have installed perl then type
perldoc perlop
at the command line. You should get instructions on all of the operators
you can use in perl, including the ones you can use to solve your problem.
Sometimes the join() function is more useful (see: `perldoc perlfunc') for
joining strings together.
------------------------------
Date: Fri, 14 Feb 2003 08:11:03 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl Metacharacters and replacement text
Message-Id: <slrnb4pu7n.1jl.tadmc@magna.augustmail.com>
Thomas Richards <tom.richards@rocketmail.com> wrote:
> In the function
> s/search_text/replacement_text/g
>
> do metacharcters need to be escaped in the replacement text part?
Yes, but there are very few characters that are meta.
> I tried the following:
>
> SystemMessages="('RP40','RP60','RP44','RP45','RR93')"
> perl -p -e "s/¬systemmsgs¬/$SystemMessages/g" out
>
> and was expecting the brackets and single quotes to throw an error.
>
> Please could anyone give me an explanation to how perl treats
> metacharacters in the replacement text part?
The replacement part is NOT a regex, it is a "double quotish"
string. You need escape only those chars that are meta in
double quoted strings, such as $ and @.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Feb 2003 17:13:57 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl Metacharacters and replacement text
Message-Id: <u9fzqqu6ne.fsf@wcl-l.bham.ac.uk>
tadmc@augustmail.com (Tad McClellan) writes:
> Thomas Richards <tom.richards@rocketmail.com> wrote:
>
> > In the function
> > s/search_text/replacement_text/g
> >
> > Please could anyone give me an explanation to how perl treats
> > metacharacters in the replacement text part?
>
> The replacement part is NOT a regex, it is a "double quotish"
> string. You need escape only those chars that are meta in
> double quoted strings, such as $ and @.
I was about to give the OP a fishing lesson when I saw that the
description of s/// in perlop never actually says that the replacement
part is double quotish!
Is there somwhere I can just mail this patch or do I need to raise a
proper perlbug?
--- /usr/local/lib/perl5/5.8.0/pod/perlop.pod Fri Nov 1 15:39:53 2002
+++ perlop.pod Fri Feb 14 17:02:09 2003
@@ -1171,7 +1171,8 @@
to one of those, i.e., an lvalue.)
If the delimiter chosen is a single quote, no interpolation is
-done on either the PATTERN or the REPLACEMENT. Otherwise, if the
+done on either the PATTERN or the REPLACEMENT. Otherwise REPLACEMENT
+is subject to interpolation like a double quoted string and, if the
PATTERN contains a $ that looks like a variable rather than an
end-of-string test, the variable will be interpolated into the pattern
at run-time. If you want the pattern compiled only once the first time
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 14 Feb 2003 17:19:58 -0500
From: someuser <user@someserver123abc.com>
Subject: read content_len with use:cgi
Message-Id: <3E4D6B8E.919035B7@someserver123abc.com>
why can't I :
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
when I:
use CGI qw/param/;
$option=param('option');
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
------------------------------
Date: 14 Feb 2003 14:47:53 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: read content_len with use:cgi
Message-Id: <3e4d7219@news.victoria.tc.ca>
someuser (user@someserver123abc.com) wrote:
: why can't I :
: read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
: when I:
: use CGI qw/param/;
: $option=param('option');
If you use CGI then at some point it will read in the data from STDIN. If
you try to read STDIN after that then there is no more data for you to
read. I would guess the read would then wait for the requested input
(which will never come), and the script would appear to hang.
But I wonder, if you are using the CGI module, then why are you doing that
read at all?
------------------------------
Date: Fri, 14 Feb 2003 16:48:07 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: regex
Message-Id: <mbudash-EC5999.08480814022003@typhoon.sonic.net>
In article <i6gp4vsb26v508fapd8bq9cgnsj3mckt9k@4ax.com>,
robert <repairs@ya.com> wrote:
> Hi
>
> here's a regex I'm using to pull some data out of an html file
> ('/<td
> valign="middle"><strong>.*(\d{1,2}.*(?:january|february|march|april|may|june|j
> uly|august|september|october|november|december)).*(\d+?).*departs\s*((?:[[:alp
> ha:]]+
> *)*)\s*(?:at)\s*(\d{1,2}:\d{2}).*arrives\s*((?:[[:alpha:]]+
> *)*)\s*(?:at)\s*(\d{1,2}:\d{2}).*(\d{1,4}\.\d{2}).*(GBP|EUR|CHF).*<\/strong>/i
> Us'
>
> trouble is when say the (GBP|EUR|CHF) part fails to find a match, the
> regex takes forever to finish. I'm assuming that its trying every
> combination for all the .* entries, but what technique do I use to
> stop this happening?
>
> GunboatDiplomat
in general, it's best not to use regexes to parse html. there are a few
well-built perl modules out there to do the job, e.g., HTML::Parser...
see cpan.org...
hth-
------------------------------
Date: Fri, 14 Feb 2003 13:35:19 -0500
From: "Ryan" <ryanscheller@comcast.net>
Subject: String Compare Help
Message-Id: <WBOdnQoTx7JFq9CjXTWcqw@comcast.com>
What is wrong with this? The evaluation of the strings is wrong somehow?
$name = "abc";
$testdir = "zxy";
if($name == $testdir)
{
$result = "True";
}
else
{
$result = "False";
}
------------------------------
Date: 14 Feb 2003 11:41:43 -0700
From: Eric Schwartz <eric.schwartz@hp.com>
Subject: Re: String Compare Help
Message-Id: <eto4r76so0o.fsf@wormtongue.emschwar>
"Ryan" <ryanscheller@comcast.net> writes:
> What is wrong with this? The evaluation of the strings is wrong somehow?
No, the comparison is. To compare two strings, use 'eq', not '=='.
In general, if you have a question about how perl operators work,
check the perlop documentation:
$ perldoc perlop
There you'd see that
Binary "==" returns true if the left argument is numerically equal to
the right argument.
and a few lines down,
Binary "eq" returns true if the left argument is stringwise equal to
the right argument.
Read the documentation first, and then you'll have the answer even
faster than posting to this newsgroup (where people generally take a
dim view of posting questions that are easily answered in the
documentation).
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Fri, 14 Feb 2003 18:50:44 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: String Compare Help
Message-Id: <Xns93228CD883C6Cdkwwashere@216.168.3.30>
Ryan <ryanscheller@comcast.net> wrote on 14 Feb 2003:
> What is wrong with this? The evaluation of the strings is wrong
> somehow?
>
> $name = "abc";
> $testdir = "zxy";
>
> if($name == $testdir)
if($name eq $testdir)
'==' tests numbers, 'eq' tests strings.
If you had had warnings enabled, you would have seen
Argument "zxy" isn't numeric in numeric eq (==) at ...
Argument "abc" isn't numeric in numeric eq (==) at ...
You should always turn on strict and warnings so perl can help you
with debugging. Then you would have known immediately what was wrong
instead of having to post to usenet.
> {
> $result = "True";
> }
> else
> {
> $result = "False";
> }
>
>
>
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Fri, 14 Feb 2003 20:08:59 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: String Compare Help
Message-Id: <v1c3a.10793$FF4.630226@newsb.telia.net>
Ryan wrote:
> What is wrong with this? The evaluation of the strings is wrong somehow?
>
> $name = "abc";
> $testdir = "zxy";
>
> if($name == $testdir)
A string comparison is made using 'eq', i.e.
if($name eq $testdir)
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 14 Feb 2003 13:43:18 -0500
From: "George C. Demetros" <demetros@edamail.fishkill.ibm.com>
Subject: sysread and length
Message-Id: <3E4D38C6.801F774F@edamail.fishkill.ibm.com>
Hi.
How does one determine the right LENGTH to specify on sysread:
sysread(FILEHANDLE, SCALAR, LENGTH, OFFSET)
I have file handles that are a socket, a fifo file, and file descriptor 3 handle
on a pipe. The data I will be reading can vary in length from a few bytes to a
whole lot of bytes. Is there an optimum length to select for each type of
handle if the data is not fixed in length?
Thanks in advance.
George
------------------------------
Date: 14 Feb 2003 19:28:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: sysread and length
Message-Id: <b2jg0u$nko$1@mamenchi.zrz.TU-Berlin.DE>
George C. Demetros <demetros@edamail.fishkill.ibm.com> wrote in comp.lang.perl.misc:
> Hi.
>
> How does one determine the right LENGTH to specify on sysread:
>
> sysread(FILEHANDLE, SCALAR, LENGTH, OFFSET)
>
> I have file handles that are a socket, a fifo file, and file descriptor 3 handle
> on a pipe. The data I will be reading can vary in length from a few bytes to a
> whole lot of bytes. Is there an optimum length to select for each type of
> handle if the data is not fixed in length?
None that I know of, at least no hard-and-fast one. Powers of two are
conventional, like 2**10 or 2**13. There may be some micro-optimization
in adapting the buffer size to the file type, but unless IO on one channel
proves to be a bottleneck I wouldn't bother with it.
Anno
------------------------------
Date: 14 Feb 2003 14:56:33 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: weak references and dclone (via WeakRef and Storable)
Message-Id: <slrnb4q0sg.19i.rgarciasuarez@dat.local>
Paul GABORIT wrote in comp.lang.perl.misc :
>
> I use weak references in a complex object. I want to clone my object by
> preserving its weak references.
>
> Simple example :
> ----------------------------------------
> use WeakRef;
> use Storable qw{dclone};
Storable apparently doesn't know about weak refs.
I'm not sure whether this qualifies as a bug, because persistent data
containing weak references makes my brain hurt.
Anyway, the solutions are :
* traverse the cloned structure and mark the relevant refs as weak
* patch Storable to handle weak refs
* write another generic cloning method
HTH
--
For some reason most people seem to be born without the part of the brain
that understands pointers. -- Joel Spolsky
------------------------------
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 4568
***************************************