[13231] in Perl-Users-Digest
Perl-Users Digest, Issue: 641 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 25 17:07:23 1999
Date: Wed, 25 Aug 1999 14: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)
Perl-Users Digest Wed, 25 Aug 1999 Volume: 9 Number: 641
Today's topics:
Re: "aliasing" functions <jerrad@networkengines.com>
Re: ** REQUEST FOR A SCRIPT ** (Greg Bacon)
***HELP:searching for a newsgroup query script please niki@nirvanet.net
***HELP:searching for a newsgroup query script please niki@nirvanet.net
Re: ***HELP:searching for a newsgroup query script plea (Greg Bacon)
Re: Calculating days, hrs, mins between 2 datestamps .. (Larry Rosler)
Re: Computing n.th root of a given number <Mark@Mark.Com>
Re: Computing n.th root of a given number <aqumsieh@matrox.com>
Re: conditional sub defintion (Larry Rosler)
Re: conditional sub defintion (Greg Bacon)
Converting strings to arrays question <ilya@speakeasy.org>
DBD::DB2 on NT <weinronk@bu.edu>
Re: Desperately searching for perl lint (Larry Rosler)
Re: Desperately searching for perl lint (Greg Bacon)
Re: Desperately searching for perl lint (Larry Rosler)
Re: File Upload for WinNT W/ ActivePerl and CGI.pm-2.54 <dallas.jones@tech4learning.com>
HELP Please!! with a script to query newsgroups <niki@nirvanet.net>
Re: HELP Please!! with a script to query newsgroups (Greg Bacon)
Re: How add a new key to a hash <AgitatorsBand@yahoo.com>
Re: How to "unoverride" functions? (pgmr)
Internet Technologies Writer Required <jill@maran.com>
more sub alias <mayers@psi.com>
Re: more sub alias (Greg Bacon)
Re: my() vs. local() <aqumsieh@matrox.com>
newbie open() security question irf@netexecutive.com
Re: newbie: need help,LEARNING FROM A BOOK (Greg Bacon)
Re: package belg4mit@mit.edu
Re: Perl a Black Sheep? <AgitatorsBand@yahoo.com>
Re: Perl running on Unix and NT??? <dchristensen@california.com>
print dollar format? <bchung@ci.south-el-monte.ca.us>
Re: puzzle <meowing@banet.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Aug 1999 15:18:30 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: Re: "aliasing" functions
Message-Id: <37C44186.8332E3DA@networkengines.com>
got the answer in sub aliases thread.
------------------------------
Date: 25 Aug 1999 19:54:23 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: ** REQUEST FOR A SCRIPT **
Message-Id: <7q1hlf$kui$1@info2.uah.edu>
In article <37C3C63D.8775204C@earthling.net>,
kilimount <kilimount@earthling.net> writes:
: Being from now totaly incapable of writing one, I'm searching for a
: script that would calculate details on mortgages.
: The most complex, the best.
: If ever anyone as one to give away, that B cool :O)
There used to be one on the old www.perl.com, but it appears to have
gotten lost in the shuffle. :-(
Am I the only one who's less than thrilled with the new look and feel
of {www,language}.perl.com?
Greg
--
I went to a bookstore and asked the saleswoman, "Where's the self-help
section?"; She said if she told me, it would defeat the purpose.
-- George Carlin
------------------------------
Date: Wed, 25 Aug 1999 20:11:38 GMT
From: niki@nirvanet.net
Subject: ***HELP:searching for a newsgroup query script please
Message-Id: <7q1ilf$br8$1@nnrp1.deja.com>
Hello
Can anyone help me please????
I am in dire need for a perl script which can query a NNTP server and
count the number of headers for different newsgroups. The number of
headers should then be stored in a text file (or html file).
This is so that the interface I have created can read this text file
and adapt as necessary.
If you have ascript like this, or could write or adapt one, I would
appreciate it greatly!!!
Niki Gomez
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 25 Aug 1999 20:11:30 GMT
From: niki@nirvanet.net
Subject: ***HELP:searching for a newsgroup query script please
Message-Id: <7q1il4$br4$1@nnrp1.deja.com>
Hello
Can anyone help me please????
I am in dire need for a perl script which can query a NNTP server and
count the number of headers for different newsgroups. The number of
headers should then be stored in a text file (or html file).
This is so that the interface I have created can read this text file
and adapt as necessary.
If you have ascript like this, or could write or adapt one, I would
appreciate it greatly!!!
Niki Gomez
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 25 Aug 1999 20:23:51 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: ***HELP:searching for a newsgroup query script please
Message-Id: <7q1jcn$kui$8@info2.uah.edu>
In article <7q1ilf$br8$1@nnrp1.deja.com>,
niki@nirvanet.net writes:
: I am in dire need for a perl script which can query a NNTP server and
: count the number of headers for different newsgroups. The number of
: headers should then be stored in a text file (or html file).
Have you looked at the Net::NNTP module?
Greg
--
Now, it might be true that www.mtv.com attracts more visitors and gets
more "hits" than a site that makes RFCs available. But who the fuck cares?
-- Abigail
------------------------------
Date: Wed, 25 Aug 1999 12:33:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Calculating days, hrs, mins between 2 datestamps ...
Message-Id: <MPG.122de4e589eec18c989e99@nntp.hpl.hp.com>
In article
<0E16861EE7BCD111BE9400805FE6841F0B10BBEA@c1s5x001.cor.srvfarm.origin-
it.com> on Mon, 23 Aug 1999 08:52:41 +0200, Steve Button
<steve.button@nl.origin-it.com> says...
> TheEadsNet wrote in message
> <19990822110812.13887.00002282@ng-cq1.aol.com>...
> >
> >Does anyone know of a routine that will calculate the number of days,
> >hours, and minutes between two datestamps that consist of:
> >
> >mm/dd/yyyy-hh:mm
> >
> >If possible, not a Perl module, since my ISP won't allow me to install
> modules on my server.
...
> I've done something similar, but I can't remember exactly how at the moment.
> It envolved something like
> 1) taking the "date stamp" and formatting it.
> 2) using the gmtime (or localtime) function.
> 3) subtracting the two numbers.
> 4) converting the difference back into a tm structure.\
Well, that's fairly close. One does benefit from a module, but it is a
module that is already part of the standard perl distribution, so the
ISP isn't involved. The function is timegm (or timelocal).
The timestamps are assumed to be in UTC, so the arithmetic is Summer-
Time-clean. Otherwise one of the heavyweight CPAN Date modules would
indeed be required (as all the other posters assumed).
#!/usr/local/bin/perl -w
use strict;
use Time::Local;
# mm/dd/yyyy-hh:mm UTC
my $t0 = '01/01/1999-00:00';
my $t1 = '08/25/1999-20:08';
my $diff = gmt($t1) - gmt($t0);
printf "Difference between %s and %s is
%d days, %d hours, %d minutes.\n" =>
$t1, $t0, $diff/(24*60*60), $diff/(60*60) % 24, $diff/60 % 60;
sub gmt {
my ($month, $day, $year, $hour, $min) =
shift =~ m!(\d\d)/(\d\d)/(\d{4})-(\d\d):(\d\d)$!;
timegm(0, $min, $hour, $day, $month - 1, $year - 1900)
}__END__
Output:
Difference between 08/25/1999-20:08 and 01/01/1999-00:00 is
236 days, 20 hours, 8 minutes.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Aug 1999 20:03:18 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: Computing n.th root of a given number
Message-Id: <37C43DF6.38B1FD50@Mark.Com>
marcza@my-deja.com wrote:
> Given is a integer number n say n=11.
> I am searching the lowest integer number x which is
> taken as power(2) greater equal that this number n. Read:
>
> n <= 2**x with min x && x = integer
>
> example
> 11 <= 2**x => x = 4
>
> mathematically the solution should be something like
> roundup(ln(n)/ln(2))
>
> But what is the most efficient way to compute the solution ?
>
> Bye
Stay well away from logs. You can do this with the left shift operator
(<<)
Something like:
$num = 11;
$tmp = 1;
$count = 0;
while ($tmp < $num)
{
$count += 1;
$tmp = $tmp << 1;
}
print $count,"\n";
>
>
> Marcus
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Wed, 25 Aug 1999 14:42:06 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Computing n.th root of a given number
Message-Id: <x3yvha3wvlt.fsf@tigre.matrox.com>
marcza@my-deja.com writes:
> Given is a integer number n say n=11.
> I am searching the lowest integer number x which is
> taken as power(2) greater equal that this number n. Read:
my $n = 11;
my $x = 1;
$x <<= 1 while $x <= $n;
$x >>= 1;
or maybe:
my $n = 11;
my $x = 1;
$x <<= 1 while $x << 1 <= $n;
HTH,
Ala
------------------------------
Date: Wed, 25 Aug 1999 13:05:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: conditional sub defintion
Message-Id: <MPG.122dec66d823cc42989e9b@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7q17qa$32d$1@nnrp1.deja.com> on Wed, 25 Aug 1999 17:06:29
GMT, belg4mit@mit.edu <belg4mit@mit.edu> says...
> Is this even possible?
Something like it is possible.
> if($A){
> print "if ";
> sub baz{ print "true\n"; }}
> else{
> print "else ";
> sub baz{ print "false\n"; }}
>
> If run when A is 0 else is printed as expected. and baz prints false
> If run when A is 1 if is printed as expected. and baz prints false !!
And what did '-w' report? You *did* try that before posting, didn't
you?
> I've tried putting it in BEGIN{} as well thinking that might help...
Why? How?
#!/usr/local/bin/perl -w
use strict;
my $baz;
my $A = 1;
if($A){
print "if ";
$baz = sub { print "true\n"; };}
else{
print "else ";
$baz = sub { print "false\n"; };}
$baz->();
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 25 Aug 1999 20:13:37 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: conditional sub defintion
Message-Id: <7q1iph$kui$6@info2.uah.edu>
In article <7q17qa$32d$1@nnrp1.deja.com>,
belg4mit@mit.edu writes:
[how do I define subs conditionally?]
[15:12] ettsn% cat try
#! /usr/bin/perl -w
use strict;
use subs qw/ baz /;
my $cond = shift;
if ($cond) {
*baz = sub { print "true!\n" };
}
else {
*baz = sub { print "false!\n" };
}
baz;
[15:12] ettsn% ./try 0
false!
[15:12] ettsn% ./try 1
true!
Hope this helps,
Greg
--
Laws do not persuade just because they threaten.
-- Seneca
------------------------------
Date: Wed, 25 Aug 1999 21:03:53 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Converting strings to arrays question
Message-Id: <rs8mhplfh9723@corp.supernews.com>
If I have a loop like this:
foreach $value (values (%input_params))
{
push (@data, @value);
}
I want to turn $value into @value, for instance instead of dealing with $cpu,
I want to deal with @cpu. @($spu) does not work of course. Any suggestions?
------------------------------
Date: Wed, 25 Aug 1999 17:01:46 -0400
From: "Stan Weinronk" <weinronk@bu.edu>
Subject: DBD::DB2 on NT
Message-Id: <7q1lk6$3qj$1@news1.bu.edu>
Hi
I'm trying to build DBD::DB2 on NT. The Makefile produces warnings, and the
nmake fails. I'm new to make/nmake. Any ideas?
Regards,
Stan
D:\Installs\Perl\DB2\DBD-DB2-0.71>perl Makefile.pl
Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!
Using DB2 in D:/SQLLIB
DB2 sysliblist: -LD:/SQLLIB/lib db2cli
System: perl5.00502 MSWin32-x86-object dl_win32.xs
Compiler:
cl.exe -O2 -MD -DNDEBUG -TP -GX -O2 -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT
Note (probably harmless): No library found for 'oldnames.lib'
Note (probably harmless): No library found for 'kernel32.lib'
Note (probably harmless): No library found for 'user32.lib'
Note (probably harmless): No library found for 'gdi32.lib'
Note (probably harmless): No library found for 'winspool.lib'
Note (probably harmless): No library found for 'comdlg32.lib'
Note (probably harmless): No library found for 'advapi32.lib'
Note (probably harmless): No library found for 'shell32.lib'
Note (probably harmless): No library found for 'ole32.lib'
Note (probably harmless): No library found for 'oleaut32.lib'
Note (probably harmless): No library found for 'netapi32.lib'
Note (probably harmless): No library found for 'uuid.lib'
Note (probably harmless): No library found for 'wsock32.lib'
Note (probably harmless): No library found for 'mpr.lib'
Note (probably harmless): No library found for 'winmm.lib'
Note (probably harmless): No library found for 'version.lib'
Note (probably harmless): No library found for 'odbc32.lib'
Note (probably harmless): No library found for 'odbccp32.lib'
Writing Makefile for DBD::DB2::Constants
Writing Makefile for DBD::DB2
D:\Installs\Perl\DB2\DBD-DB2-0.71>nmake
Microsoft (R) Program Maintenance Utility Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.
cl.exe -c -ID:/SQLLIB/include -O2 -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -D
NO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT -O2 -MD -DNDEBUG -TP -GX -DVER
SION=\"0.20\" -DXS_VERSION=\"0.20\" -IC:\Perl\lib\CORE Constants.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 11.00.7022 for 80x86
Copyright (C) Microsoft Corp 1984-1997. All rights reserved.
Constants.c
Constants.xs(21) : error C2065: 's' : undeclared identifier
Constants.xs(22) : error C2448: 'not_here' : function-style initializer
appears to be a function definition
Constants.xs(22) : fatal error C1004: unexpected end of file found
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
D:\Installs\Perl\DB2\DBD-DB2-0.71>
------------------------------
Date: Wed, 25 Aug 1999 12:42:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Desperately searching for perl lint
Message-Id: <MPG.122de704335f2efb989e9a@nntp.hpl.hp.com>
In article <37c29f88.141743940@news1.on.sympatico.ca> on Tue, 24 Aug
1999 13:37:06 GMT, T. Alex Beamish <talexb@tabsoft.on.ca> says...
> My background (such as it is) in software development in C has taught
> me that it's always a good idea to use good indentation practices,
> lint your code and run it under a debugger to make absolutely sure
> that you, the compiler and the machine code agree on what's supposed
> to happen.
>
> Since moving over to perl a year ago I've tried to follow the same
> practices, but I do not see a perl lint anywhere. Before I attempt to
> write one myself (in perl, naturally), is there a tool that anyone can
> suggest?
The C lint is a static analyzer, which among other things attempts data-
flow analysis of the source code to identify variables that may be used
before being defined, for example. 'perl -w' does this at run time.
I wonder if that kind of static analysis is possible for Perl, except
with some restrictions. Specifically 'eval STRING' would blow it away,
and there may well be others.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 25 Aug 1999 20:09:23 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Desperately searching for perl lint
Message-Id: <7q1ihj$kui$5@info2.uah.edu>
In article <MPG.122de704335f2efb989e9a@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) writes:
: I wonder if that kind of static analysis is possible for Perl, except
: with some restrictions. Specifically 'eval STRING' would blow it away,
: and there may well be others.
Let's make a deal. I'll do the analysis stuff after you solve the
Halting Problem. :-)
Greg
--
Boon: Now, she should be decent looking, but we're willing to trade looks for
a certain kind of morally casual attitude.
------------------------------
Date: Wed, 25 Aug 1999 13:43:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Desperately searching for perl lint
Message-Id: <MPG.122df561ecab9202989e9c@nntp.hpl.hp.com>
In article <7q1ihj$kui$5@info2.uah.edu> on 25 Aug 1999 20:09:23 GMT,
Greg Bacon <gbacon@itsc.uah.edu> says...
> In article <MPG.122de704335f2efb989e9a@nntp.hpl.hp.com>,
> lr@hpl.hp.com (Larry Rosler) writes:
>
> : I wonder if that kind of static analysis is possible for Perl, except
> : with some restrictions. Specifically 'eval STRING' would blow it away,
> : and there may well be others.
>
> Let's make a deal. I'll do the analysis stuff after you solve the
> Halting Problem. :-)
OK. You do the work, and I win the Turing Award.
Seriously, when the only analysis is static -- based on the order of
statements in the sources -- why shouldn't a lint-like analysis be
possible (with the restriction I mentioned)? The C lint can be misled
by tricky flow control, but offhand I don't see anything in Perl that
would be any more complicated to analyze statically.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Aug 1999 19:49:18 GMT
From: "Dallas Jones" <dallas.jones@tech4learning.com>
Subject: Re: File Upload for WinNT W/ ActivePerl and CGI.pm-2.54
Message-Id: <2NXw3.42933$pq3.242726@news1.rdc1.sdca.home.com>
Well, I admit readily that I may be a knucklehead -- this may explain why I
couldn't get it working. I'll keep fiddling with it...
-Dallas
Ethan H. Poole <ehpoole@ingress.com> wrote in message
news:37C41EC2.7BB84841@ingress.com...
> Dallas Jones wrote:
> >
> > Hey, all --
> >
> > Thanks for the suggestions here and by e-mail. My upload script works
great
> > on FreeBSD, but I can't get it to work at all on Win NT. So -- I
scrapped
> > PERL on the NT machine and went with ASP instead. The moral seems to be
that
> > PERL likes UNIX a lot more than Win32...
>
> I would have to disagree on that point. I have written numerous scripts
> that run just as happily under NT as they do under UNIX variants.
> Including handling of file uploads.
>
> --
> Ethan H. Poole **** BUSINESS ****
> ehpoole@ingress.com ==Interact2Day, Inc.==
> (personal) http://www.interact2day.com/
------------------------------
Date: Wed, 25 Aug 1999 21:47:48 +0100
From: niki <niki@nirvanet.net>
Subject: HELP Please!! with a script to query newsgroups
Message-Id: <37C45674.C13D04ED@nirvanet.net>
Hello
Can anyone help me please????
I am in dire need for a perl script which can query a NNTP server and
count the number of headers for different newsgroups. The number of
headers should then be stored in a text file (or html file).
This is so that the interface I have created can read this text file
and adapt as necessary.
If you have ascript like this, or could write or adapt one, I would
appreciate it greatly!!!
Niki Gomez
------------------------------
Date: 25 Aug 1999 20:28:39 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: HELP Please!! with a script to query newsgroups
Message-Id: <7q1jln$kui$9@info2.uah.edu>
How many times are you going to post the same question?
Greg
--
VMS is a text-only adventure game. If you win you can use Unix.
-- Bill Davidsen
------------------------------
Date: Wed, 25 Aug 1999 20:39:47 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: How add a new key to a hash
Message-Id: <nwYw3.213$1k5.61083@news.shore.net>
Alec Kelingos <akelingos@petrosys-usa.com> wrote:
: I HAVE BEATEN THE FAQs AND MY TWO BOOKS to death but could find nothing -
: How does one add a key to a hash? I'm trying to build a hash dynamically:
You just refer to it.
my %hash = ( foo => 'bar',
bar => 'baz',
); # predefine hash
$hash{'oof'} = 'rab'; # add a value to hash with key 'oof'
Is that what you're looking for?
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 25 Aug 1999 20:37:46 GMT
From: a@b.com (pgmr)
Subject: Re: How to "unoverride" functions?
Message-Id: <80CD4CA65DC698D8.7B259DCA8C4A214B.1B18548C439871D4@lp.airnews.net>
Yes, thank you for that. The syntax is not the problem as these were
not actual code. I just typed them in as examples to show the problem
at hand. The actual code is much too long to be useful in a usenet
post. Assuming the syntax is correct (making your changes), the
program still does not work because of the fundamental problem of
overridden functions where the function overriding returns a different
data type (object) than the original function (list or scalar).
On 25 Aug 1999 09:44:43 -0500, abigail@delanet.com (Abigail) wrote:
>pgmr (a@b.com) wrote on MMCLXXXV September MCMXCIII in
><URL:news:F96FD15C3EB999E7.7688524E8CB97C5E.AE92050F9865D6BD@lp.airnews.net>:
>'' This does not work --
>''
>'' #!/usr/bin/perl
>'' use Time::localtime
> ^
> ;
>
>'' print timefunct(), "\n";
>'' exit;
>''
>'' sub timefunct () {
>'' my @now;
>'' my $str;
>''
>'' @now = localtime;
> CORE::localtime;
>'' $str = "$now[0]:$now[1]:$now[2]:now[3]";
> ^
> $
>'' return scalar $str;
>'' }
>''
>
>
>Abigail
------------------------------
Date: Wed, 25 Aug 1999 17:02:10 -0400
From: "maranGraphics Inc." <jill@maran.com>
Subject: Internet Technologies Writer Required
Message-Id: <DQYw3.1778$k7.134053@quark.idirect.com>
Internet Technologies Writer Required
Canada’s largest computer book publisher, located in Mississauga Ontario,
requires a writer to author advanced computer books. Must have excellent
knowledge in one or more of the following areas: HTML, Linux, Perl, ASP,
Java and JavaScript.
Our books have sold over 6 million copies to date, and are translated into
25 different languages. As an author, your name will appear in books that
are sold around the world. We offer a casual dress environment and regular
Monday to Friday business hours. Contract and full time positions
available.
Check out our web site at www.maran.com
Send resume to: jill@maran.com
------------------------------
Date: Wed, 25 Aug 1999 15:31:48 -0400
From: "Mayer, Shane" <mayers@psi.com>
Subject: more sub alias
Message-Id: <37C444A4.28EBABF7@psi.com>
Is there any way to alias perl internal functions?
For example, the following:
*foo = \&open;
foo( IN, "tmp" )
returns the error:
Undefined subroutine &main::open
Thanks,
Shane
------------------------------
Date: 25 Aug 1999 20:06:45 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: more sub alias
Message-Id: <7q1icl$kui$4@info2.uah.edu>
In article <37C444A4.28EBABF7@psi.com>,
"Mayer, Shane" <mayers@psi.com> writes:
: Is there any way to alias perl internal functions?
You can hack the perl source, but I doubt you're that desperate. What
is it that you're trying to do that makes you think you need to do
this?
: For example, the following:
: *foo = \&open;
: foo( IN, "tmp" )
:
: returns the error:
: Undefined subroutine &main::open
That's because \&open is a reference to the subroutine named open in
the current package. Although you can help the compiler disambiguate
between Perl builtins and user-defined subs with the CORE:: prefix,
you can't do things like, say, \&CORE::open. Bug or feature? :-)
Greg
--
Isn't it curious how ``page'' has become a colloquial term for the word
``document'' in hypertext, in a medium that does not have pages anymore?
Do we reuse words as soon as they are freed up by technology? Do we reuse
those of whose destruction we can't bear to be reminded? -- Jutta Degener
------------------------------
Date: Wed, 25 Aug 1999 14:44:17 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: my() vs. local()
Message-Id: <x3yu2pnwvi6.fsf@tigre.matrox.com>
marcza@my-deja.com writes:
> What is the difference between a variable declaration with
> my() and with local(). Shouldn't it be the same ?
No. Read the FAQs.
From perlfaq7:
What's the difference between dynamic and lexical
(static) scoping? Between local() and my()?
HTH,
Ala
------------------------------
Date: Wed, 25 Aug 1999 18:56:54 GMT
From: irf@netexecutive.com
Subject: newbie open() security question
Message-Id: <7q1e9f$8ca$1@nnrp1.deja.com>
hi
i have a html file retrieval script that gets input from a link, and
then uses that data to open the html file.
eg, if $data=data_from_form/link
open (HANDLE, "<../path/$data.html");
so i was wondering how secure the open function is - i've read
the security FAQs, but most of them warn about system operations like
sysread() - if i use this script is there a way people can access files
that are not .html files? perhaps by sending a url like:
script.cgi?data=../path/passwd+normalPage
??
oh, and the script's input parse function changes all '+' symbols
to spaces before the data is used, as per usual.
thanks, and i apologize if this is a FAQ, but i was unclear about the
secuity FAQs.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 25 Aug 1999 20:22:57 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: newbie: need help,LEARNING FROM A BOOK
Message-Id: <7q1jb1$kui$7@info2.uah.edu>
In article <slrn7s80pm.lb2.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) writes:
: Michael de Beer (madebeer@igc.apc.org) wrote on MMCLXXXIV September
: MCMXCIII in <URL:news:APC&1'0'50775d95'cb0@igc.apc.org>:
: ;; print 'I have $10 dollars\n"; # But this does not think $10 is a
: ;; # variable and so outputs
: ;; I have 10 dollars
:
: And that will print:
:
: I have $10 dollars
Negatory, good buddy. :-)
[15:21] ettsn% perl -w
print 'I have $10 dollars\n";
^D
Can't find string terminator "'" anywhere before EOF at - line 1.
Greg
--
Of course, postmodernism has taught us that there is no objective reality
and that we all forge our own interpretations, usually with long words and
often in French, about what reality we perceive. So I don't want to color
your interpretation. Except to say that it's wrong. :-) -- Jon Orwant
------------------------------
Date: Wed, 25 Aug 1999 19:44:27 GMT
From: belg4mit@mit.edu
Subject: Re: package
Message-Id: <7q1h2n$af0$1@nnrp1.deja.com>
Excellent. What about use? (as opposed to do or require?)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 25 Aug 1999 21:01:21 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Perl a Black Sheep?
Message-Id: <BQYw3.220$1k5.61083@news.shore.net>
joeyandsherry@mindspring.com wrote:
: Today I had an interview with an admissions counselor of a facility that
: offers training for the MCSE and the MCSD. I am hoping that this sort of
: certification may aid in my desire to change careers...
[snip]
: I told him of my learning of Perl and of how I used it, etc. As soon as I
: mentioned Perl and the UNIX server I use, he snarled. It was if I was
: speaking of a plague...He commented that Perl was not a "real" programming
: language, it is a scripting language and offered his dissertation on
: programming and Unix and other such things.
It's not surprising he wouldn't like perl if he provides Microsoft
training. People who who can write good perl code seldom need to purchase
Microsoft Bloatware.
: Why is Perl treated with such disdain? I've found many occasions where Perl
: programmers say "Perl can do that...", which doesn't seem to reinforce what
: I experienced today.
People who can't or don't use perl probably get sick of us perlers saying
"You could do that a lot easier with perl" all the time!
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Wed, 25 Aug 1999 13:34:04 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: Perl running on Unix and NT???
Message-Id: <37c450f2_2@news5.newsfeeds.com>
Phil:
It sounds like you need to get two static IP addresses -- one for
the Linux box and one for the NT box. Install a second NIC in the
Linux box and plug it into the NT box. Configure routing/
firewalling in the Linux box to suit -- LAN to WAN, LAN to NT, NT
to WAN, and vice-versa. Check out the relevant networking
README's, etc., that came with your Linux distribution.
Should be an interesting little project!
--
David Christensen
dchristensen@california.com
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 25 Aug 1999 13:44:48 -0700
From: b chung <bchung@ci.south-el-monte.ca.us>
Subject: print dollar format?
Message-Id: <37C455BF.5BECAA04@ci.south-el-monte.ca.us>
Hi, all
In Perl How do I print the 22343.87 like this $22,232.87
Any Ideas?
Thanks
Betty Chung
------------------------------
Date: 25 Aug 1999 16:42:32 -0400
From: meow <meowing@banet.net>
Subject: Re: puzzle
Message-Id: <87906z383r.fsf@slip-32-101-160-55.ma.us.ibm.net>
Mark Grimshaw <m.grimshaw@salford.ac.uk> wrote:
> I have some music on a certain well-known downloadable web music
> site from which visitors can listen to music and order CDs etc. and
> in which the music (3 tracks) participates in a hit-parade. With
> over 100,000 pieces on the site, those songs that appear in the top
> 40 will obviously attract more attention and are likely to sell more
> CDs.
That was once true, but currently the primary driver in those ratings
is CD sales. Downloads and page visits are given a *much* lower
precedence. If you want to have significant influence on those
charts, you need to send them money.
> In the time-honoured tradition of musical hype (cf popular music
> record companies buying albums to push them up the charts!), I'd
> like to hype my music and push it up the charts.
Go ahead. The identical technique will work for you there.
> I'm reasonably competent in Perl, have su access to a web server machine
> and have written a script that downloads the songs in question several
> thousands of times with as much randomness as I can think of (which
> songs, which of the several download servers they have, fictitious email
> etc.). However, this does not seem to have any effect.
Correct. The primary reason for those name-and-address forms is to
generate spam lists. Duplicate queries are weighted mostly by
originating addresses, and their charting formula takes this brand of
fraud into account.
As above, money talks and they'll ket you rig the charts if you buy
your own CDs. Perl won't help to get you what you want unless you
also intend to commit credit fraud, and I don't think you're going to
get much help with that one.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 641
*************************************