[10739] in Perl-Users-Digest
Perl-Users Digest, Issue: 4338 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 1 22:07:28 1998
Date: Tue, 1 Dec 98 19:00:20 -0800
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, 1 Dec 1998 Volume: 8 Number: 4338
Today's topics:
Affiliate script (Steven Edwards)
Re: Affiliate script (Martien Verbruggen)
Re: Batch Mailing <garethr@cre.canon.co.uk>
Re: Bug in strict (5.004_04) <garethr@cre.canon.co.uk>
Re: bug? <rra@stanford.edu>
Re: Changing Directory Problems (Martien Verbruggen)
delete a oldest entry from an array nguyen.van@imvi.bls.com
Help with Drop down list <derick@pacbell.net>
Re: How to change acl in the registry with a perl scrip (Tye McQueen)
Learning if Variable is array <blaylock@cs.byu.edu>
Re: Learning if Variable is array <che@debian.org>
Re: Learning if Variable is array <bprater@jipes.com>
Re: localtime () - perl's bug ? <rra@stanford.edu>
Re: localtime () - perl's bug ? (Larry Rosler)
Re: localtime () - perl's bug ? <crn@itga.com.au>
Re: Looking for code snippets <bprater@jipes.com>
Re: Memory in Perl (Charles DeRykus)
Re: Mounting Network Directories in Win32 Perl (Tye McQueen)
Re: Substitute (Martien Verbruggen)
Re: Terribly simply perl question about qw() <rra@stanford.edu>
Re: Using PERLDOC (Larry Rosler)
Re: Using PERLDOC <due@murray.fordham.edu>
Re: Using RCS in Perl scripts <rra@stanford.edu>
Re: Why is "... @foo ..." occasionally a syntax error? (Martien Verbruggen)
Re: Why is "... @foo ..." occasionally a syntax error? <rra@stanford.edu>
Re: Why is "... @foo ..." occasionally a syntax error? <rra@stanford.edu>
Re: Win32::ODBC on web trouble <perlguy@technologist.com>
Re: Win32::ODBC on web trouble (Martien Verbruggen)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 01 Dec 1998 19:55:55 GMT
From: rand@mindless.com (Steven Edwards)
Subject: Affiliate script
Message-Id: <3667495a.106049010@news.cchat.com>
Hi,
I'm trying to find a good script to run an affiliate program. If
anyone could help me out, I'd appreciate it.
Thanks,
Steven Edwards - rand@mindless.com
Spinal Confusion - http://come.to/SpinalConfusion
------------------------------
Date: Wed, 02 Dec 1998 02:11:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Affiliate script
Message-Id: <0l192.65$Fn3.102@nsw.nnrp.telstra.net>
In article <3667495a.106049010@news.cchat.com>,
rand@mindless.com (Steven Edwards) writes:
> I'm trying to find a good script to run an affiliate program. If
> anyone could help me out, I'd appreciate it.
# perldoc -f system
# perldoc perlop
Script:
my $af_program = "/usr/local/bin/some_proggie";
my $rc = system($af_program);
# Do some error checking here
You can send the check to my home address.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: Tue, 1 Dec 1998 21:06:12 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Batch Mailing
Message-Id: <siiufvbmij.fsf@cre.canon.co.uk>
Merrill Lynch <anybody@ml.com> wrote:
> Anyone got a clue how I can send an e-mail to someone, and when they
> open the thing, I get an e-mail back?
This is not a Perl problem; you'd have more chance of getting an answer
if you posted to comp.mail.misc.
A brief answer:
* The "Return-Receipt-To" message header may work for some Mail User
Agents if the user turns the feature on (e.g., Exmh, Netscape 4.5) and
for some Mail Transport Agents if the administrator has set it up
(e.g. versions of sendmail prior to 8.7). You can't expect it to work
work everyone you send e-mail to.
* Be aware of possible network bandwidth implications (automatic sending
of returns receipts may generate a lot of traffic, especially if
messages get bounced and the bounces trigger more return
receipts....). Do not send messages with "Return-Receipt-To" headers
as part of bulk mailings.
* Respect other people's privacy. They may not want to let you know
whether and when they read your e-mail.
Some pointers for further information:
How to get notified when an e-mail has been read/delivered?
http://www.informatik.uni-kiel.de/~ca/email/dsn.html
RFC1891: SMTP service extension for Delivery Status Notifications
ftp://src.doc.ic.ac.uk/rfc/rfc1891.txt
RFC2298: An extensible message format for Message Disposition Notifications
ftp://src.doc.ic.ac.uk/rfc/rfc2298.txt
--
Gareth Rees
------------------------------
Date: Tue, 1 Dec 1998 20:07:35 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Bug in strict (5.004_04)
Message-Id: <sin257bp88.fsf@cre.canon.co.uk>
ajs@ajs.com wrote:
> I was horrified to find that:
>
> perl -lwe 'use strict;my $x = 1;&y;&z;
> sub y{$x = 2}sub z{print $x};{package p;$x=3;print $x}print $x'
>
> fails to generate an error, and outputs:
>
> 233
Remember that `my' creates a lexically scoped variable, and if a `my'
statement has no enclosing block, then the scope of the lexical variable
is the file. So in the program:
my $x = 1; package A; $x = 2;
The second occurrence of $x refers the file-scoped lexical variable $x,
not to $A::x (which remains uninitialized).
--
Gareth Rees
------------------------------
Date: 01 Dec 1998 18:10:59 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: bug?
Message-Id: <ylww4be1jg.fsf@windlord.stanford.edu>
Martien Verbruggen <mgjv@comdyn.com.au> writes:
> Simon Josefsson <jas@pdc.kth.se> writes:
>> This works on Solaris, but not on IBM AIX 4.2. Is this a known bug?
>> $ perl -e 'printf "%f", NaN;'
>> panic: frexp at -e line 1.
>> $ perl -v
>> This is perl, version 5.004_04 built for aix
>> ...
> I suppose that it's a different implementation of sprintf in the
> standard libraries of the compiler or the platform you used. Perl just
> calls those.
I believe that as of Perl 5.004, Perl includes its own sprintf and no
longer calls the system library version. But I think your diagnosis is
correct, just not the function you're blaming. This appears to be a
problem with the string to floating-point conversion routine in the C
library on that host. It works fine on Solaris 2.6 under both 5.004_04
and 5.005_02.
Note that Perl itself does not understand NaN:
windlord:~> perl -we 'printf "%f\n", NaN'
Argument "NaN" isn't numeric in prtf at -e line 1.
NaN
and is actually treating it as an unquoted string.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 02 Dec 1998 02:08:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Changing Directory Problems
Message-Id: <Ii192.64$Fn3.102@nsw.nnrp.telstra.net>
In article <741rrq$951$1@nnrp1.dejanews.com>,
chada@hotbot.com writes:
> #!/usr/local/bin/perl
no -w?
no use strict?
You better start using those. They're tremendously helpful.
> #This is the only thing that needs to be changed.
> $home = "/usr/home/"; ## Change this to your userid.
You know that you can get the user id with getpwuid and consorts,
right? You should probably also honour the possible environment
variable $HOME.
# perldoc -f getpwnam
> chdir($home);
Not necessary to change dir.
> while($filename = <*>) {
globbing is bad. Using opendir, readdir is much preferred, more
portable, etc. Besides, you're missing all files that start with a . I
believe.
[SNIP of code]
I propose that you replace all that with something like:
#!/usr/local/bin/perl5.00404 -w
use strict;
use File::Find;
# The following is suggested in the perlop documentation
my $hdir = $ENV{'HOME'} || $ENV{'LOGDIR'} ||
(getpwuid($<))[7] || die "You're homeless!\n";
my $bytes = 0;
print "looking in directory: $hdir\n";
find(\&counter, $hdir);
sub counter
{
# You will have to find out for yourself whether you want to count
# symlinks, directory sizes and the like.
$bytes += -s "$File::Find::dir/$_"
unless (-d "$File::Find::dir/$_");
}
print "Number of bytes: $bytes\n";
A lot easier, and a lot more concise, isn't it?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Wed, 02 Dec 1998 00:59:45 GMT
From: nguyen.van@imvi.bls.com
Subject: delete a oldest entry from an array
Message-Id: <7423e1$fn9$1@nnrp1.dejanews.com>
Hi guys,
I'm trying to write a CGI script which takes a input from a form.
The input will put in a file ( database1 ) which I just want to have only 10
entries.if there is a 11th entry, the script should shift the oldest entry
to another file ( database2 ), and script's also able to delete that oldest
entry from database1 b/c I only want 10 entries in database1. I have problem
deleting the oldest entries ( i.e oldest entry of an array ). Please give
me a general form to solve this issue.
I also have another problem. I got an array of values from a singled name,
which resulted from "checkboxes" of a html form, but don't how get all
values which can put in a line. I only got the last value by doing this
print EVENT_LOG_TEXT "System:$FORM_DATA{'system'}<br>\n";
can you tell me how to get them all.
Thanks
Van Nguyen
_______________________________________________________________________
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 01 Dec 1998 18:55:19 -0800
From: "Derick A. Jackson" <derick@pacbell.net>
Subject: Help with Drop down list
Message-Id: <3664AC17.12B5A34C@pacbell.net>
Does anyone out there have any experience with using Perl with a
database to populate a drop down list on a HTML page?
Please send info. Thanks.
Derick A. Jackson
derick@pacbell.net
------------------------------
Date: 1 Dec 1998 20:15:53 -0600
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: How to change acl in the registry with a perl script?
Message-Id: <7427sp$5cj@fohnix.metronet.com>
pgkq@my-dejanews.com writes:
) I have 80 stand alone workstations (NT 4.0 sp3) that are NOT part of a
) domain. When I need to make a change I use PERL, .bat files, or whatever to
) get things done. I am trying to put winexit.scr in place (users keep walking
) off and leaving their workstations logged on). In order for a user to use
) winexit permissions need to be changed in the registry. Everyone needs Set
) Value and Create Subkey on
) HKEY_Local_Machine\Software\Microsoft\WindowsNT\CurrentVersion.
)
) How do I remotely change permissions on a registry key?
Win32API::Registry (part of libwin32) lets you set permissions
on Registry keys (and includes documentation, though almost none
about ACLs). But you'll need something else to build the ACL that
you want to put into place. The easiest way would be to get it
right on one system and then copy it to the other systems. And
you can use it with Win32::TieRegistry (also part of libwin32),
to make life easier.
Win32::FilePermissions knows how to build ACLs but keeps them
locked away internally and so can't be used on anything but files,
alas. One of the many poor design decisions that lead to the
creation of the Win32API:: module tree.
I'm not aware of any other modules that let you create/modify ACLs,
but then Win32 modules don't usually end up on the modules list,
alas, so I rarely expect to know about or be able to find a new
Win32 module.
Here is a sample based on some code I had lying around, complete
with error checks:
use Win32::TieRegistry (Delimiter=>"/"); # Exports $Registry.
my $key= $Registry->{"LMachine/Software/FoobarCorp/Widgets/"}
or die "Can't open SW/FoobarCorp/Widgets/ Registry key: $^E\n";
my $acl;
$key->RegGetKeySecurity( 4, $acl, 1024 ) # 4==DACL_SECURITY_INFORMATION
or die "Can't read ACL from SW/FoobarCorp/Widgets/ Registry key: $^E\n";
my $host;
foreach $host ( @ARGV ) {
if( ! defined( $key=
$Registry->{"//$host/LMachine/Software/FoobarCorp/Widgets/"} ) ) {
die "Can't open ${host}'s SW/FoobarCorp/Widgets/ Reg key: $^E\n";
} else {
$key->RegSetKeySecurity( 4, $acl ) # 4==DACL_SECURITY_INFORMATION
or warn "Can't set ${hosts}'s SW/FC/Widgets/ ACL: $^E\n";
}
}
undef $key; # Close last remote Registry.
Untested (not even compiled), but hopefully helpful.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Tue, 1 Dec 1998 17:52:44 -0700
From: Nate Blaylock <blaylock@cs.byu.edu>
Subject: Learning if Variable is array
Message-Id: <Pine.HPP.3.96.981201175048.7976A-100000@niue.cs.byu.edu>
Hello all,
I'm a newbie, so forgive my (probably) simple question.
Is there some sort of function that will tell me if a variable is an array
or a scalar?
thanks in advance,
Nate Blaylock
blaylock@cs.byu.edu
------------------------------
Date: 01 Dec 1998 17:11:44 -0800
From: Ben Gertzfield <che@debian.org>
Subject: Re: Learning if Variable is array
Message-Id: <yttemqj1h67.fsf@gilgamesh.cse.ucsc.edu>
>>>>> "Nate" == Nate Blaylock <blaylock@cs.byu.edu> writes:
Nate> Hello all, I'm a newbie, so forgive my (probably) simple
Nate> question.
Nate> Is there some sort of function that will tell me if a
Nate> variable is an array or a scalar?
Well, if a variable has a $ at the beginning of its name, it's a
scalar. If it has a @ at the beginning, it's an array. :)
Like this:
$scalar = 1;
@array = (1, 2, 3);
It's pretty easy to tell them apart, so you don't need a special
function for this. :)
Ben
--
Brought to you by the letters V and B and the number 1.
"XTC versus Adam Ant -- which one will survive?" -- They Might Be Giants
Debian GNU/Linux -- where do you want to go tomorrow? http://www.debian.org/
I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.
------------------------------
Date: Tue, 1 Dec 1998 19:20:21 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Learning if Variable is array
Message-Id: <3664954c.0@news.mediacity.com>
$ means scalar. @ means array.
Otherwise, you are looking for ref() probably.
Check your perlfunc for that.
Ben
Nate Blaylock wrote in message ...
>Hello all,
>
>I'm a newbie, so forgive my (probably) simple question.
>
>Is there some sort of function that will tell me if a variable is an array
>or a scalar?
>
> thanks in advance,
>
> Nate Blaylock
> blaylock@cs.byu.edu
>
>
------------------------------
Date: 01 Dec 1998 16:59:35 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: localtime () - perl's bug ?
Message-Id: <yl67bvfjew.fsf@windlord.stanford.edu>
Lloyd Zusman <ljz@asfast.com> writes:
> As a programmer who worked all through the 1970's, I assure you that
> these timing considerations were indeed concerns back then, and well
> into the 1980's. If your program made a single call to localtime(),
> then of course, you wouldn't notice the difference. However, if this
> call was made repeatedly within a large loop, the cumulative time saved
> by avoiding the extra subtraction could be easily measured with a
> wristwatch. Multiply that by the number of times the program was run
> and by the average number of programs that make similar use of
> localtime(), and you can get into some serious time savings.
> And remember that CPU-seconds were very expensive back then, so the time
> difference could also be measured by your bank balance.
There have been other good rebuttals to this, but I'll point out that you
can easily avoid the subtraction at the cost of increasing your
month-indexed data structure by one element. So there's a memory/time
tradeoff.
One problem with this argument is that it would also argue for having the
day of the month based on 0, but that wasn't done.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 1 Dec 1998 17:19:00 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: localtime () - perl's bug ?
Message-Id: <MPG.10ce3560a027b11b9898a2@nntp.hpl.hp.com>
In article <yl67bvfjew.fsf@windlord.stanford.edu> on 01 Dec 1998
16:59:35 -0800, Russ Allbery <rra@stanford.edu> says...
...
> There have been other good rebuttals to this, but I'll point out that you
> can easily avoid the subtraction at the cost of increasing your
> month-indexed data structure by one element. So there's a memory/time
> tradeoff.
>
> One problem with this argument is that it would also argue for having the
> day of the month based on 0, but that wasn't done.
When would you want to use the day of the month as an index, rather than
simply print it -- in which case you would have to add back the 1?
Note that day-of-the-week is also zero-based (Sunday = 0), for indexing
purposes. Day-of-the-year is counted in days since January 1 (i.e.,
also zero-based), but the reasons for that are obscure. Most calendars
consider Januaryt 1 to be day-of-the-year 1.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 02 Dec 1998 13:03:56 +1100
From: Clive Newall <crn@itga.com.au>
Subject: Re: localtime () - perl's bug ?
Message-Id: <v5ogpncnaq.fsf@itga.com.au>
Russ Allbery <rra@stanford.edu> writes:
> Lloyd Zusman <ljz@asfast.com> writes:
>
> > As a programmer who worked all through the 1970's, I assure you that
> > these timing considerations were indeed concerns back then, and well
> > into the 1980's. If your program made a single call to localtime(),
> > then of course, you wouldn't notice the difference. However, if this
> > call was made repeatedly within a large loop, the cumulative time saved
> > by avoiding the extra subtraction could be easily measured with a
> > wristwatch. Multiply that by the number of times the program was run
> > and by the average number of programs that make similar use of
> > localtime(), and you can get into some serious time savings.
>
> > And remember that CPU-seconds were very expensive back then, so the time
> > difference could also be measured by your bank balance.
>
> There have been other good rebuttals to this, but I'll point out that you
> can easily avoid the subtraction at the cost of increasing your
> month-indexed data structure by one element. So there's a memory/time
> tradeoff.
As there is in many design decisions...except these days it seems many
in the IT industry think the answer is always "buy more memory" and
"buy a faster box", "buy a bigger disk". Nice concept. Pity about the
real world.
>
> One problem with this argument is that it would also argue for having the
> day of the month based on 0, but that wasn't done.
Yeah. But you mostly print dates as "1-Jan-98" (yeah, I know.) rather
than "Jan first 98", don't you? ie: You translate month, or day of week
to a string, but rarely do this for day of month.
(Just a guess, but I'd suspect a heavy user of these routines is "ls"
and similar file "stat"ing things, at least on Unix, especially in the
early days...)
And a final note: OK. So "struct tm" isn't perfect, and with 20-20
hindsight every programmer today just *knows* they would have
designed it better, but it's too late. Rather than argue for change to
struct tm, people should have been arguing all this time for a better
(and different) API. But that would have been harder...
--
Clive Newall <crn@itga.com.au> / ITG Australia Ltd, Melbourne Australia
"I think Casper is the ghost of Richie Rich. I wonder how Richie died?"
"Perhaps he realized how hollow the pursuit of money is and took his own life"
--Bart and Lisa Simpson
------------------------------
Date: Tue, 1 Dec 1998 20:52:18 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Looking for code snippets
Message-Id: <3664aada.0@news.mediacity.com>
Look in the LWP module that come with 5.005, there are examples you can use
there.
Ben
Bob Reynolds wrote in message <74217m$6le$1@news1-alterdial.uu.net>...
>People,
>
>I looking to write some perl that connects to a secured web site and
>downloads pages and process's them.
>
>Ive heard all about the perl modules that add the HTTP functions, but
havent
>seen anyone using it yet/ docco for it
>
>Has anyone written any perl using the HTTP functions for ActiveWares' Perl
>for NT 5.005_02 (Active state bld 507) ?
>
>Got any good examples?
>
>
------------------------------
Date: Wed, 2 Dec 1998 01:34:02 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Memory in Perl
Message-Id: <F3BDor.DBy@news.boeing.com>
In article <741rvn$mh7$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to Erik
><eln@cyberhighway.net>],
>who wrote in article <741p3p$adj$4@news.cyberhighway.net>:
>> it is either deleted, undef'd, or goes out of scope.
>
>Wrong.
>
>> > - If not, will my()'d variables be cleared when the subroutine/block
>Wrong.
>
>local() - in the current implementation - actually releases the memory
>associated with the substituted value.
>
>Wrong.
>
One of four ... Now begone, grasshopper, and ponder the void
of 3 wrongs ;)
--
Charles DeRykus
------------------------------
Date: 1 Dec 1998 19:27:25 -0600
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: Mounting Network Directories in Win32 Perl
Message-Id: <74251t$m9s@fohnix.metronet.com>
"Indy" <indy@NOSPAMdemobuilder.com> writes:
) try
) system("net use p: \\server\directory");
You might take your own advise and try it.
system("net use p: \\\\server\\directory");
is likely to work better.
) can use "\\server\directory\foo.txt"
s/\\/\\\\/g;
that is, use "\\\\server\\directory\\foo.txt".
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Wed, 02 Dec 1998 01:46:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Substitute
Message-Id: <QZ092.60$Fn3.299@nsw.nnrp.telstra.net>
In article <3664875D.DED235C0@email.sps.mot.com>,
Tk Soh <r28629@email.sps.mot.com> writes:
> DATA is a special filehandler that refers to anything after __END__ or
> __DATA__ tokens. You should try to stay away from it.
I do agree that it is not adviseable to use DATA as a file handle,
unless you mean the special one, but there is nothing wrong with it at
all, and it will work as expected.
#!/usr/local/bin/perl -w
use strict;
open(DATA, $0) || die "Couldn't open $0: $!";
while (<DATA>)
{
print;
}
__DATA__
foo
bar
The above neatly outputs the program itself.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: 01 Dec 1998 18:06:29 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Terribly simply perl question about qw()
Message-Id: <ylzp97e1qy.fsf@windlord.stanford.edu>
James Weisberg <chadbour@news.wwa.com> writes:
> As for your question, I expected variables to be interpolated because in
> my scanning through some of the libraries, I saw many instances of lines
> like the following:
> @EXPORT = qw(&GetOptions $REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER);
> which can be found in the Getopt/Long.pm file. I thought I rightfully
> assumed that my variables should have been interpolated and that I was
> doing something wrong.
Looks like several people grumbled at you after you posted the above, but
no one actually explained why the above code didn't imply what you'd
thought. The answer is that @EXPORT and other similar variables (use vars
is the other place you see this) are actually expecting the literal
*string* '&GetOptions', not its interpolated value. The intention of the
above code is to export a sub &GetOptions and variables $REQUIRE_ORDER,
$PERMUTE, and $RETURN_IN_ORDER to the rest of the program and Exporter is
treating those as literal strings.
If qw// interpolated, it would actually *break* the above code, although
that's not obvious without an understanding of what that code is doing.
(And I find Exporter a bit obscure on first glance.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 1 Dec 1998 16:55:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using PERLDOC
Message-Id: <MPG.10ce2fe0cd7077e99898a1@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <36647846.72062620@news.fwi.com> on Tue, 01 Dec 1998 23:15:35
GMT, Hawkwynd <hawkwynd@adelphia.net> says...
> On Tue, 1 Dec 1998 07:37:21 -0500 of the dragon, in
> comp.lang.perl.misc, it was read from the pen of "Allan M. Due"
> <Allan@due.net> :
> >It is my understanding that ActiveState decided not to include the pod files
> >with their distribution. There is a pod subdirectory, but it only includes
> >HTML files. I solved this problem by obtaining a copy of the missing pod
> >files and placing them in the pod directory. It seems really odd to me that
> >ActiveState includes perldoc.bat but not the pod files themseleves.
>
> And you got the pod files from.... And the missing pos files are...
> And I can find them where....?
I have a perfectly vanilla installation of ActiveState 5.005_02 build
506, and the pod documents are all in D:/perl/lib/pod .
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 2 Dec 1998 02:18:10 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Using PERLDOC
Message-Id: <742812$jlt$0@206.165.167.200>
Larry Rosler wrote in message ...
>[Posted to comp.lang.perl.misc and a copy mailed.]
>
>In article <36647846.72062620@news.fwi.com> on Tue, 01 Dec 1998 23:15:35
>GMT, Hawkwynd <hawkwynd@adelphia.net> says...
>> On Tue, 1 Dec 1998 07:37:21 -0500 of the dragon, in
>> comp.lang.perl.misc, it was read from the pen of "Allan M. Due"
>> <Allan@due.net> :
>> >It is my understanding that ActiveState decided not to include the pod
files
>> >with their distribution. There is a pod subdirectory, but it only
includes
>> >HTML files. I solved this problem by obtaining a copy of the missing
pod
>> >files and placing them in the pod directory. It seems really odd to me
that
>> >ActiveState includes perldoc.bat but not the pod files themseleves.
>>
>> And you got the pod files from.... And the missing pos files are...
>> And I can find them where....?
>
>I have a perfectly vanilla installation of ActiveState 5.005_02 build
>506, and the pod documents are all in D:/perl/lib/pod .
>
Hmm, mine build is 502, that could explain the difference. There where no
pod files in my installation, I had to import them from the Sarathy Standard
version. Time to upgrade I guess.
AmD
------------------------------
Date: 01 Dec 1998 18:02:10 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Using RCS in Perl scripts
Message-Id: <yl3e6zfgil.fsf@windlord.stanford.edu>
Zenin <zenin@bawdycaste.org> writes:
> This is a little long, but it gets the job done nicely:
> $VERSION = do { sprintf '%d.%03d'.'%02d' x ($#r-1), (q$Revision: 2.10 $ =~ /\d+/g) };
Where do you set @r?
windlord:~> perl -e 'print do { sprintf "%d.%03d"."%02d" x ($#r-1), (q$Revision: 2.10.4 $ =~ /\d+/g) }, "\n";'
2.010
Doesn't seem to be working quite right.
If you don't use branches, this works fine:
($VERSION = (qw$Revision: 1.2 $)[-1]) =~ s/\.(?!\d\d)/.0/;
Argh. I can *almost* do this accounting for branches in a single
80-column line, but not quite. I could if we had variable-length negative
lookbehind in the regex engine.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 02 Dec 1998 01:42:48 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <sW092.58$Fn3.299@nsw.nnrp.telstra.net>
In article <fl_aggie-0112981815420001@aggie.coaps.fsu.edu>,
fl_aggie@thepentagon.com (I R A Aggie) writes:
> Why is @resource double quoted? That is the root of your problem,
> perl does not know if $extra should be the literal string @resource,
> or the actual value of assigning a list to a scalar.
<NIT ACTION="PICK">
The value of an 'assignment' of a list to a scalar is not the same as
the interpolation of an array inside double quotes.
> perl
@a = qw(a b c d e);
$x = @a;
$y = "@a";
$z = ("a", "b", "c", "d", "e");
print "$x - $y - $z\n";
__END__
5 - a b c d e - e
</NIT>
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: 01 Dec 1998 18:14:47 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <ylr9uje1d4.fsf@windlord.stanford.edu>
I R A Aggie <fl_aggie@thepentagon.com> writes:
> jc@eddie.mit.edu wrote:
>> This was a fatal syntax error. Here's the offending line:
>> $extra = "@resource" if ($typ eq 'lab');
> Why is @resource double quoted? That is the root of your problem, perl
> does not know if $extra should be the literal string @resource, or the
> actual value of assigning a list to a scalar.
Er, that's perfectly legal Perl. It means the same thing as:
$extra = join ($", @resource) if ($typ eq 'lab');
His meaning isn't ambiguous in this case, provided that there's actually
an array @resource in his program.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 01 Dec 1998 18:13:17 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <ylu2zfe1fm.fsf@windlord.stanford.edu>
Martien Verbruggen <mgjv@comdyn.com.au> writes:
> John Chambers <jc@eddie.mit.edu> writes:
>> Hmmm ... I wonder how one goes about declaring an array in perl.
use vars qw(@array);
will declare @array.
> Since perl is a freeform language, the inital use of a variable is also
> its declaration.
Not under use strict, which is what was being discussed. use strict
requires that all variables either be my variables or be declared in some
fashion (generally with use vars).
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 01 Dec 1998 19:15:37 -0600
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Win32::ODBC on web trouble
Message-Id: <366494B9.B982F3EA@technologist.com>
> I have a program that uses the Win32::ODBC module to access an SQL
> server, and although it runs just fine from DOS, when you try to run it
> off a webpage, it halts somewhere while accessing the module. (scripts
> that
> don't use other modules and dll's run OK). What am I doing wrong?
>
> thanks
> -tom
When you run it from a DOS prompt, what user are you logged in as?
When the script is run via the web, what user is it run as?
Are the rights the same???
Brent
--
Java? I've heard of it, it is what I drink while hacking Perl! -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Wed, 02 Dec 1998 01:49:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Win32::ODBC on web trouble
Message-Id: <m0192.61$Fn3.299@nsw.nnrp.telstra.net>
In article <366494B9.B982F3EA@technologist.com>,
Brent Michalski <perlguy@technologist.com> writes:
> When you run it from a DOS prompt, what user are you logged in as?
DOS? user? Since when is that combination valid?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4338
**************************************