[19509] in Perl-Users-Digest
Perl-Users Digest, Issue: 1704 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 6 14:06:04 2001
Date: Thu, 6 Sep 2001 11:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999799513-v10-i1704@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 6 Sep 2001 Volume: 10 Number: 1704
Today's topics:
ANNOUNCE: Weather::Underground to retrieve weather info (Mina Naguib)
Re: Baiting Gozilla to obtain quality code for nothing! <peb@bms.umist.ac.uk>
Re: Best Perl shops? (Randal L. Schwartz)
build DBI module for Perl on NT box (Jiqun Wang)
Re: can this perl script be more elegant/shorter ? <krahnj@acm.org>
Can't understand this 'Unitialized Value' error in patt (David R. Throop)
Re: Can't understand this 'Unitialized Value' error in <joe+usenet@sunstarsys.com>
cant send with GD generated image :(( <romanjoost@gmx.de>
Re: cant send with GD generated image :(( (Chris Fedde)
Re: Compiling Scripts to DOS EXEs <samneric@tigerriverOMIT-THIS.com>
Confused (again) over complex data structures. (Stan Brown)
Re: Daily iteration (Randal L. Schwartz)
Re: Evaluation order of object methods <djberge@qwest.com>
FBox and FileSelect, making them beahve in a similar ma (Stan Brown)
Re: File::Find not recursing on Win32 Perl 5.001 <dtweed@acm.org>
form input changed from Select to hidden, no errors and <dmartin119@home.com>
Re: form input changed from Select to hidden, no errors (Chris Fedde)
Genericly printing the arguments to s afunction? (Stan Brown)
Re: Genericly printing the arguments to s afunction? <mbudash@sonic.net>
Re: Genericly printing the arguments to s afunction? <tinamue@zedat.fu-berlin.de>
Re: Genericly printing the arguments to s afunction? (Stan Brown)
Re: Genericly printing the arguments to s afunction? <tinamue@zedat.fu-berlin.de>
How can I determine if a script has write permission in (Stan Brown)
Re: How can I determine if a script has write permissio (Rafael Garcia-Suarez)
Re: How can I determine if a script has write permissio <Laocoon@eudoramail.com>
Re: How can I determine if a script has write permissio (John J. Trammell)
Re: How can I determine if a script has write permissio <jurgenex@hotmail.com>
Re: How can I determine if a script has write permissio (Tad McClellan)
Re: How can I wait in perl? (Jonas Nilsson)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Sep 2001 10:32:21 -0700
From: spam@thecouch.homeip.net (Mina Naguib)
Subject: ANNOUNCE: Weather::Underground to retrieve weather information from wunderground.com
Message-Id: <tpfdc5lc9spe95@corp.supernews.com>
Announcing a new perl module Weather::Underground written in 100% perl
The module provides an easy OO interface to retrieving weather
information about a specific geographical location.
It does so by querying and parsing the reply/replies from
http://www.wunderground.com, which is where the module name comes
from.
After a lot of testing and recommended bugfixed from friends etc, and
consuming most of the 0.xx and 1.xx versioning area, the module is now
being offered to the public starting at version 2.00.
The module is available from:
http://www.topfx.com/modules/
And hopefully it will be available on CPAN shortly.
For feedback please do not use the originating address of this usenet
post, but rather the address found in the .pm fiel in the module (also
available post-installation when you do perldoc Weather::Underground)
Thank you, and I hope to hear from you soon.
------------------------------
Date: Thu, 06 Sep 2001 14:12:52 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: Baiting Gozilla to obtain quality code for nothing!!
Message-Id: <3B977654.C70B8EFB@bms.umist.ac.uk>
Matt Garrish wrote:
> And all this time I thought he was Don King's hideous love child...
What's all this 'he' business. If you'd all been reading as many of
Kiras posts as you imply I would have thought it obvious that *he* is a
*she*.
Godzilla! Queen Of Cream Pi.
Godzilla! Queen Of Semantic Guerrillas.
Godzilla! Queen Of Perl Heretics.
Godzilla! Queen Of Realitia.
Godzilla! Queen Of Consistent Erronia.
Godzilla! Queen Of Sky Pilots.
Godzilla! Queen Of Coherentia.
Godzilla! Queen Of Decimalatia.
etc
etc
etc
...
Godzuki! King of pointless posts. (well ok Paul really)
------------------------------
Date: 06 Sep 2001 06:29:06 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Best Perl shops?
Message-Id: <m1r8tk30t9.fsf@halfdome.holdit.com>
>>>>> "Clarence" == Clarence Johnson <clarencewjohnson@yahoo.com> writes:
Clarence> need to build a perl interface to a c library. i checked
Clarence> out www.perl.org and couldn't find the list you were
Clarence> referring to.
Using Inline::C (the module that won this year's "best of show" at
TPC), the task is rather simple.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 6 Sep 2001 08:50:33 -0700
From: jwang@maill.com (Jiqun Wang)
Subject: build DBI module for Perl on NT box
Message-Id: <c984ba95.0109060750.17026882@posting.google.com>
Hi,
What I am doing is to build a DBI module for the core perl
distribution on
my NT box.
> During the "nmake" process, I met this error:
> D:\perl\5.00503\bin\mswin32-x86\perl.exe -ID:\perl\5.00503\lib\MSWin32-x86
> -ID:\perl\5.00503\lib -e "system qq[pl2bat.bat ].shift" blib\script\dbish
> The name specified is not recognized as an internal or external command,
> operable program or batch file.
> ---------- end of msg ------------------
I am using core Perl distribution (5.00503) coming with Oracle9i App
Svr. NT4.0, Visual C++ 6.0 installed.
Could anyone give me some tips on how to solve this problem?
Thanks in advance.
Jay
------------------------------
Date: Thu, 06 Sep 2001 14:21:54 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: can this perl script be more elegant/shorter ?
Message-Id: <3B9786F8.96CC0841@acm.org>
Benjamin Goldberg wrote:
>
> Tim wrote:
> >
> > Hi,
> >
> > Could some one help me to make this script more elegant and shorter ?
>
> Sure.
>
> Also, I'm not sure how well other people's suggestions deal with the
> backslash-newline continuation marks.
>
> #!/usr/local/bin/perl -w
>
> my ($input, $output) = qw( chaintest.scan OUT );
> open INPUT , "< $input" or die "Cannot read from $input: $!\n";
> my $chains = do { local $/; <INPUT> };
> close INPUT;
>
> PREPROCESS: { # it's a block, not a sub... the label is for convenience
> # since \s includes newlines, the following two expressions
> # get rid of leading blanks, trailing blanks, *and* empty lines.
> # some folks don't realize it gets rid of empty lines, but it
> # does.
> $chains =~ s/^\s+//mg;; $chains =~ s/\s+$//mg;
> # This removes backslash-newline type continuations.
> $chains =~ s/\\\n//g;
> }
>
> open OUTPUT, "> $output" or die "Cannot write to $output: $!\n";
> select OUTPUT; # this mean, by default, print goes to OUTPUT.
>
> my ($ct_scanout, @chains);
> foreach ( split /;/, $chains ) {
> ($ct_scanout = $1), if /apply\s+"grp\d_(un)load/;
> next unless m/chain "chain([1-7])" = "(.*?)"/s;
> $chains[$1-1] = $2;
> next if $1 < 7;
> foreach( @chains ) {
> tr/01X//cd; # delete everything but 0, 1, and X
> $ct_scanout
> ? tr/01X/LH/d # translate 01, get rid of X.
> : tr/X/0/; # translate X.
> }
> my $ct = $ct_scanout ? "(ct_so" : "(ct_si";
> while( grep(length, @chains) == 7 ) {
> print $ct, map( substr($_,0,1,""), @chains ), ")\n";
> }
> }
>
> close OUTPUT;
>
> __END__
>
> I realize that my preprocess does different stuff than yours, but I
> don't think that the stuff you do there is actually needed, and do think
> that the stuff I do is.
This program produces the same output as yours (and is definitely
shorter.)
#!/usr/local/bin/perl -w
my $output = qw( OUT );
open OUTPUT, "> $output" or die "Cannot write to $output: $!\n";
__END__
John
--
use Perl;
program
fulfillment
------------------------------
Date: 6 Sep 2001 10:44:56 -0500
From: throop@cs.utexas.edu (David R. Throop)
Subject: Can't understand this 'Unitialized Value' error in patternmatch
Message-Id: <9n85lo$b21$1@yojo.cs.utexas.edu>
[Apologies in advance for the long lines, but I can't reliably
reproduce this error with a shorter test string.]
Running Perl 5. I'm building a simple sentence parser. It first goes
through a sentence and assigns a part-of-speech to each word. It
packs the result into a tab-delimited string. Then it looks for
patterns in that assignment.
I'm getting a bizarre 'uninitialized value' error that I just can't
figure. I build a long pattern which (correctly) fails to match the
test string. (line 64) Then I add on a single '?' operator after the
last pair of parenthesis (which should make the pattern match
succeed), and I get this error.
Am I overlooking anything obvious?
DB<63> $foo = "VERB\cIARTICLE\cINUMBER\cICONNECTION\cIPREPOSITION\cIUNKNOWN\cIPRONOUN"
DB<64> p $foo =~ /^(.*)\bVERB\t(ARTICLE\t)?(NUMBER\t)?((UNKNOWN|EQUIPMENT|STRUCTURE|TOOL|CONNECTION|CLOSURE)\t?)+(GROUPING)/
DB<65> p $foo =~ /^(.*)\bVERB\t(ARTICLE\t)?(NUMBER\t)?((UNKNOWN|EQUIPMENT|STRUCTURE|TOOL|CONNECTION|CLOSURE)\t?)+(GROUPING)?/
ARTICLE NUMBER CONNECTION CONNECTIONUse of uninitialized value at (eval 7) line 2, <IN> chunk 5.
eval '($@, $!, $,, $/, $\\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
print {$DB::OUT} $foo =~ /^(.*)\\bVERB\\t(ARTICLE\\t)?(NUMBER\\t)?((UNKNOWN|EQUIPMENT|STRUCTURE|TOOL|CONNECTION|CLOSURE)\\t?)+(GROUPING)?/;
;' called at /opt/gnu/lib/perl5/perl5db.pl line 1164
DB::eval called at /opt/gnu/lib/perl5/perl5db.pl line 1069
DB::DB called at referer line 11
Here's the version and module info:
'Carp.pm' => '/opt/gnu/lib/perl5/Carp.pm'
'Exporter.pm' => '/opt/gnu/lib/perl5/Exporter.pm'
'Term/ReadLine.pm' => '/opt/gnu/lib/perl5/Term/ReadLine.pm'
'ctime.pl' => '/opt/gnu/lib/perl5/ctime.pl'
'dumpvar.pl' => '/opt/gnu/lib/perl5/dumpvar.pl'
'perl5db.pl' => '1.01 from /opt/gnu/lib/perl5/perl5db.pl'
'vars.pm' => '/opt/gnu/lib/perl5/vars.pm'
This is perl, version 5.004_04 built for sun4-solaris
Thanks
David Throop
------------------------------
Date: 06 Sep 2001 12:48:04 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Can't understand this 'Unitialized Value' error in patternmatch
Message-Id: <m3ae08gta3.fsf@mumonkan.sunstarsys.com>
throop@cs.utexas.edu (David R. Throop) writes:
> I'm getting a bizarre 'uninitialized value' error that I just can't
> figure. I build a long pattern which (correctly) fails to match the
> test string. (line 64) Then I add on a single '?' operator after the
> last pair of parenthesis (which should make the pattern match
> succeed), and I get this error.
^^^^^
ITYM "warning" here.
>
> Am I overlooking anything obvious?
Does this help?
% perl -wle '$_="a b"; @_ = /(a) (b)/; print scalar @_'
2
% perl -wle '$_="a b"; @_ = /(a) (c)?/;print scalar @_'
2
--
Joe Schaefer "A man cannot be too careful in the choice of his enemies."
--Oscar Wilde
------------------------------
Date: Thu, 06 Sep 2001 17:06:20 +0200
From: Roman Joost <romanjoost@gmx.de>
Subject: cant send with GD generated image :((
Message-Id: <9n83e5$64cc4$1@ID-63142.news.dfncis.de>
Hi!
I think it's not a big problem. I would render a string to an image and
send this image as a MIME mixed email to a user. I can output the image as
well with
binmode STDOUT;
print $image->png;
But i would send this manipulated image to a user using MIME:Lite.
$png_data = $image->png;
$mail = MIME::Lite->new(
From => $sndemail,
To => $rcpemail,
Subject => 'ecard',
Type => 'multipart/mixed'
);
$mail->attach(Type => 'TEXT',
Data => $sndtext
);
$mail->attach(Type =>'image/png',
Path => $png_data,
Disposition=>'attachment'
);
$mail->send;
The problem is, that the script fails and my http.error log is filled up
with binary png data.
Has anyone a idea, how i would get the $image to an attachment of the
email??
It would be great. Thanks!
Roman
------------------------------
Date: Thu, 06 Sep 2001 15:47:25 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: cant send with GD generated image :((
Message-Id: <hUMl7.164$Owe.192997888@news.frii.net>
In article <9n83e5$64cc4$1@ID-63142.news.dfncis.de>,
Roman Joost <romanjoost@gmx.de> wrote:
>Hi!
>
>$mail->attach(Type =>'image/png',
> Path => $png_data,
> Disposition=>'attachment'
> );
>
I think that you want 'Data => $ping_data' instaid of Path.
Good luck!
--
This space intentionally left blank
------------------------------
Date: Thu, 6 Sep 2001 09:57:39 -0400
From: Samneric <samneric@tigerriverOMIT-THIS.com>
Subject: Re: Compiling Scripts to DOS EXEs
Message-Id: <MPG.16014a7fa9f3e07f9896ab@news.onemain.com>
Graham W. Boyes wrote:
> Reading the usenet archives I've found a lot of folks use Perl2EXE for
> compiling their scripts. However my script needs to be run off a
> Windows 98 boot disk. Perl2EXE's compiler told me that my script
> needed to be run under Microsoft Windows.
A boot disk loads an operating system. So what operating system gets loaded
from a Windows98 boot disk?
------------------------------
Date: 6 Sep 2001 13:58:17 -0400
From: stanb@panix.com (Stan Brown)
Subject: Confused (again) over complex data structures.
Message-Id: <9n8dfp$sa1$1@panix1.panix.com>
Iahe an rference to an array of references to arrays, as returned by
DBI::fetchrow_arrayref. I am able to acces individual scalars from this
structure using something liek:
$records_array_ref->[($pos - 1)]->[$i]
Now, I'm trying to pass each of the individual arrays to a DBI insert
staement. The statement is defined like this:
INSERT INTO stan VALUES ( ?, ?, ?, ?, ?, ?, ? )
And I;m currently doing something like:
foreach (@$records_array_ref)
{
$stho->execute (@$records_array_ref->[$i++]);
}
But what is getting put in the DB are the references, not the data.
What am I doing wrong?
------------------------------
Date: 06 Sep 2001 06:25:21 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Daily iteration
Message-Id: <m1y9ns30zi.fsf@halfdome.holdit.com>
>>>>> "Sean" == Sean Hamilton <sh@planetquake.com> writes:
Sean> Woah, major misconception.
Sean> I'm trying to draw a calendar (via CGI) with the first visible day set to
Sean> today.
See HTML::CalendarMonthSimple in the CPAN.
Don't reinvent the wheel.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 6 Sep 2001 10:48:01 -0500
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: Evaluation order of object methods
Message-Id: <nQMl7.492$1V2.255807@news.uswest.net>
<snip>
> In my example, everything was in the "ARRAY" class, so a line like the
> above worked perfectly ok, since an anonymous array is always an
> instance of type ARRAY, even without blessing it. Your code, however,
> is in class Set::Array, not ARRAY. So you need to bless the thing
> before you return it.
Lost this thread for a while. :(
Ah, I see now Benjamin. Well, uh, unfortunately I was actually thinking of
trying to make something publishable and I'm afraid that if I put this in
the package ARRAY I'll be hunted down and stoned to death by the perl
community since I would be redefining the behavior of their arrays, possibly
without their knowledge (if they didn't read the docs or didn't understand).
Or perhaps I'm confused again. :|
After tinkering some more, I made a command decision - have *everything*
return a blessed reference. This makes life easier at the expense of two
minor annoyances. First, I'll have to dereference everything, including
scalars. Second, I'll have to use the reftype method (vs. ref) to get the
underlying type (unless I *want* to the class name). I also decided to just
allow '1' be passed to a method in order to not modify the object.
e.g.
my $len = $sao->unique()->length(); # Modifies object
my $len = $sao->unique(1)->length(); # Doesn't modify object
Regards,
Mr Sunblade
------------------------------
Date: 6 Sep 2001 09:44:43 -0400
From: stanb@panix.com (Stan Brown)
Subject: FBox and FileSelect, making them beahve in a similar manner
Message-Id: <9n7ukb$iev$1@panix3.panix.com>
I'm writing a perlTK script that will be used by a variey of users. I
decided to offer the user teh choice of the FBox, or FileSelect widget for
slecting a file to write the results to.
Problem is, I can't make them behave the same. You can see this using the
demo that's in the widget script.
The biggest problem at the moment has to do with the directory that is
first offered when the widget is invoked. FileSelect does as I expect and
accepts the initialdir paramater. FBox chhoses to ignore this, and always
displays starting with the root directory.
How can I fix this?
Also I have not been able to find any docs on FBox, where might I look?
------------------------------
Date: Thu, 06 Sep 2001 13:53:59 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: File::Find not recursing on Win32 Perl 5.001
Message-Id: <3B977EDA.62B755E4@acm.org>
Phil Hibbs wrote:
> This is windows. We don't have symbolic links 'round here.
Try this. It's code that I've used, with minor tweaks, on DOS and Windows
platforms since Perl4 days. Obviously, the '&& -l "$path/$_"' test is
a no-op on Windows and can be removed if you like. Also, if the
'local (*DIR);' line gives you trouble in 5.001, it can be safely removed
as long as you don't have another filehandle named 'DIR'.
-- Dave Tweed
#!perl -w
# ls.pl - example of walking a directory tree, for comp.lang.perl.misc
@ARGV = qw(.) unless @ARGV;
for (@ARGV) { &process_directory ($_); }
sub process_directory {
my ($path) = @_;
# get all of the names from the directory,
# excluding "." and ".." and symbolic links
local (*DIR);
opendir (DIR, $path) || die "can't open directory $path: $!";
my @names = grep (!/^\.\.?$/ && !-l "$path/$_", readdir DIR);
closedir DIR;
# the sort is optional
for (sort @names) {
my $temp = "$path/$_";
if (-d $temp) {
print $temp, "/\n";
# do additional directory processing here
&process_directory ($temp);
} else {
print $temp, "\n";
# do additional file processing here
}
}
}
------------------------------
Date: Thu, 06 Sep 2001 15:27:30 GMT
From: "JerryGarciuh" <dmartin119@home.com>
Subject: form input changed from Select to hidden, no errors and no search results
Message-Id: <CBMl7.160097$oh1.67793303@news2.rdc2.tx.home.com>
Hi,
I'm working on modifying a the MSA Simple Search script for my site. It's
written in perl. The bug I have encountered is that when I changed the
boolean and case Select fields into hidden fields the script still runs
without error but returns no results even though the results display the
vars and they are the same whichever way I do it. So the script is
receiving the vars, putting them in into the mix but somehow then
eliminating all the results. I triple checked spelling and case between the
2 setups and they match.
Any suggestions?
TIA
jg
--
http://www.nolaFlash.com
We, in all humidity, are the people
of currant times. This concept grinds
our critical, seething minds to a halt.
~~Anders Henriksson
"Life Reeked With Joy"
------------------------------
Date: Thu, 06 Sep 2001 16:09:02 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: form input changed from Select to hidden, no errors and no search results
Message-Id: <ycNl7.165$Owe.199002624@news.frii.net>
In article <CBMl7.160097$oh1.67793303@news2.rdc2.tx.home.com>,
JerryGarciuh <dmartin119@home.com> wrote:
>Hi,
>I'm working on modifying a the MSA Simple Search script for my site. It's
>written in perl. The bug I have encountered is that when I changed the
>boolean and case Select fields into hidden fields the script still runs
>without error but returns no results even though the results display the
>vars and they are the same whichever way I do it. So the script is
>receiving the vars, putting them in into the mix but somehow then
>eliminating all the results. I triple checked spelling and case between the
>2 setups and they match.
>Any suggestions?
>TIA
>jg
>
Post a small but complete code segment that exhibits the problem.
Maybe then we can see what is going on and make a suggestion.
--
This space intentionally left blank
------------------------------
Date: 6 Sep 2001 12:16:03 -0400
From: stanb@panix.com (Stan Brown)
Subject: Genericly printing the arguments to s afunction?
Message-Id: <9n87g3$ao8$1@panix1.panix.com>
Having just discovered the recipie in the Perl Cookbook for using caller()
to print the name of a function, I was wondering if there is a generic way
to print the values of the argumnets to a given function?
In the name of generic debugiing code.
------------------------------
Date: Thu, 06 Sep 2001 16:30:00 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <mbudash-5A80D6.09300106092001@news.sonic.net>
In article <9n87g3$ao8$1@panix1.panix.com>, stanb@panix.com (Stan
Brown) wrote:
> Having just discovered the recipie in the Perl Cookbook for using caller()
> to print the name of a function, I was wondering if there is a generic way
> to print the values of the argumnets to a given function?
>
> In the name of generic debugiing code.
>
uh, print "@_" ?? or did i miss something??
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 6 Sep 2001 17:31:56 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <9n8bub$5viq8$1@fu-berlin.de>
Stan Brown <stanb@panix.com> wrote:
> Having just discovered the recipie in the Perl Cookbook for using caller()
> to print the name of a function, I was wondering if there is a generic way
> to print the values of the argumnets to a given function?
hm, that should be easy...
use Data::Dumper;
...
print Dumper \@_;
or
use Data::Denter;
...
print Denter \@_;
hth, tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 6 Sep 2001 13:51:50 -0400
From: stanb@panix.com (Stan Brown)
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <9n8d3m$r86$1@panix1.panix.com>
In <mbudash-5A80D6.09300106092001@news.sonic.net> Michael Budash <mbudash@sonic.net> writes:
>In article <9n87g3$ao8$1@panix1.panix.com>, stanb@panix.com (Stan
>Brown) wrote:
>> Having just discovered the recipie in the Perl Cookbook for using caller()
>> to print the name of a function, I was wondering if there is a generic way
>> to print the values of the argumnets to a given function?
>>
>> In the name of generic debugiing code.
>>
>uh, print "@_" ?? or did i miss something??
Well, I was looking for somthieng that would generate output liek:
Arg1 ->1<-, Arg2 ->xyz<- ....
Which is the format I am replacing.
Perhaps I could use pop?
------------------------------
Date: 6 Sep 2001 18:04:56 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Genericly printing the arguments to s afunction?
Message-Id: <9n8ds8$5viq8$2@fu-berlin.de>
Stan Brown <stanb@panix.com> wrote:
>>In article <9n87g3$ao8$1@panix1.panix.com>, stanb@panix.com (Stan
>>Brown) wrote:
>>> Having just discovered the recipie in the Perl Cookbook for using caller()
>>> to print the name of a function, I was wondering if there is a generic way
>>> to print the values of the argumnets to a given function?
> Well, I was looking for somthieng that would generate output liek:
> Arg1 ->1<-, Arg2 ->xyz<- ....
> Which is the format I am replacing.
> Perhaps I could use pop?
i'm not sure if i understand what you mean...
my$i=1;
print join ", ", map { "Arg".$i++." ->$_<-"} @_;
should do it...
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 6 Sep 2001 11:15:44 -0400
From: stanb@panix.com (Stan Brown)
Subject: How can I determine if a script has write permission in a given directo
Message-Id: <9n83v0$sgo$1@panix2.panix.com>
I need to be able to determine if a target directory exists, and is
writable by the user runing a script. If it does not exist, it would also
be nice to see if they have permission to create the given directory.
What's the best way to do this in perl?
------------------------------
Date: 6 Sep 2001 15:28:30 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How can I determine if a script has write permission in a given directo
Message-Id: <slrn9pf5h6.368.rgarciasuarez@rafael.kazibao.net>
Stan Brown wrote in comp.lang.perl.misc:
} I need to be able to determine if a target directory exists, and is
} writable by the user runing a script. If it does not exist, it would also
} be nice to see if they have permission to create the given directory.
}
} What's the best way to do this in perl?
The filetest operators : see perldoc -f -X (or lookup '-X' in the
perlfunc doc)
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 6 Sep 2001 17:28:26 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: How can I determine if a script has write permission in a given directo
Message-Id: <Xns9114B31BDCBEFLaocooneudoramail@62.153.159.134>
The Best way to do this are the File Test Operators..
see perlfunc for -X and perlopentut for opening non-files(directories)
stanb@panix.com (Stan Brown) wrote in news:9n83v0$sgo$1@panix2.panix.com:
> I need to be able to determine if a target directory exists, and is
> writable by the user runing a script. If it does not exist, it would also
> be nice to see if they have permission to create the given directory.
>
> What's the best way to do this in perl?
>
>
>
------------------------------
Date: 06 Sep 2001 15:33:39 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: How can I determine if a script has write permission in a given directo
Message-Id: <slrn9pfkvp.qse.trammell@haqq.hypersloth.net>
On 6 Sep 2001 11:15:44 -0400, Stan Brown <stanb@panix.com> wrote:
> I need to be able to determine if a target directory exists, and is
> writable by the user runing a script. If it does not exist, it would also
> be nice to see if they have permission to create the given directory.
>
> What's the best way to do this in perl?
From the perlfunc manual page:
-X FILEHANDLE
-X EXPR
-X A file test, where X is one of the letters listed below.
[snip]
-r File is readable by effective uid/gid.
-w File is writable by effective uid/gid.
-x File is executable by effective uid/gid.
-o File is owned by effective uid.
[snip]
-f File is a plain file.
-d File is a directory.
--
IAAMOAC.
------------------------------
Date: Thu, 6 Sep 2001 10:08:37 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How can I determine if a script has write permission in a given directo
Message-Id: <3b97ad95$1@news.microsoft.com>
"Stan Brown" <stanb@panix.com> wrote in message
news:9n83v0$sgo$1@panix2.panix.com...
See file test operators
> I need to be able to determine if a target directory exists, and is
-d
> writable by the user runing a script. If it does not exist, it would also
-w
> be nice to see if they have permission to create the given directory.
-w on the parent dir should do the job
jue
------------------------------
Date: Thu, 06 Sep 2001 17:54:22 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How can I determine if a script has write permission in a given directo
Message-Id: <slrn9pfb6s.4k1.tadmc@tadmc26.august.net>
Stan Brown <stanb@panix.com> wrote:
>I need to be able to determine if a target directory exists,
print "$dir exists\n" if -e $dir; # might not be a directory
print "$dir exists and is a directory\n" if -d $dir;
>and is
>writable by the user runing a script.
print "$dir is writable\n" if -w $dir;
>If it does not exist, it would also
>be nice to see if they have permission to create the given directory.
print "parent of $dir is writable\n" if -w "$dir/..";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Sep 2001 06:27:08 -0700
From: jonni@ifm.liu.se (Jonas Nilsson)
Subject: Re: How can I wait in perl?
Message-Id: <71734a2.0109060527.672184e4@posting.google.com>
> Jonas Nilsson wrote:
> >
> > I wan't to execute a subroutine every 5 seconds or so.
<SNIP>
>
> sleep?
>
> jasper
Stupid me. But I never learn these commands. I looked in th docs
actually. Both FAQ and builtin functions. Couldn't find it though. I
looked for wait, pause, halt, hold but not sleep! :)
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1704
***************************************