[17647] in Perl-Users-Digest
Perl-Users Digest, Issue: 5067 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 8 18:10:39 2000
Date: Fri, 8 Dec 2000 15:10:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976317018-v9-i5067@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 8 Dec 2000 Volume: 9 Number: 5067
Today's topics:
Re: List Values and Arrays erictwx@my-deja.com
Re: List Values and Arrays (Otto Wyss)
Math::BigInt and -d - a bug? <russ_jones@rac.ray.com>
multi keyed hash or array <jdhunter@nitace.bsd.uchicago.edu>
Re: number vs string nobull@mail.com
Re: number vs string (Craig Berry)
parsing canned response <mike@a2zcables.com>
Re: Perl and DOS windows <mothra@nowhereatall.com>
Re: PERL based Web Application Servers (Malcolm Dew-Jones)
PLEASE CHECK MY CODING! (Fryar386)
Re: PLEASE CHECK MY CODING! (Tim Hammerquist)
Re: PLEASE CHECK MY CODING! <jb@yperite.demon.co.uk>
problems with perlcc <landman@mediaone.net>
Re: Process_ID stuff??? nobull@mail.com
Re: splitting a string into an array and preserving the <bart.lateur@skynet.be>
Re: Statistics for comp.lang.perl.misc (Greg Bacon)
Re: Statistics for comp.lang.perl.misc (Abigail)
untaint a regular expression <*@qz.little-neck.ny.us>
Re: untaint a regular expression <elijah@workspot.net>
Re: untaint a regular expression (Tad McClellan)
Re: Use PERL or Java? Which is faster? (Peter van der Linden)
Re: Use PERL or Java? Which is faster? <wsprague100@yahoo.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 08 Dec 2000 19:23:15 GMT
From: erictwx@my-deja.com
Subject: Re: List Values and Arrays
Message-Id: <90rceq$5o$1@nnrp1.deja.com>
In article <slrn931uck.14d.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> erictwx@my-deja.com <erictwx@my-deja.com> wrote:
> >In article <qcr13t08gdmoonds0sk5p0mddvtpue7pjl@4ax.com>,
> > Lou Moran <lmoran@wtsg.com> wrote:
>
> >> @stuff = ("one", "two", "three");
> >> $stuff = @stuff;
> >> print $stuff
> >>
> >This return 3
>
> It "outputs" 3. "return" means something altogether different.
>
> "print $stuff" returns true if the print succeeded, else false.
>
> >because when evaluated in scalar context, a list returns
> >the number of elements in the list.
>
> No it doesn't.
>
> First, there is nothing that even looks like "list in scalar context".
>
> The _only_ list above is in the first line, which is in list context.
>
> @stuff is not a list, it is an array.
>
> Second there is *no such thing* as a list in a scalar context:
>
> $stuff = ("one", "two", "three");
>
> There is no list there (despite looking like there is).
>
> There is just the comma operator in some parens.
>
> Third an *array* (not a list) returns the number of elements
> in the array when used in scalar context.
>
> Please do not try and reanswer FAQs. Your followup has made
> things worse, not better. Just provide a pointer to the FAQ answer.
>
> Perl FAQ, part 4:
>
> "What is the difference between a list and an array?"
>
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
My apologies. I meant "array in scalar context", rather than "list in
scalar context" On the other hand, from the example, it was pretty
clear what I was speaking of.
-E
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 8 Dec 2000 23:29:38 +0100
From: otto.wyss@bluewin.ch (Otto Wyss)
Subject: Re: List Values and Arrays
Message-Id: <1elcf1q.1jtltw91yqqldmN%otto.wyss@bluewin.ch>
> Perl FAQ, part 4:
>
> "What is the difference between a list and an array?"
I just tried to read perlfaq4 myself and search for "list and an array"
but it didn't found anything. Doing
perldoc perlfaq4
/list
revealed that the FAQ was there, but why didn't match this simple search
the word "list" in the text
"What is the difference between a list and an array?"
What's best way to get to the text in a FAQ?
O. Wyss
------------------------------
Date: Fri, 08 Dec 2000 17:00:41 -0600
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Math::BigInt and -d - a bug?
Message-Id: <3A316819.63C1D503@rac.ray.com>
I was messing around with Math::BigInt and came across this
interesting behavior:
#!/opt/perl5/bin/perl
use Math::BitInt ':constant';
exit(0);
Runs with no errors. Sure it doesn't actually do much that's visible
to the eye, but it runs.
I know, no -w, no "use strict", they don't have any effect on the
behavior I'm demonstrating.
Add "-d" to the shebang line, for debug mode and I get this:
Default die handler restored.
Loading DB routines from perl5db.pl version 1.07
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(comp.pl:4): exit(0);
Attempt to free unreferenced scalar at
/opt/perl5/lib/5.6.0/Term/Cap.pm line 222
, <TERMCAP> line 1010.
DB<1>
perl -v gives
This is perl, v5.6.0 built for PA-RISC2.0
It's a curiosity. A less trivial program still runs fine in debug
mode, once that error message is out of the way, but it's irritating.
Any ideas? It looks like a bug to me, but what do I know?
--
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: 08 Dec 2000 16:30:40 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: multi keyed hash or array
Message-Id: <1ru28ebl67.fsf@video.bsd.uchicago.edu>
I have some data that I want to store by month and year. Currently
I'm using a hash where each key is a the year, and the value is a hash
with keys that are months and the values are an array.
When it comes time to print the results, I don't know how to get the
keys, for a given year. In this case, I can use the months = 1..12
which works fine, but how does one do it generally?
E.g,
my %store;
foreach (some condition) {
#loop here to accumulate some data by year and month
++$store{$year}{$month}[0]; #increment number seen
$store{$year}{$month}[1] += $recipients; #number recipients
}
Now I want to print the results:
#generate the report
foreach my $year (keys %store) {
foreach my $month (1..12) { ## here I want to use a keys statement
my $num_emails = $store{$year}{$month}[0] || 0;
my $num_recip = $store{$year}{$month}[1] || 0;
print "$year\t$month\t$num_emails\t$num_recip\\n";
}
}
Thanks,
John Hunter
------------------------------
Date: 08 Dec 2000 18:52:36 +0000
From: nobull@mail.com
Subject: Re: number vs string
Message-Id: <u9k89aeoej.fsf@wcl-l.bham.ac.uk>
"Daniel W. Burke" <dwb1@home.com> writes:
> What is the best, most warning-free method of testing if a scalar
> is a number or a string?
I think the method in the FAQ is probably likely to be a fairly good
one because the FAQ is so heavily peer-reviewed. I'm not saying that
all answers in the FAQ are the best answers to their respective
questions.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 08 Dec 2000 22:11:16 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: number vs string
Message-Id: <t32n44c7tjdb05@corp.supernews.com>
Daniel W. Burke (dwb1@home.com) wrote:
: What is the best, most warning-free method of testing if a scalar
: is a number or a string?
This is an EFAQ. (The E is for 'extremely'.) Not surprisingly, you'll
find your answer in the FAQ.
Do note that, in Perl, your question is logically similar to "How do I
tell if I'm looking at a BMW or a car?"
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: Fri, 08 Dec 2000 22:47:20 GMT
From: Mike Gardner <mike@a2zcables.com>
Subject: parsing canned response
Message-Id: <3A316842.5E8FB422@a2zcables.com>
Hello,
I have a form that posts data to a server. It returns with a canned
response. (I grab the page with LWP.) Amongst the garbage spit back are
multiple instances of Content-Type and Content-Length. The idea is to
separate that data from the rest and save those variables.
I have successfully separated (split) the response by its content
boundaries and saved them to an array in which I can call the individual
"slices." (which contain the content and length values). But I cannot
figure out how I can take the new slices and extract out only the
Content-Type and Content-Length fields into name-value pairs!
Can anyone give me any advice on how I can take these slices from the
canned response and split them into the pairs?
Thanks for your input : )
Mike Gardner
mike@a2zcables.com
http://www.a2zcables.com
------------------------------
Date: Fri, 08 Dec 2000 11:16:10 -0800
From: mothra <mothra@nowhereatall.com>
Subject: Re: Perl and DOS windows
Message-Id: <3A313379.AF9E6E72@nowhereatall.com>
Graham Knight wrote:
> I have a perl program running occasionally out of the scheduler on windows 98.
>
> Does anyone know of a way to run the program so that it does not pop
> up a DOS window every time it runs? If it popped up the window in a
> minimized state that would be great too, basically I don't want
> windows popping up all over the scren every time the program runs.
>
> Any help or tips to make this happen very much appreciated.
>
> Thx,
> Graham
try something like this
use strict;
use Win32;
use Win32::Process;
Win32::Process::Create($Win32::Process::Create::ProcessObj,
'C:/perl/bin/perl.exe',
'perl your script',
0,
DETACHED_PROCESS,
".") or die print_error();
sub print_error() {
return Win32::FormatMessage( Win32::GetLastError() );
}
------------------------------
Date: 8 Dec 2000 14:03:34 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: PERL based Web Application Servers
Message-Id: <3a315ab6@news.victoria.tc.ca>
Al Dev (alavoor@yahoo.com) wrote:
: Can you recommed any PERL based Web Application Servers.
: I am planning to use PERL on linux.
I use HTTPi as the basis for interesting projects. An old url which
may be good still...
http://httpi.ptloma.edu/
its by by Cameron Kaiser (thanks cameron)
Its a very simple web server written in Perl. Because its so simple and
100% Perl, its easy to use as the basis for any number of perl based
projects.
Anytime you need a form based interface, simply launch HTTPi on a new port
and then each browser can have its own dedicated server - maintaining
state is trivial, and if HTTPi runs on the same machine as the browser
then its easy to generate reports, etc, straight to the hard disk, and
launch other applications for the user as required (etc etc etc).
------------------------------
Date: 08 Dec 2000 21:11:38 GMT
From: fryar386@aol.com (Fryar386)
Subject: PLEASE CHECK MY CODING!
Message-Id: <20001208161138.23148.00004456@ng-fv1.aol.com>
I'm a new PERL prgogrammer, could you look over my program? Everytime I run
it, it just sits there and doesn't do anything
#!/usr/local/bin/perl -Tw
# $Header: /cys/people/brenner/http/docs/web/perl5/RCS/simple#-form.cgi,v 1.5
1996/03/29 22:58:40 brenner Exp $
# Copyright (C) 1994 Steven E. Brenner
# This is a small demonstration script to demonstrate the use of
# the cgi-lib.pl library
require 5.001;
use strict;
require "./cgi-lib.pl";
MAIN:
{
my (%input, # The CGI data
$text, $field, $planet, $speed, $attack, $health, $maxhealth,
$peri, $KI, $attacks, $intellegence, $powerlevel, $defence);
# Read in all the variables set by the form
&ReadParse(\%input);
# Check that everything has been entered
foreach $field (qw(username password e-mail basic1 main_goal race)) {
&CgiDie("Error: Please fill in the '$field'\n") unless defined
$input{$field};
}
# Do some processing, and print some output
($text = $input{'text'}) =~ s/\n/\n<BR>/g;
#These lines show what planet the person is on
if ($input{'race'} eq "saiyan") {
($planet = "planet vageta");
}
if ($input{'main_goal'} eq "speed") {
($speed = "25");
($attack = "10");
($defence = "10");
($KI = "100");
($powerlevel = "1000");
($peri = "5000p");
($health = "100");
($maxhealth = "100");
($intellegence = "10");
}
if ($input{'main_goal'} eq "defence") {
($speed = "10");
($attack = "10");
($defence = "25");
($KI = "100");
($powerlevel = "1000");
($peri = "5000p");
($health = "100");
($maxhealth = "100");
($intellegence = "10");
}
if ($input{'main_goal'} eq "attack") {
($speed = "10");
($attack = "25");
($defence = "10");
($KI = "100");
($powerlevel = "1000");
($peri = "5000p");
($health = "100");
($maxhealth = "100");
($intellegence = "10");
}
if ($input{'main_goal'} eq "intellegence") {
($speed = "10");
($attack = "10");
($defence = "10");
($KI = "100");
($powerlevel = "1000");
($peri = "5000p");
($health = "100");
($maxhealth = "100");
($intellegence = "25");
}
print &PrintHeader;
open FILE, ">> /serverfiles/test.txt"
or die "Couldn't open test.txt: $!\n";
flock FILE, 2
or die "Couldn't acquire an exclusive lock on test.txt: $!\n";
print FILE <<EOFT;
<P>
Username: $input{username}
Password: $input{password}
E-mail: $input{e-mail}
Attacks: $input{basic1}
Main Goal: $input{main_goal}
Planet: $planet
AIM: $input{aim}
Race: $input{race}
Speed: $speed
Defence: $defence
Attack: $attack
KI: $KI
Health: $health
MaxHealth: $maxhealth
Intellegence: $intellegence
Peri(money): $peri
Power Level: $powerlevel
EOFT
close FILE
or warn "test.txt didn't close nicely: $!\n";
print <<ENDOFTEXT;
<html>
<link rel=stylesheet href=http://paweb01.planetarion.com/planet_default.css>
<link rel=stylesheet
href=http://paweb01.planetarion.com/planet_explorer_win.css>
<head>
<title>Thank You for Joining!</title>
</head>
<body bgcolor=#000000 text=#FFFFFF link=#FFFFCC vlink=#FFFFCC alink=#FFFFCC
leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<script language="JavaScript1.2">
/*
Watermark Backgound Image Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
if (document.all)
document.body.style.cssText="background:black
url(http://members.spree.com/funngames/max_goku_ultimate/animations/instan
tgoku.gif) no-repeat fixed center center"
</script>
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=58%>Under Construction!</td>
<td width=36%
background=http://members.spree.com/funngames/maxgoku3/images/top_bar_midd
le.gif>
</td>
<td width=6%<img
src=http://members.spree.com/funngames/maxgoku3/images/top_bar_right.gif
width=40 height=34 border=0></a></td>
<td width=10
background=http://members.spree.com/funngames/maxgoku3/images/border_left.
gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=10
height=4></td>
</tr>
</table>
<P>
<!-- Section body -->
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=10
background=http://members.spree.com/funngames/maxgoku3/images/border_left.
gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=10
height=4></td>
<td width=579><center><b> <CENTER><IMG
SRC="http://www.angelfire.com/anime2/SuperSaiyanGokusGifs/DBZ/Goku/Goku8.gif">
</CENTER></b></center></td>
<td width=11
background=http://members.spree.com/funngames/maxgoku3/images/border_right
.gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=11
height=4></td>
</tr>
</table>
<!-- Section Heading -->
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=18><img
src=http://members.spree.com/funngames/maxgoku3/images/header_left.gif width=18
height=34></td>
<td width=100%
background=http://members.spree.com/funngames/maxgoku3/images/header_middl
e.gif><CENTER><B>Thank you for joining Max_Gokus Dragonball Z
RPG!:</B></CENTER></td>
<td width=18><img
src=http://members.spree.com/funngames/maxgoku3/images/header_right.gif
width=18 height=34></td>
</tr>
</table>
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=10
background=http://members.spree.com/funngames/maxgoku3/images/border_left.
gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=10
height=4></td>
<td width=579>
Welcome $input{'username:'}! You are the newest member of Max_Gokus Dragonball
Z RPG!
<P>
Your Information:
<BR>
RPG name: $input{'username:'}
<BR>
Password: $input{'password:'}
<BR>
E-Mail: $input{'e-mail:'}
<BR>
Shortly you will receive an e-mail at the mail address you provded
<P>
<STRONG>Thanks for Joining Max_Gokus Dragonball Z RPG!</STRONG>
<A HREF="http://maxgoku.hypermart.net/main.html">Back to the Main Page</A>
</td>
</table></td>
<td width=11
background=http://members.spree.com/funngames/maxgoku3/images/border_right
.gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=11
height=4></td>
</table>
<!-- Section Heading -->
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=18><img
src=http://members.spree.com/funngames/maxgoku3/images/header_left.gif width=18
height=34></td>
<td width=100%
background=http://members.spree.com/funngames/maxgoku3/images/header_middl
e.gif><CENTER><B>My Power Level is:</B></CENTER></td>
<td width=18><img
src=http://members.spree.com/funngames/maxgoku3/images/header_right.gif
width=18 height=34></td>
</tr>
</table>
<!-- Section body -->
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=10
background=http://members.spree.com/funngames/maxgoku3/images/border_left.
gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=10
height=4></td>
<td width=579>
<B>
<CENTER>
<A HREF="http://www.beseen.com/hc-index.html">
<IMG SRC=
"http://pluto.beseen.com/hit.counter?account=821350&font=GreenOnBlack&base=29"
BORDER=0>
</A>
</CENTER>
</B>
</td>
<td width=11
background=http://members.spree.com/funngames/maxgoku3/images/border_right
.gif><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=11
height=4></td>
</tr>
</table>
<!-- Bottom of Table -->
<table width=600 align=center border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=18><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/corner_bl.gif width=18
height=17></td>
<td width=100%
background=http://members.spree.com/funngames/maxgoku3/images/bottom_bar.g
if><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/spacer.gif width=1
height=1></td>
<td width=18><img border=0
src=http://members.spree.com/funngames/maxgoku3/images/corner_br.gif width=18
height=17></td>
</tr>
</table>
<br>
</body>
</html>
ENDOFTEXT
print &HtmlBot;
}
I have no clue what is wrong, the only time it does anything is when I don't
enter in a field in my form
Thanks
------------------------------
Date: Fri, 08 Dec 2000 21:26:21 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: PLEASE CHECK MY CODING!
Message-Id: <slrn932kjl.2qi.tim@degree.ath.cx>
Fryar386 <fryar386@aol.com> wrote:
> I'm a new PERL prgogrammer, could you look over my program? Everytime I run
> it, it just sits there and doesn't do anything
> ($planet = "planet vageta");
You misspelled Vegeta. ;)
I assume you're testing this from the command prompt? Also, what's with
the cgi-lib? You require Perl version 5.001 but use a library held over
from Perl 4. Just confusing.
Try breaking down your code. Make sure it's doing the simpler things at
the beginning first instead of getting frustrated when it doesn't work
as a whole.
--
-Tim Hammerquist <timmy@cpan.org>
Dozens of people spontaneously combust each year,
it's just not really widely reported.
-- David St. Hubbins, "This is Spinal Tap"
------------------------------
Date: Fri, 08 Dec 2000 22:08:12 +0000
From: jb <jb@yperite.demon.co.uk>
Subject: Re: PLEASE CHECK MY CODING!
Message-Id: <3A315BCC.348467C5@yperite.demon.co.uk>
Fryar386 wrote:
>
> I'm a new PERL prgogrammer, could you look over my program? Everytime I run
> it, it just sits there and doesn't do anything
>
> #!/usr/local/bin/perl -Tw
>
> # $Header: /cys/people/brenner/http/docs/web/perl5/RCS/simple#-form.cgi,v 1.5
> 1996/03/29 22:58:40 brenner Exp $
> # Copyright (C) 1994 Steven E. Brenner
> # This is a small demonstration script to demonstrate the use of
> # the cgi-lib.pl library
>
> require 5.001;
> use strict;
>
> require "./cgi-lib.pl";
>
In the long run you will be better off by switching to CGI.pm
------------------------------
Date: Fri, 08 Dec 2000 21:17:52 GMT
From: "J Landman" <landman@mediaone.net>
Subject: problems with perlcc
Message-Id: <4ecY5.3859$Uj7.196599@typhoon.mw.mediaone.net>
folks:
I am attempting to use perlcc to compile (e.g. make a binary) out of my
code. Unfortunately, it appears to die in the ld step with an invalid
reference to the boot_DynaLoader. Is there anything I can do to fix
this? Is this a known problem? Is there a faq somewhere that I should
read? All pointers welcome. Thanks!
------
perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. /tmp/ctblastall.pl.tst
gcc -fno-strict-aliasing -I/usr/lib/perl5/5.6.0/i386-linux/CORE -o ctblastall.x ctblastall.pl.c -L/usr/local/lib -L/usr/lib/perl5/5.6.0/i386-linux/CORE -lperl -lnsl -ldl -lm -lc -lcrypt /usr/lib/perl5/5.6.0/i386-linux/auto/Sys/Hostname/Hostname.so /usr/lib/perl5/5.6.0/i386-linux/auto/IO/IO.so /usr/lib/perl5/5.6.0/i386-linux/auto/POSIX/POSIX.so /usr/lib/perl5/5.6.0/i386-linux/auto/Socket/Socket.so /usr/lib/perl5/5.6.0/i386-linux/auto/Fcntl/Fcntl.so
/tmp/ccjb6BaM.o: In function `xs_init':
/tmp/ccjb6BaM.o(.text+0x125851): undefined reference to `boot_DynaLoader'
collect2: ld returned 1 exit status
ERROR: In compiling code for ctblastall.pl.c !
------------------------------
Date: 08 Dec 2000 18:51:32 +0000
From: nobull@mail.com
Subject: Re: Process_ID stuff???
Message-Id: <u9n1e6eogb.fsf@wcl-l.bham.ac.uk>
<vidulats@yahoo.co.uk> writes:
> Subject: Process_ID stuff???
Nothing in this post is related to process IDs.
> I have one pm file “ABC.pm”, where I wrote some function.
> # Say the function name is Send ()
> # In which I'm printing the name of the file that calls this Send ()
> function
I think you mean to say "I have one pm file ABC.pm, where I would like
to write some function in which I print the name of the file that
calls this function". If you'd done it already you wouldn't be
posting now would you?
print((caller)[1]);
> In Send () I gave $0 ...
$0 Contains the name of the file containing the Perl
script being executed. On some operating systems
assigning to "$0" modifies the argument area that
the ps(1) program sees. This is more useful as a
way of indicating the current program state than
it is for hiding the program you're running.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 08 Dec 2000 21:39:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: splitting a string into an array and preserving the "\n"
Message-Id: <k9l23tc8ncu70dp9g80ji77oabgi5ujfab@4ax.com>
Abigail wrote:
>Funny that you mention AOL. You do know that the "online" in AOL has
>nothing to do with the Internet, don't you?
AOL is/was something similar to Internet. So, in spirit, it's the same
thing.
--
Bart.
------------------------------
Date: Fri, 08 Dec 2000 19:50:39 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <t32esff1chr1d7@corp.supernews.com>
In article <slrn9328da.nl1.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
: OCR is a stupid rating. It strongly suggest that asking questions,
: even if they are off-topic or FAQs is a good thing, while answering
: questions in a concise way is bad.
When I added OCR, I wasn't trying to make a value judgment. It does
reflect, however, that some people quote more (and sometimes a lot
more) than others. A local group I read has many posters who quote
long articles to add a one-line followup. That's not what I call
concise. Maybe I should change the minimum number of posts.
: The OCR should be removed from the statistics.
An easier way to boost your score would be to quote fewer lines. :-)
Greg
--
To me vi is Zen. To use vi is to practice zen. Every command is a koan.
Profound to the user, unintelligible to the uninitiated. You discover
truth everytime you use it.
-- reddy@lion.austin.ibm.com
------------------------------
Date: 8 Dec 2000 20:15:34 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <slrn932gb6.nl1.abigail@tsathoggua.rlyeh.net>
On Fri, 08 Dec 2000 19:50:39 -0000, Greg Bacon (gbacon@HiWAAY.net) wrote in comp.lang.perl.misc <URL: news:<t32esff1chr1d7@corp.supernews.com>>:
++
++ An easier way to boost your score would be to quote fewer lines. :-)
But then, one loses context. It's far easier to write a Perl program
that adds `original' content to every posting you make. :-)
Abigail
------------------------------
Date: 8 Dec 2000 20:15:18 GMT
From: Eli the Bearded <*@qz.little-neck.ny.us>
Subject: untaint a regular expression
Message-Id: <eli$0012081434@qz.little-neck.ny.us>
Probably someone has tried to solve this one before, I'd like to
see their results.
Problem stated breifly:
perlsec(1):
The only way to bypass the tainting mechanism is by
referencing subpatterns from a regular expression match.
Suppose you want to let a CGI user enter a 'full' perl regular
expression, how would you go about untainting it?
A naive answer is 'Regexps can't do anything dangerous, so
just use /(.*)/'. The problem is I would consider it a
security hole if the CGI user could somehow deduce the
values of variables by including them in a regexp.
So it becomes a matter of detecting any thing that in a
double quoted context would evalutate to something without
disallowing $, @, etc. However \1, \2, etc should be
allowed.
Oh, the more sophisticated programmer may say: You can't
match a RE with an RE since REs can contain arbitrary
depths of matched parentheses. My reply is that the
untainting RE does not need to enforce the grammar of
regular expressions. I can test that seperately with
an eval afterwards.
Here's a first draft of mine:
$t_regexp =~ / ^(
(?: [^\$\@\\]+ | # things that don't interpolate varibles
\\. | # anything backslashed
\$ (?: # $ followed by
$ | # end-of-string
\) # close paren
)
)+ # close (?:)
) # close () of $1
/x
and $unt_regexp = $1;
But it would be even better if (?x:...) REs could be entered.
Elijah
------
a /d option for 'do not interpolate' (ala m'$foo') would be nice, too
------------------------------
Date: 8 Dec 2000 20:17:21 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: untaint a regular expression
Message-Id: <eli$0012081516@qz.little-neck.ny.us>
[Superseding previous post with a working email address.]
Probably someone has tried to solve this one before, I'd like to
see their results.
Problem stated briefly:
perlsec(1):
The only way to bypass the tainting mechanism is by
referencing subpatterns from a regular expression match.
Suppose you want to let a CGI user enter a 'full' perl regular
expression, how would you go about untainting it?
A naive answer is 'Regexps can't do anything dangerous, so
just use /(.*)/'. The problem is I would consider it a
security hole if the CGI user could somehow deduce the
values of variables by including them in a regexp.
So it becomes a matter of detecting any thing that in a
double quoted context would evalutate to something without
disallowing $, @, etc. However \1, \2, etc should be
allowed.
Oh, the more sophisticated programmer may say: You can't
match a RE with an RE since REs can contain arbitrary
depths of matched parentheses. My reply is that the
untainting RE does not need to enforce the grammar of
regular expressions. I can test that seperately with
an eval afterwards.
Here's a first draft of mine:
$t_regexp =~ / ^(
(?: [^\$\@\\]+ | # things that don't interpolate varibles
\\. | # anything backslashed
\$ (?: # $ followed by
$ | # end-of-string
\) # close paren
)
)+ # close (?:)
) # close () of $1
/x
and $unt_regexp = $1;
But it would be even better if (?x:...) REs could be entered.
Elijah
------
a /d option for 'do not interpolate' (ala m'$foo') would be nice, too
------------------------------
Date: Fri, 8 Dec 2000 16:51:32 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: untaint a regular expression
Message-Id: <slrn932lv4.1th.tadmc@magna.metronet.com>
Eli the Bearded <elijah@workspot.net> wrote:
>Suppose you want to let a CGI user enter a 'full' perl regular
>expression, how would you go about untainting it?
>Here's a first draft of mine:
>
>$t_regexp =~ / ^(
> (?: [^\$\@\\]+ | # things that don't interpolate varibles
> \\. | # anything backslashed
> \$ (?: # $ followed by
> $ | # end-of-string
> \) # close paren
> )
> )+ # close (?:)
> ) # close () of $1
^^^^
Better stick an end-of-string anchor there too.
It untaints ' @{[ warn "foo" ]}' as it is.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Dec 2000 19:48:10 GMT
From: a@b2b.com (Peter van der Linden)
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <90rdtq$ala$1@nntp1.ba.best.com>
In article <slrn9329bq.nl1.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
>My experience is that a typical C or C++ program is already finished
>when the Java equivalent is still busy allocating the memory so it
>can actually start running.
Yes, you are right. Anyone whose experience is confined to running
exclusively trivial programs that only use a few microseconds of cpu time
will get the same result.
These kinds of ephemeral programs are common in student environments,
but not representative of IT as a whole.
The person who posed the original question should create a few
benchmarks to see whether he will be better served by Java or by Perl
or by something else entirely for his workload.
--
The Java FAQ is at
http://www.afu.com
Might be worth bookmarking it, or looking thru it for other info.
------------------------------
Date: Fri, 08 Dec 2000 20:30:25 GMT
From: sweet_fella <wsprague100@yahoo.com>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <90rgd1$3o9$1@nnrp1.deja.com>
It is interesting to note a few things about that article:
1. There is no mention of mod_perl, which eliminates the need to reload
an interpreter or a module into memory each time it is run.
and
2. That Unix actually provides an _excellent_ "IDE" with just a few
redirects, greps, and X windows. Actually Unix was designed to be an
"IDE" before the term was invented by some marketing guy. And this IDE
is free...
I will admit that I know very little about Java, (I have written 2
applets, using Cafe, to total about 100 lines, 3 years ago), but I think
that that article is obviously a PR piece, and not objective at all.
>
> "Servlets or CGI/Perl?" : http://www.idg.net/crd_java_9-117546.html
--
Never trust anyone with a simple solution....
...Unless it's in Perl.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 5067
**************************************