[7338] in Perl-Users-Digest
Perl-Users Digest, Issue: 963 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 2 19:17:20 1997
Date: Tue, 2 Sep 97 16:00:57 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 2 Sep 1997 Volume: 8 Number: 963
Today's topics:
Re: "U.S." =~ m/\bU\.S\.\b/ fails (Gerben Vos)
[Q] Simple - Referencing Filehandles in Associative Arr <chris@wzone.com>
Re: A Complex Regex Needed (Matthew Burnham)
Re: Anyone had success profiling Tk with Devel::DProf ? (Ilya Zakharevich)
Associate Array <sijun@nortel.ca>
Re: Associate Array (Kevin)
Re: Associate Array (Eric Bohlman)
Re: Bug in perl? Bug in my code? <usenet-tag@qz.little-neck.ny.us>
Re: Cannot store DBM-file (Chris Nandor)
Re: character substitutions in msqlperl ..again <ptrainor@aura.title14.com>
Re: character substitutions in msqlperl ..again <ptrainor@aura.title14.com>
Re: character substitutions in msqlperl ..again <rootbeer@teleport.com>
Re: Compiling A Regular Expression <rootbeer@teleport.com>
E-Loan Position <phil@eloan.com>
Re: Filtering CR & CRLF from text input (Matthew Burnham)
Re: Filtering CR & CRLF from text input (brian d foy)
FTP site mirroring software? (Paul D. Smith)
getuid and setuid (Wei Tang)
Re: getuid and setuid (M.J.T. Guy)
Re: Is this a permissions problem Opening and reading a <lounsbery@blender.com>
Limits in Perl 5 on array sizes ??? <jim.blackwell@gsfc.nasa.gov>
Re: Limits in Perl 5 on array sizes ??? (M.J.T. Guy)
Re: Limits in Perl 5 on array sizes ??? (Ilya Zakharevich)
Making a Swiss-Army Knife HTML tool in Perl (T. Wheeler)
Newbie File Locking <buck@huron.net>
Re: Newbie File Locking <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Sep 1997 20:51:11 GMT
From: gerben@cs.vu.nl (Gerben Vos)
Subject: Re: "U.S." =~ m/\bU\.S\.\b/ fails
Message-Id: <5uhu7v$ocj$1@star.cs.vu.nl>
James H. Thompson writes:
>if ("U.S." =~ m/\bU\.S\.\b/) {
I suppose you want to match "U.S. ", but not "U.S.A." ?
If so, then you actually want m/\bU\.S\.\B/
^ capital B
A dot is a non-word character. If you don't want a match if the dot
is followed by a word character, that is, you ONLY want a match if
the dot is followed by a NON-word character, then you want to match a
NON-word-boundary, so you need \B , which matches only if there's no
word boundary.
A maybe slightly clearer way to express this would be m/\bU\.S\.(?!\w)/ .
g e r b e n @ c s . v u . n l . . . . . . . . . . . . G e r b e n V o s <><
Join the Coalition Against Unsolicited Commercial Email! http://www.cauce.org/
The hedgehog can never be buggered at all.
------------------------------
Date: 2 Sep 1997 20:12:56 GMT
From: "Chris Waddell" <chris@wzone.com>
Subject: [Q] Simple - Referencing Filehandles in Associative Arrays
Message-Id: <01bcb7dc$395cc340$79d2adce@aptiva>
I have some experience with C, including complex pointers, and although I
have a great deal of experience with PERL, I am still more or less lost in
the field of PERL's referencing. (It simply seems illogical and mysterious
to me). I have some code which needs to make use of these features, and if
it doesn't work properly the first time, I'm going to have to acomplish a
whole lot of work all over again. Therefore I have elected to pose this
question to the masses:
What is the syntax for taking an arbitrary PERL pointer, assigning it to a
[DBM file] handle, and throwing that into an associative array, getting it
out again, then using it to close the file?
So far I have the following code. The purpose is to have my "spagetti"
code cease its insistant and relentless opening and closing of dbm files
(as it continues to need the same ones again and again), by supplying it
with a new routine which will keep open any dbm's it wants and only close
them upon exitting.
----------------------------------------------------------------cut
here----------------------------------------------------------------
## syntax: &dbmopen2("sample.dbm.file", *X);
sub dbmopen2 {
local($filename) = shift(@_);
local(*HANDLE) = @_;
if (!$openeddbms{$filename}) {
## attempt to open/create $filename
unless ( dbmopen(%HANDLE, $filename, 0666) ) {
&errorpage( "\"$filename\" dbm file was unable to be opened.");
}
## store handle in %openeddbm
$openeddbms{$filename} = *HANDLE;
} else {
## dbm file has already been opened
%HANDLE = $openeddbms{$filename};
}
}
sub closealldbms {
while (($key,*value)=each %openeddbms) {
dbmclose(value);
}
}
## sample code:
&dbmopen2("sample.dbm.file", *X);
$X{'x'}=1;
&dbmopen2("sample.dbm.file", *X);
$X{'x'}=2;
&closealldbms;
----------------------------------------------------------------cut
here----------------------------------------------------------------
I am very thankful for any help or advice. Thank you.
------------------------------------------------------------
Chris Waddell [SMTP:chris@wzone.com]
------------------------------------------------------------
------------------------------
Date: Tue, 02 Sep 1997 18:56:32 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: A Complex Regex Needed
Message-Id: <340d2936.21384127@news.enterprise.net>
jandj@alink.net (John S. Anderson) wrote:
>I'm reading this from windows, so not able to test but should work.
Get a copy of perl for win32 from www.activestate.com
--
Matthew Burnham | danew@enterprise.net
Manager, MindWeb | http://www.mindweb.co.uk/
Page me: http://wwp.mirabilis.com/2807531 | 2807531-icq@mindweb.co.uk
Web design and hosting | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!
------------------------------
Date: 2 Sep 1997 19:58:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Anyone had success profiling Tk with Devel::DProf ?
Message-Id: <5uhr5q$5ki@agate.berkeley.edu>
In article <340AF1E8.41C67EA6@csfp.co.uk>,
Paul Cunnell <pcunnell@csfp.co.uk> wrote:
> Hi all,
>
> I have a large Perl/Tk application which runs a mite slowly,
> and so I'd like to profile it to see where the hotspots are.
5.004_01, Devel::DProf-19960930, Tk402.002, OS/2 PM.
> I have perl 5.003, Devel::DProf-19960930, Tk400.202, all built
> and apparently installed OK on a Solaris 2.5.1 box.
> dprofpp reports 'Garbled profile is missing some exit time stamps:
> Tk::Widget::Button
> Try rerunning dprofpp with -F.', and dprofpp -F says:
I needed some patches to dprofpp, and (maybe?) a manual editing of the
output. Both were quite obvious. One is here:
--- ./dprofpp Mon Jun 23 02:30:44 1997
+++ F:/emx.add/bin/dprofpp.cmd Sun Jul 27 18:35:56 1997
@@ -459,7 +460,15 @@ sub exitstamp {
die "Garbled profile, missing an enter time stamp";
}
if( $x->[0] ne $name ){
- die "Garbled profile, unexpected exit time stamp";
+ if( ! $opt_F ){
+ foreach $z (@stack, $x) {
+ print $z->[0],"\n";
+ }
+ die "Garbled profile, unexpected exit time stamp";
+ } else {
+ warn( "Faking $name => $x->[0] exit timestamp(s).\n");
+ $name = $x->[0];
+ }
}
if( $opt_T || $opt_t ){
$$in -= $tab;
------------------------------
Date: Tue, 02 Sep 1997 15:43:13 -0400
From: Sijun Zeng <sijun@nortel.ca>
Subject: Associate Array
Message-Id: <340C6C51.77A3@nortel.ca>
Hi all,
I'm new to Perl and have a problem now. See the code below, user_array
is an associate array and each of its value is alos an associate array.
#!/usr/bin/perl -w
$lib_array{'libname1'}=1;
$lib_array{'libname2'}=2;
$user_array{'userA'}=%lib_array;
foreach $key ( keys %user_array) {
print "key = $key\n";
%vect=$user_array{$key};
foreach $keyv (keys %vect) {
print " keyv = $keyv, value = $vect{$keyv} \n";
}
}
I'm expecting the output like
key = userA
key2= libname1, value = 1
key2= libname2, value = 2
But I only got the first line. Any help will be appreciated.
Thanks,
Sijun
--
********************************************************************************
* My love is my world. The world is my love *
********************************************************************************
------------------------------
Date: 2 Sep 1997 13:28:01 -0700
From: klander@primenet (Kevin)
Subject: Re: Associate Array
Message-Id: <340c7590.15534367@news.primenet.com>
On Tue, 02 Sep 1997 15:43:13 -0400, Sijun Zeng <sijun@nortel.ca>
wrote:
>Hi all,
>
>I'm new to Perl and have a problem now. See the code below, user_array
>is an associate array and each of its value is alos an associate array.
>
You need to use references when creating hashes of hashes, arrays of
hashes, arrays of arrays, etc.. I think this does what you want it
to:
#!/usr/bin/perl -w
$lib_array{'libname1'}=1;
$lib_array{'libname2'}=2;
$user_array{'userA'}=\%lib_array; # <--- the value is a reference
# to the hash.
foreach $key ( keys %user_array) {
print "key = $key\n";
%vect=%{$user_array{$key}}; # dereferencing the hash
foreach $keyv (keys %vect) {
print " keyv = $keyv, value = $vect{$keyv} \n";
}
}
--
Kevin -- klander at primenet dot com (add the .com in email replies)
http://www.primenet.com/~klander
--
------------------------------
Date: Tue, 2 Sep 1997 22:16:51 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Associate Array
Message-Id: <ebohlmanEFwJ83.934@netcom.com>
Sijun Zeng (sijun@nortel.ca) wrote:
: I'm new to Perl and have a problem now. See the code below, user_array
: is an associate array and each of its value is alos an associate array.
It's now more common to refer to an associative array as a "hash."
: #!/usr/bin/perl -w
: $lib_array{'libname1'}=1;
: $lib_array{'libname2'}=2;
: $user_array{'userA'}=%lib_array;
This doesn't do what you think it does. When used in scalar context,
"%hash" returns a string containing internal information about the hash
(number of used buckets/number of allocated buckets). Assignment to a
hash element takes place in a scalar context; you can't meaningfully
assign a hash to a scalar. You can, however, assign a *reference* to a
hash to a scalar, and that's almost certainly what you want to do:
$user_array{'userA'}=\%lib_array;
: foreach $key ( keys %user_array) {
: print "key = $key\n";
: %vect=$user_array{$key};
Since the values of user_array are now going to be references to hashes,
you'll need to dereference them:
%vect=%{$user_array{$key}};
: foreach $keyv (keys %vect) {
: print " keyv = $keyv, value = $vect{$keyv} \n";
: }
: }
------------------------------
Date: 2 Sep 1997 20:22:27 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Bug in perl? Bug in my code?
Message-Id: <eli$9709021614@qz.little-neck.ny.us>
Andreas SLATEFF <slateff@netway.at.Please.remove.this.I.really.hate.spam>
wrote:
> $e=$2;
> s/ ..any pattern.. /$e/;
> # fails at 1st line, because $2 is not defined...
>
>
> $e=\$2;
> s/.../$$e/;
> # ditto....
...
Is this what you want?
$e='$2';
s/.../"$e"/e;
If not, give a sample not of the code, but the situation to make things
clearer.
Elijah
------
fails to understand how this relates to the post of mine you followed up to
------------------------------
Date: Tue, 02 Sep 1997 17:34:48 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Cannot store DBM-file
Message-Id: <pudge-ya02408000R0209971734480001@news.idt.net>
In article <5ue3ig$cc5$1@due.unit.no>, Morten Simonsen
<mortensi@idt.ntnu.no> wrote:
# ---------------------
# #!/usr/local/bin/perl
#
# use Fcntl;
# use AnyDBM_File;
#
# tie (%db,"AnyDBM_File","dbfile","O_CREAT|O_RDWR","0664");
# $db{'key'}='value';
# untie(%db);
# ----------------------
#
# but when I am done, no file is made. If I use dbmopen instead,
# everything works fine. But if I then later tries to overwrite the
# new-made dbfile, I am not allowed. In my case I use NDBM.
Try using the -w switch. Also put a die after tie:
tie (%db,"AnyDBM_File","dbfile","O_CREAT|O_RDWR","0664") || die $!;
The diagnostic tools are your friends.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Tue, 2 Sep 1997 15:49:45 -0400
From: Pat Trainor <ptrainor@aura.title14.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: character substitutions in msqlperl ..again
Message-Id: <Pine.LNX.3.95.970902150807.5298A-100000@aura>
On Tue, 2 Sep 1997, Tom Phoenix wrote:
> On Tue, 2 Sep 1997, Pat Trainor wrote:
>
> > The big question is how to s/ or tr/ or anything the \ character
> > (and all the other perl-esque chars) into 'delimited' versions for
> > inclusion/extraction in db queries such as the one below.
>
> What's the question? :-) If you're asking "How can I tell Perl I want a
> true backslash in a s/// or tr///?", I can answer that.
$sql_statement = "UPDATE DIGEST SET qual_duties = '$qual_duties'
WHERE index_number = '$index_number' ";
$sth = $dbh->query($sql_statement) or die $Msql::db_errstr;
If the variable $qual_duties contains the characters ' or \ the
query will not be processed. So the question is, how can the characters be
passed from perl and not interpreted as commands to perl (even though
they're in a variable).
> The general rule is: "Whenever you want to mean a real
> backslash in Perl, use two."
Tried that. Tried:
$variable =~ s/\/\\/g;
$variable =~ s/\\/\\\/g;
...
Parse errors on run.
> tr/// is backslash-interpolated. So if you wanted to replace a bang with a
> backslash wherever it appears, you could use tr/!/\\/ . To go the other
> way, tr/\\/!/ .
>
> The left side of s/// is double-quote-interpolated (which is more fancy
> than backslash interpolating). If you wanted to replace a backslash with
> the string "<backslash>", you could use s#\\#<backslash># .
>
> The right side of s/// is also double-quote-interpolated (although it can
> do some other stuff if you use the /e option). If you wanted to try to
> reverse the previous transformation, you could use s#<backslash>#\\# .
>
> If you're trying to backslash all "special" characters, you might want the
> quotemeta function. Does any of that do anything for you? Hope this helps!
Nope, only the 2 I mentioned. Perl seems to let all but ' and \
pass without occasion.
Without this condition fixed, apostrophes cannot be used in simple
text like "Perl's Functions".
pat
:)
ptrainor@aura.title14.com
http://www.title14.com/resume
#$reality=$bandwidth!=spam;
"While it's true winning isn't everything-LOSING IS NOTHING!" -Ed Bighead
------------------------------
Date: Tue, 2 Sep 1997 16:35:51 -0400
From: Pat Trainor <ptrainor@aura.title14.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: character substitutions in msqlperl ..again
Message-Id: <Pine.LNX.3.95.970902162332.5298B-100000@aura>
On Tue, 2 Sep 1997, Tom Phoenix wrote:
> > The big question is how to s/ or tr/ or anything the \ character
> > (and all the other perl-esque chars) into 'delimited' versions for
> > inclusion/extraction in db queries such as the one below.
>
> What's the question? :-) If you're asking "How can I tell Perl I want a
> true backslash in a s/// or tr///?", I can answer that.
Here's what will wotk.. sorta..
If an entry that you want to say:
driver's license
is enterred as:
driver\'s license
perl leaves it alone and it is passed into the query no sweat.
until..
You can view the data no sweat, but when I pull the data in that
field back up to edit it, the correct data is placed in the field
(obviously without the \ 'delimiter').
If I simply ask perl to place the data back, without even changing
it, perl will barf on it when the query:
$sql_statement = "UPDATE DIGEST SET qual_duties = '$qual_duties' WHERE
index_number = '$index_number' ";
$sth = $dbh->query($sql_statement) or die $Msql::db_errstr;
is executed (providing that no 'un-escaped'(?) chars are \ or ').
How can I pass a varaible through a substitution or translation
[or ..] that will 'delimit' or 'un-escape' each occurance of the ' or \
characters? i.e.:
$variable =~ [insert magic here];
pat
:)
ptrainor@aura.title14.com
http://www.title14.com/resume
#$reality=$bandwidth!=spam;
"While it's true winning isn't everything-LOSING IS NOTHING!" -Ed Bighead
------------------------------
Date: Tue, 2 Sep 1997 15:28:02 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Pat Trainor <ptrainor@aura.title14.com>
Subject: Re: character substitutions in msqlperl ..again
Message-Id: <Pine.GSO.3.96.970902151724.12071H-100000@julie.teleport.com>
On Tue, 2 Sep 1997, Pat Trainor wrote:
> $sql_statement = "UPDATE DIGEST SET qual_duties = '$qual_duties'
> WHERE index_number = '$index_number' ";
> $sth = $dbh->query($sql_statement) or die $Msql::db_errstr;
>
> If the variable $qual_duties contains the characters ' or \ the
> query will not be processed. So the question is, how can the characters be
> passed from perl and not interpreted as commands to perl (even though
> they're in a variable).
>From the looks of things, that variable $sql_statement will be parsed, and
the single quotes will be used to tell where the data from $qual_duties
starts and stops. (Does it seem that way to you?) So I'd use this.
# protect special chars (backslash and tick)
$qual_duties =~ s#([\\'])#\\$1#g;
# Now interpolate
$sql_statement = "UPDATE DIGEST SET qual_duties = '$qual_duties'
WHERE index_number = '$index_number' ";
$sth = $dbh->query($sql_statement) or die $Msql::db_errstr;
> > The general rule is: "Whenever you want to mean a real
> > backslash in Perl, use two."
> Tried that. Tried:
>
> $variable =~ s/\/\\/g;
That's not going to work!
> $variable =~ s/\\/\\\/g;
Neither is that. As I said, "Whenever you want to mean a real backslash in
Perl, use two." One of those lines used one and the other used three!
> Perl seems to let all but ' and \ pass without occasion.
Actually, Perl doesn't care about those characters; they're not special
within data. (They can be special within your program's code, but here
they are just data.) But the function to which you're sending that string
seems to care about quoting.
> Without this condition fixed, apostrophes cannot be used in
> simple text like "Perl's Functions".
Perl has no problem with that. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 2 Sep 1997 15:12:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Rodney Wines <Rodney.Wines@ahqps.alcatel.fr>
Subject: Re: Compiling A Regular Expression
Message-Id: <Pine.GSO.3.96.970902145737.12071E-100000@julie.teleport.com>
On Tue, 2 Sep 1997, Rodney Wines wrote:
> I suspect that my script would go faster if it didn't have to re-compile
> the format for each record.
You're probably right.
> if (!(@data = /$format/g)) { #Split the fields into @data,
Is that where you'd like to use the /o modifier?
> I'd really like to use "/$format/og", and for $format to get recompiled
> only each time through the "foreach" loop.
Oh, so you'd like it to be compiled upon request? There's more than
one way to do it, of course, but here's one.
sub compile_re {
# This sub, when passed a regular expression, returns
# a coderef. The coderef is for a sub which, given a string
# returns a set of fields according to the parenthesized
# sections in the RE.
my $pat = shift;
eval q{ # Single-quoted string!
sub { $_[0] =~ m/$pat/o }
};
}
$match_who = compile_re '^(\S+)\s+(\S+)\s+(.+)$';
for (`who`) {
($user, $tty, $date) = $match_who->($_);
print "$user on $tty at $date\n";
}
If that won't do it, does it at least show you the way? (You may need
5.004 to get this to work.) Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 02 Sep 1997 12:48:08 -0700
From: Phil Alexander <phil@eloan.com>
Subject: E-Loan Position
Message-Id: <340C6D78.5DBB@eloan.com>
E-Loan, Inc., a Palo-Alto based internet Mortgage company, seeks a
full-time Perl programmer. Interested parties should provide a current
resume via e-mail to Christian Larsen, president, E-Loan at
chris@eloan.com.
--------------
E-Loan, Inc.
540 University Ave. Ste. 350
Palo Alto, CA 94301
http://www.eloan.com
------------------------------
Date: Tue, 02 Sep 1997 18:56:19 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Filtering CR & CRLF from text input
Message-Id: <340c2109.19290350@news.enterprise.net>
bart.mediamind@tornado.be (Bart Lateur) wrote:
>>I'm new to Perl, but isn't this the 'chomp()' function EXACTLY!
>>> >Can anyone tell me how to strip CRLFs from text input fields? I'm
>
>You didn't understand the question quite right. Chomp remove the CRLF
>from the END of a line.
>
>The problem was how to remove CRLF's from WITHIN a text field, with
>multiline text, where the user used the return key to preformat his
>text. The question was how to turn this back into one single line.
Now this may not be the problem - if not the other answers given will
probably be correct - but someone's told me that if the user adds their
own newlines in <TEXTAREAS> these are sent as non-urlencoded !
characters.
Can anyone confirm this?
--
Matthew Burnham | danew@enterprise.net
Manager, MindWeb | http://www.mindweb.co.uk/
Page me: http://wwp.mirabilis.com/2807531 | 2807531-icq@mindweb.co.uk
Web design and hosting | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!
------------------------------
Date: Tue, 02 Sep 1997 18:13:49 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Filtering CR & CRLF from text input
Message-Id: <comdog-ya02408000R0209971813490001@news.panix.com>
In article <340c2109.19290350@news.enterprise.net>, danew@enterprise.net (Matthew Burnham) wrote:
>Now this may not be the problem - if not the other answers given will
>probably be correct - but someone's told me that if the user adds their
>own newlines in <TEXTAREAS> these are sent as non-urlencoded !
>characters.
sure - you can :), but don't foget this would be a problem with
a particular client and not necessarily a universal problem
write a toy script to which you will POST some TEXTAREA data
#!/usr/bin/perl
# let's get the data. since this is just for kicks, we'll
# skip all that error checking stuff :)
$length = $ENV{'CONTENT_LENGTH'};
read(STDIN, $buffer, $length);
# instead of doing all sorts of fancy things, let's just save the data
# then look at it from the shell (or do an octal dump if you like)
# or you can just look at it in the browser. no big whoop
open FILE, "> test_post.txt";
print FILE $buffer;
close FILE;
print "Status: 204\n\n";
__END__
so i used Netscape 3.0 (PowerPC) to send:
---START TEXTAREA DATA---
this is a line with a newline-->
this is a line with two-->
here is a tab --> <--there is a tab
---END TEXTAREA DATA---
and the info in the file was (sorry for the wrapping but how else to
show this without spurious newlines?)
---START TEXTAREA DATA---
textarea=this+is+a+line+with+a+newline--%3E%0D%0Athis+is+a+line+with+two--%3E%0D
%0A%0D%0Ahere+is+a+tab+--%3E%09%3C--there+is+a+tab%0D%0A
---END TEXTAREA DATA---
notice the encoded \r\n pairs. :)
--
brian d foy <comdog@computerdog.com>
------------------------------
Date: 02 Sep 1997 16:30:33 -0400
From: psmith@baynetworks.com (Paul D. Smith)
Subject: FTP site mirroring software?
Message-Id: <p5iuwj4fx2.fsf@baynetworks.com>
I'm looking for a simple bit of software to maintain a local mirror of
the directory structure on my ISP FTP site... I just want something to
download newer files on the FTP site to my local copy, and upload files
I've modified locally to the FTP site.
A little perl script utilizing, say, Net::FTP would be cool! :)
But, I'm open to other suggestions as well.
I couldn't find anything relevant-looking by searching CPAN for keywords
like "copy", "mirror", and "ftp".
Seems like a perfectly useful little script; surely someone must have
such a thing already?
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@baynetworks.com> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions--Bay Networks takes no responsibility for them.
------------------------------
Date: 2 Sep 1997 19:15:01 GMT
From: wtang@cs.ualberta.ca (Wei Tang)
Subject: getuid and setuid
Message-Id: <5uhojm$1ok$1@scapa.cs.ualberta.ca>
Hi,
I checked the online manual
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc.html
and it seems that there are no functions named "getuid" or "setuid".
If I want to call in a CGI script a Unix shell program which can only
run under my own uid, what should I do?
Thanks.
------------------------------
Date: 2 Sep 1997 20:21:43 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: getuid and setuid
Message-Id: <5uhsgn$spt$1@lyra.csx.cam.ac.uk>
Wei Tang <wtang@cs.ualberta.ca> wrote:
>
>If I want to call in a CGI script a Unix shell program which can only
>run under my own uid, what should I do?
See the variables $< and $> in the perlvar man page. And before playing
with them, read the perlsec man page carefully, at least twice.
Mike Guy
------------------------------
Date: Tue, 02 Sep 1997 16:44:15 +0000
From: John Lounsbery <lounsbery@blender.com>
Subject: Re: Is this a permissions problem Opening and reading a URL
Message-Id: <340C425C.45A@blender.com>
if(open(TRACE, "$traceprog $surfer|") || die "bye...$!") {
the die will only get executed if the open fails, even in an if-else
>People have being telling me to use the or Die stuff, no problem. But
>how would one implement that in an if condition as below?
>
> if (open (TRACE, "$traceprog $surfer|")) {
> while (<TRACE>) {
> print MAIL;
> }
> close TRACE;
> }
------------------------------
Date: Tue, 02 Sep 1997 16:12:34 -0400
From: "James H. Blackwell" <jim.blackwell@gsfc.nasa.gov>
Subject: Limits in Perl 5 on array sizes ???
Message-Id: <340C7332.4487@gsfc.nasa.gov>
Hi all,
Quickie Question I Hope:
Is there a limit on the size of a Perl array ?
Thanks
Jim Blackwell
------------------------------
Date: 2 Sep 1997 20:27:48 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Limits in Perl 5 on array sizes ???
Message-Id: <5uhss4$svn$1@lyra.csx.cam.ac.uk>
James H. Blackwell <jim.blackwell@gsfc.nasa.gov> wrote:
>Quickie Question I Hope:
>
>Is there a limit on the size of a Perl array ?
Quickie answer: No, except for the size of your virtual memory.
Mike Guy
------------------------------
Date: 2 Sep 1997 22:25:53 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Limits in Perl 5 on array sizes ???
Message-Id: <5ui3ph$9jr@agate.berkeley.edu>
In article <5uhss4$svn$1@lyra.csx.cam.ac.uk>,
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
> James H. Blackwell <jim.blackwell@gsfc.nasa.gov> wrote:
> >Quickie Question I Hope:
> >
> >Is there a limit on the size of a Perl array ?
>
> Quickie answer: No, except for the size of your virtual memory.
I do not think it is true. The limit is 2^31-1, if I'm not mistaken
in all the #defines.
But in most situations this is exactly as you say, since 2^31-long
array would take at least 40G memory.
Well, I did overlooke a way to create an AV populated by NULLs, when
it would take only 8G:
env PERL_DEBUG_MSTATS=2 perl -e "@a=undef;$#a = 125000"
Memory allocation statistics after compilation: (buckets 4(4)..8188(8192)
14436 free: 151 9 47 8 11 1 1 2 1 0 0
442 77 75 1 4
52556 used: 104 118 142 54 5 7 3 14 1 0 1
69 93 265 83 21
Total sbrk(): 67584/18:116. Odd ends: pad+heads+chain+tail: 0+592+0+0.
Memory allocation statistics after execution: (buckets 4(4)..528380(524288)
14380 free: 151 9 46 8 11 1 1 2 1 0 0 0 0 0 0 0 0
442 77 74 1 4
580992 used: 104 118 143 54 5 7 3 14 1 0 1 0 0 0 0 0 1
69 93 266 83 21
Total sbrk(): 595968/19:117. Odd ends: pad+heads+chain+tail: 0+596+0+0.
which (8M) is becoming more and more common to have for virtual
memory). Btw, if you populate the array by undef()s, you can get away
with 16bytes/elt, so it would take only ;-) 32G of memory:
env PERL_DEBUG_MSTATS=2 \
perl -e "@a=undef;$#a = 125000;$a[$i]=undef while $i++ < 125000"
Memory allocation statistics after compilation: (buckets 4(4)..8188(8192)
14244 free: 137 120 9 7 10 1 1 1 1 0 0
431 60 33 39 4
58840 used: 118 134 180 55 6 7 3 15 2 0 1
80 110 307 87 21
Total sbrk(): 73728/20:118. Odd ends: pad+heads+chain+tail: 0+644+0+0.
Memory allocation statistics after execution: (buckets 4(4)..528380(524288)
11076 free: 137 120 8 7 10 1 1 0 0 0 0 0 0 0 0 0 0
431 60 30 39 4
2124464 used: 118 134 181 55 6 7 3 1522 2 0 1 0 0 0 0 0 1
80 110 310 87 21
Total sbrk(): 2158592/63:161. Odd ends: pad+heads+chain+tail: 0+6668+0+16384.
Ilya
------------------------------
Date: Tue, 02 Sep 1997 21:45:31 GMT
From: twheeler@m-net.arbornet.org (T. Wheeler)
Subject: Making a Swiss-Army Knife HTML tool in Perl
Message-Id: <340c8683.676630895@news.stlnet.com>
Hello,
I am wanting to deelop a do-it-all perl tool that will take plain text
files and create decent formatted HTML. Once it is completed, I will
post it in th epublic domain for all to use.
I don't want to waste my time doing work that others have done. I have
incorporated parts ofother tools I have seen on the net into this one.
Maybe you could give me guidance as to where I can find more or
perhaps contribute some code to the script. I warn you now -- I am
somewhat of a newbie to perl although I have a bit of experience in
other languages. I am also using Windows NT, but don't want to make
this anymore platform-dependent than it has to be.
Interested? Here is the basic explanation of the script's purpose:
# makehtml.pl
# 1997 -- Tom Wheeler
# In Development
# Here is what we do:
#
# 1. Check for command line arguments. If none print usage.
# -C (filename) -- Create HTML file from this content
file.
# -H (filename) -- Specify header file else use
default
# -F (filename) -- Specify footer file else use
default
# -S (dirroot) -- Create sitemap from the base of
dirroot
# -T (dirroot) -- Create textonly site from dirroot
called text/dirroot. Strip images, client scripts
# -L -- Report all broken internal links
# -C -- Strip all comments
# -H (filename) --Create textfile from filename.
Output is filename.txt
# -R (dirroot) -- Make all links relative within
dirroot and its subdirectories
#
# 2. Print all of this to STDOUT
#
By dirroot, I mean a directory tree root and all subdirs within it.
The header and footer files are just files containing the top and
bottom part of a web page that will be appended to the content file to
give a consistent appearnce to the site. Note that this is not
server-side stuff, but rather it is done at the time of site creation.
Most of the components could probably be used on the server, however.
Please post your replies to this newsgroup as I am between mail
servers now.
Tom Wheeler
------------------------------
Date: Tue, 02 Sep 1997 15:06:25 -0400
From: Stephen Hill <buck@huron.net>
Subject: Newbie File Locking
Message-Id: <340C63AC.B618A88E@huron.net>
I need to lock a file....I have tried the FAQ and can't get the info I
need (broken link on page).
Any help on file locking would be appreciated, Please don't tell me to
use a module, I want the source code :-) Any info on flock too...
Thanks...
buck@huron.net
------------------------------
Date: Tue, 2 Sep 1997 15:14:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Stephen Hill <buck@huron.net>
Subject: Re: Newbie File Locking
Message-Id: <Pine.GSO.3.96.970902151415.12071F-100000@julie.teleport.com>
On Tue, 2 Sep 1997, Stephen Hill wrote:
> I need to lock a file....I have tried the FAQ and can't get the info I
> need (broken link on page).
You should report that to the FAQ maintenance address - unless that link
is also broken. :-)
I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps!
http://www.stonehenge.com/merlyn/WebTechniques/
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 963
*************************************