[18025] in Perl-Users-Digest
Perl-Users Digest, Issue: 185 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 31 18:08:30 2001
Date: Wed, 31 Jan 2001 15:05:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980982322-v10-i185@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 Jan 2001 Volume: 10 Number: 185
Today's topics:
Re: 'apply' function in perl? <perin@panix.com>
Re: 'apply' function in perl? <joe+usenet@sunstarsys.com>
.plx Script Won't Read Remote Directories rch1m3d3s@my-deja.com
Re: accessing name of variable <dan@tuatha.sidhe.org>
Re: Advanced regexp question nobull@mail.com
Re: Array Question nobull@mail.com
Re: Array Question <ccx138@coventry.ac.uk>
Re: Array Question <bcaligari@my-deja.com>
Re: Array Question <aqumsieh@hyperchip.com>
Re: Array Question (Craig Berry)
Re: buffering of STDIN <uri@sysarch.com>
Re: buffering of STDIN <dan@tuatha.sidhe.org>
comparing two files in different directories mjames100@my-deja.com
Re: comparing two files in different directories mjames100@my-deja.com
Re: comparing two files in different directories <aqumsieh@hyperchip.com>
Re: copy construct reference to anonymous scalar (Charles DeRykus)
create a new folder <wo_ah_ho@yahoo.com>
Re: create a new folder <wo_ah_ho@yahoo.com>
Re: Cron task <rbfitzpa@my-deja.com>
Re: Do threads really work? <dan@tuatha.sidhe.org>
Re: Executing external applications in Perl nobull@mail.com
Re: exists news reply grabber? [somewhat OT] <mischief@velma.motion.net>
Re: forcing compile errors on undeclared vars? <dan@tuatha.sidhe.org>
format nandagopalj@hotmail.com
Re: GIF Generator (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Jan 2001 14:09:58 -0500
From: Lewis Perin <perin@panix.com>
Subject: Re: 'apply' function in perl?
Message-Id: <pc7elxjtu61.fsf@panix2.panix.com>
Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> Lewis Perin <perin@panix.com> writes:
>
> [...benchmarking all-lexical version vs. M-JD's original...]
>
> Benchmarks are a red herring. That there is a performance discrepancy
> has to do with the fact that mjd's reduce didn't alias $b to $_;
> hence his "for(@_)" loop is slower than yours. Try comparing
> seduce with this version of reduce:
>
> sub reduce (&$@) {
> my $code = shift;
> my $r1 = sub {
> my $id = shift;
> my $r2 = sub {
> local ($a, *b) = ($id, *_); # @b, $b aliased to @_, $_
>
> for (@b) {
> $a = &$code;
> }
>
> $a;
> };
> return @_ ? $r2->(@_) : $r2;
> };
> return @_ ? $r1->(@_) : $r1;
> }
Thanks for the clever contribution. You've indeed sped up the
original; in several runs on my machine it was only 2-3% slower than
the all-lexical version.
> > >{ $a + $b } is easier to read and to type than { $_[0] + $_[1] }.
> >
> > Certainly it's easier to type, but I tend to find anything involving
> > locals harder to read (or at least understand!)
>
> Ignorance is not bliss in Perl; learn about how to use symbols and
> alias them. OOP Ch.2 has a nice section on typeglobs, and it's worth
> a look.
Actually ignorance isn't one of the strategies I use to attain bliss,
and I've aliased symbols in the past. But one of the ways I try to
avoid ignorance is by reading Larry Wall's speeches, and in the one
you can find at <http://dev.perl.org/~ask/als/larry-als.txt>, while
talking about plans for Perl 6, he says
Typeglobs we would very much like to go away.
That's no promise, of course, but I took it as a warning.
/Lew
--
Lew Perin / perin@mail.med.cornell.edu / perin@acm.org
www.panix.com/~perin/
------------------------------
Date: 31 Jan 2001 15:13:06 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: 'apply' function in perl?
Message-Id: <m3ofwn8oq5.fsf@mumonkan.sunstarsys.com>
Lewis Perin <perin@panix.com> writes:
> Thanks for the clever contribution. You've indeed sped up the
> original; in several runs on my machine it was only 2-3% slower than
> the all-lexical version.
I don't view it as clever; in fact I view aliasing as a nice
feature of package variables that lexicals don't have. Also,
in several runs aimed at adding all the numbers between 1 and 500,
the all-lexical version was around 10-20% slower. Different lists
and different versions of perl will produce different performance
numbers, but IMHO the difference isn't significant enough to be
relevant.
> > > >{ $a + $b } is easier to read and to type than { $_[0] + $_[1] }.
> > >
> > > Certainly it's easier to type, but I tend to find anything involving
> > > locals harder to read (or at least understand!)
Indeed globals are tricky, and usually lexicals are the way to go,
but for "sort" and sort-like sub's, package vars like $a and $b
make life easier, at least for today's Perl.
> >
> > Ignorance is not bliss in Perl; learn about how to use symbols and
> > alias them. OOP Ch.2 has a nice section on typeglobs, and it's worth
> > a look.
>
> Actually ignorance isn't one of the strategies I use to attain bliss,
> and I've aliased symbols in the past. But one of the ways I try to
> avoid ignorance is by reading Larry Wall's speeches, and in the one
> you can find at <http://dev.perl.org/~ask/als/larry-als.txt>, while
> talking about plans for Perl 6, he says
>
Sorry if you took my comment here the wrong way; it was only
directed at your insinuation that "understanding locals is hard",
together with yet another clp.misc benchmark. I was talking past
you, which I have been known to do on occasion.
<rant>
Benchmarks suck. Use a profiler like dprofpp if you want to
diagnose performance problems in your code. Don't use them
to buttress an argument unless you're prepared to explain
the mechanism behind the results.
</rant>
Thanks for the url, though.
> Typeglobs we would very much like to go away.
>
> That's no promise, of course, but I took it as a warning.
Indeed, but I don't think kowtowing is blissful either. IMHO
requiring a typeglob for creating a filehandle sucks, as does
requiring a typeglob for aliasing variables. But that's an
implementation issue that perhaps perl6 could fix. At least
in 5.6 you can open a file like this:
my $file; # must be undef'd for next line to work
open $file, "</path/to/file" or die $!;
Perhaps extending aliases to lexicals isn't too far away either.
Best.
--
Joe Schaefer
------------------------------
Date: Wed, 31 Jan 2001 22:34:22 GMT
From: rch1m3d3s@my-deja.com
Subject: .plx Script Won't Read Remote Directories
Message-Id: <95a3te$7cf$1@nnrp1.deja.com>
Dear Readers:
I'm trying to do something which should be simple, but just won't
happen. I just want to read the contents of a directory on another
machine into an array, like so:
@dirContents = `dir \\\\CAGLN1-s12\\Global\\NCCI\\Data`;
print join('', @dirContents);
This works fine from the command-line. However, when called from a
browser as a .plx script, I get the 'Access Denied' message. Now it
sounds like a permissions issue. The script is running under a user
with read privileges to that directory. Still no luck.
Is it possible that PerlIS.dll must run as a privileged user as well?
I'm clueless.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 22:08:02 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: accessing name of variable
Message-Id: <610e6.165946$P82.19896263@news1.rdc1.ct.home.com>
J=F6rg Ziefle <gt4556a@acmez.gatech.edu> wrote:
> On Tue, 30 Jan 2001 02:50:58 GMT, Rick Delaney <rick.delaney@home.com> w=
rote:
>>> Is it possible (with globs, ...) to directly access the name of a
>>> variable? For instance, when I have a scalar named $foo, the operatio=
n
>>> would give me the string 'foo', that is, the name of $foo stringified.
>>Have you tried=20
>>
>> print *foo;
> That's not quite functional: Imagine I have an array or a hash of refs o=
f other
> variables. Now I want to access the name of each variable which is held=
in the
> array/hash.
The short answer is "you can't do that". Perl doesn't provide a way to map
variables back to their names. The best you can do is get the names of
globals (sometimes), but you can't get the names of lexicals, or of
anonymous variables. With enough XS code you might be able to do that, but
it'd be an awful lot of work.
Dan
------------------------------
Date: 31 Jan 2001 19:00:23 +0000
From: nobull@mail.com
Subject: Re: Advanced regexp question
Message-Id: <u9r91jo8c8.fsf@wcl-l.bham.ac.uk>
wigren@mail.org writes:
> I'm porting a program that I've written in Python to Perl.
I know no Python so I'm just guessing what the Python-syntax regex does.
> In the old Python-version I stored the regexps to parse the list-output
> in a hash (imported from a separate file) using filetype as the key.
> The regexps looks something like:
>
> ^\s*(?:P<size>\d+)\s+(?:P<month>\d\d)-(?:P<day>\d\d)-(?:P<year>\d\d)
> (?:P<file>.*)$
> or
> ^\s*(?:P<year>\d{4})-(?:P<month>\w{3})-(?:P<day>\d\d)\s+(?:P<size>\d\d)
> (?:P<file>.*)$
>
> Then the match then returns a hash (called "dictionary" in Python) that I can
> use like:
> filelist.append((hash["file"],hash["size"],hash["year"],hash["month"],hash["d
> ay"]))
OK, in Perl you can't give names to capturing subexpressions so you
need to separate the regex and the ordering of the fields then use a
hash-slice assignment.
So... you need to convert the string...
^\s*(?:P<year>\d{4})-(?:P<month>\w{3})-(?:P<day>\d\d)\s+(?:P<size>\d\d)(?:P<file>.*)$
into a structure containing regex an a list of field names, say
something like...
[
qr/^\s*(\d{4})-(\w{3})-(\d\d)\s+(\d\d)(.*)$/,
['year','month','day','size','file' ]
]
So....
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
# In pratice you'd read it from a file.
my %formats = (
one => q/^\s*(?:P<size>\d+)\s+(?:P<month>\d\d)-(?:P<day>\d\d)-(?:P<year>\d\d)(?:P<file>.*)$/,
two => q/^\s*(?:P<year>\d{4})-(?:P<month>\w{3})-(?:P<day>\d\d)\s+(?:P<size>\d\d)(?:P<file>.*)$/,
);
# In 5.6 I think you valves() is an lvalue - but I'm testing on 5.5
for ( @formats{keys %formats} ) {
my @fields;
s/\(\?:P<(\w+)>/push @fields => $1; '('/eg;
$_ = [ qr/$_/, \@fields ];
}
sub parse_record {
my ($format,$data) = @_;
my %fields;
@fields{@{$formats{$format}[1]}} = $data =~ /$formats{$format}[0]/;
\%fields;
}
print Dumper(parse_record(one => '1000 10-11-88foobar'));
print Dumper(parse_record(two => '1988-Oct-11 10foobar'));
__END__
> filelist.append((hash["file"],hash["size"],hash["year"],hash["month"],hash["d
> ay"]))
push @filelist => [ @{parse_record $format => $line}{'file','size','year','month','day'} ];
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 31 Jan 2001 19:15:42 +0000
From: nobull@mail.com
To: amerar@ci.chi.il.us
Subject: Re: Array Question
Message-Id: <u9ofwno7mp.fsf@wcl-l.bham.ac.uk>
amerar@ci.chi.il.us writes:
> I am trying to see how I can create a multi-dimentional array in Perl.
> I cannot seem to find any examples......can anyone point me in the
> right direction?
Look for occurances of the word "multidimensional" in the manual.
Like, d'oh!
If you cannot search your whole manual then try this:
man perl (or perldoc perl)
Look at the list of manual pages and descriptions:
perl Perl overview (this section)
perldelta Perl changes since previous version
perl5004delta Perl changes in version 5.004
perlfaq Perl frequently asked questions
perltoc Perl documentation table of contents
perldata Perl data structures
perlsyn Perl syntax
perlop Perl operators and precedence
perlre Perl regular expressions
perlrun Perl execution and options
perlfunc Perl builtin functions
perlopentut Perl open() tutorial
perlvar Perl predefined variables
perlsub Perl subroutines
perlmod Perl modules: how they work
perlmodlib Perl modules: how to write and use
perlmodinstall Perl modules: how to install from CPAN
perlform Perl formats
perllocale Perl locale support
perlref Perl references
perlreftut Perl references short introduction
perldsc Perl data structures intro
perllol Perl data structures: lists of lists
perltoot Perl OO tutorial
perlobj Perl objects
perltie Perl objects hidden behind simple
variables
perlbot Perl OO tricks and examples
perlipc Perl interprocess communication
perlthrtut Perl threads tutorial
perldebug Perl debugging
perldiag Perl diagnostic messages
perlsec Perl security
perltrap Perl traps for the unwary
perlport Perl portability guide
perlstyle Perl style guide
perlpod Perl plain old documentation
perlbook Perl book information
perlembed Perl ways to embed perl in your C or
C++ application
perlapio Perl internal IO abstraction interface
perlxs Perl XS application programming
interface
perlxstut Perl XS tutorial
perlguts Perl internal functions for those doing
extensions
perlcall Perl calling conventions from C
perlhist Perl history records
Elimintate any that look like they won't answer your question and rank
the other according to relevance:
perlfaq Perl frequently asked questions
perldata Perl data structures
perldsc Perl data structures intro
perllol Perl data structures: lists of lists
perlsyn Perl syntax
perlobj Perl objects
perltoot Perl OO tutorial
(Note: I've not included perlref and perlreftut because although they
may be relevant I would not expect someone unfamiliar with Perl to
realise this).
Look by hand for the word "multidimensional" in each of thre above
manuals until you find the answer.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 Jan 2001 19:30:56 +0000
From: John Tutchings <ccx138@coventry.ac.uk>
Subject: Re: Array Question
Message-Id: <3A7867F0.26D2324D@coventry.ac.uk>
Is that nobull or nofish ;)
>-",",","D>
nobull@mail.com wrote:
> amerar@ci.chi.il.us writes:
>
> > I am trying to see how I can create a multi-dimentional array in Perl.
> > I cannot seem to find any examples......can anyone point me in the
> > right direction?
>
> Look for occurances of the word "multidimensional" in the manual.
>
> Like, d'oh!
>
> If you cannot search your whole manual then try this:
>
> man perl (or perldoc perl)
>
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Wed, 31 Jan 2001 19:53:07 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
To: amerar@ci.chi.il.us
Subject: Re: Array Question
Message-Id: <959qet$u5j$1@nnrp1.deja.com>
In article <959mfc$qaa$1@nnrp1.deja.com>,
amerar@ci.chi.il.us wrote:
>
>
> Hello,
>
> I am trying to see how I can create a multi-dimentional array in Perl.
> I cannot seem to find any examples......can anyone point me in the
> right direction?
http://www.perldoc.com/perl5.6/pod/perllol.html
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 20:53:57 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Array Question
Message-Id: <7ay9vrl9y1.fsf@merlin.hyperchip.com>
amerar@ci.chi.il.us writes:
> I am trying to see how I can create a multi-dimentional array in Perl.
> I cannot seem to find any examples......can anyone point me in the
> right direction?
Have a look at the following docs:
perldsc
perllol
perlref
On windows, those should be accessible via the HTML documentation that
comes with Perl. On *nix, you can use the 'perldoc' utility to view
them. They are also accessible via the web on www.perl.com.
> PS. Please CC a copy to my e-mail.
sure.
--Ala
------------------------------
Date: Wed, 31 Jan 2001 20:59:03 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Array Question
Message-Id: <t7gv4nhr3mn17c@corp.supernews.com>
amerar@ci.chi.il.us wrote:
: I am trying to see how I can create a multi-dimentional array in Perl.
: I cannot seem to find any examples......can anyone point me in the
: right direction?
All array elements in Perl are scalars, so you can't have an array of
arrays directly. But a reference is a scalar, so you can have an array of
references to arrays, which may themselves contain references to arrays,
and so fort. See 'perldoc perllol' for the details.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "The hills are burning, and the wind is raging; and the clock
| strikes midnight in the Garden of Allah." - Don Henley
------------------------------
Date: Wed, 31 Jan 2001 20:44:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: buffering of STDIN
Message-Id: <x7hf2fsb7y.fsf@home.sysarch.com>
>>>>> "t" == tigra <tigra@sky.deep.ru> writes:
t> In article <slrn97fj5s.6g3.rgarciasuarez@rafael.kazibao.net>,
t> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
>> Roman Chumakov wrote in comp.lang.perl.misc:
>> > Situation:
>> > while(<STDIN>){
>> > #process line
>> > }
>> >
>> > If an input line will be very-very large ...
>> > all memory may be used up...
>> >
>> > How can I limit input string in <STDIN>?
>>
>> Are you reading a binary file ? Then use the read() function to read
>> fixed-length blocks of data.
t> Or set $/ = 32768 to read in 32K chunks (or as much as you want). But
t> IMHO read() is just cooler :).
if you are reading in large binary chunks, bypass the buffering of read
and use sysread. i would stay away from the $/ trick (which was
corrected in another post) as it also does buffering.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 31 Jan 2001 22:14:07 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: buffering of STDIN
Message-Id: <P60e6.165958$P82.19897437@news1.rdc1.ct.home.com>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "t" == tigra <tigra@sky.deep.ru> writes:
> t> In article <slrn97fj5s.6g3.rgarciasuarez@rafael.kazibao.net>,
> t> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> >> Roman Chumakov wrote in comp.lang.perl.misc:
> >> > Situation:
> >> > while(<STDIN>){
> >> > #process line
> >> > }
> >> >
> >> > If an input line will be very-very large ...
> >> > all memory may be used up...
> >> >
> >> > How can I limit input string in <STDIN>?
> >>
> >> Are you reading a binary file ? Then use the read() function to read
> >> fixed-length blocks of data.
> t> Or set $/ = 32768 to read in 32K chunks (or as much as you want). But
> t> IMHO read() is just cooler :).
> if you are reading in large binary chunks, bypass the buffering of read
> and use sysread. i would stay away from the $/ trick (which was
> corrected in another post) as it also does buffering.
I'd agree here. The point of the $/ trick is to read in records, not
to do any sort of buffer overflow checking or things of that nature.
Dan
------------------------------
Date: Wed, 31 Jan 2001 19:19:08 GMT
From: mjames100@my-deja.com
Subject: comparing two files in different directories
Message-Id: <959of1$s8k$1@nnrp1.deja.com>
How can I compare two files using File::Compare module without having
them in the same directory?
I am using a UNIX OS. Here is my code. The compare function always
returns false (0) regardless of whether the files are identical or not.
#!/usr/local/bin/perl
use File::Compare;
$prod_file_name = "/home/virtual_html/mj/e_complete_status.html";
$proof_file_name = "/home/virtual_html-proof/mj/e_complete_status.html";
if (compare("$prod_file_name", "$prod_file_name"))
{
print "compare function returned true\n";
}
else
{
print "compare function returned false\n";
}
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 19:41:05 GMT
From: mjames100@my-deja.com
Subject: Re: comparing two files in different directories
Message-Id: <959pof$tfd$1@nnrp1.deja.com>
FOUND MY PROBLEM:
> if (compare("$prod_file_name", "$prod_file_name"))
supposed to be:
> if (compare("$prod_file_name", "$proof_file_name"))
SORRY!
In article <959of1$s8k$1@nnrp1.deja.com>,
mjames100@my-deja.com wrote:
> How can I compare two files using File::Compare module without having
> them in the same directory?
>
> I am using a UNIX OS. Here is my code. The compare function always
> returns false (0) regardless of whether the files are identical or
not.
>
> #!/usr/local/bin/perl
> use File::Compare;
> $prod_file_name = "/home/virtual_html/mj/e_complete_status.html";
> $proof_file_name = "/home/virtual_html-
proof/mj/e_complete_status.html";
> if (compare("$prod_file_name", "$prod_file_name"))
> {
> print "compare function returned true\n";
> }
> else
> {
> print "compare function returned false\n";
> }
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 20:48:39 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: comparing two files in different directories
Message-Id: <7a3ddzmorb.fsf@merlin.hyperchip.com>
mjames100@my-deja.com writes:
> How can I compare two files using File::Compare module without having
> them in the same directory?
>
> I am using a UNIX OS. Here is my code. The compare function always
> returns false (0) regardless of whether the files are identical or not.
Of course, since you pass the same file to the compare() subroutine
twice!
> #!/usr/local/bin/perl
> use File::Compare;
> $prod_file_name = "/home/virtual_html/mj/e_complete_status.html";
> $proof_file_name = "/home/virtual_html-proof/mj/e_complete_status.html";
> if (compare("$prod_file_name", "$prod_file_name"))
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
--Ala
------------------------------
Date: Wed, 31 Jan 2001 22:29:27 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: copy construct reference to anonymous scalar
Message-Id: <G81t53.77r@news.boeing.com>
In article <9580d0$ak9@netnews.hinet.net>,
John Lin <johnlin@chttl.com.tw> wrote:
>"Martien Verbruggen"
>> John Lin wrote:
>> >
>> > my $scalar_hard_ref = \$scalar;
>> > my $scalar_copy_ref = ???????? # this is my question
>>
>> Out of curiosity, what are you going to use this for?
>
>: p No... I am just learning Perl. I like to learn in a comparative way.
>
>For example, when I learned "->", I would think of "how it applies on
>array, hash, sub, scalar, filehandle, array slice... etc.":
>
>$ref->[$i]; # for array
>$ref->{key}; # for hash
>$ref->(@param); # for sub
>
>but we don't have
>
>$ref->??? # for scalar
>$ref->??? # for filehandle
>
>Having $ref->[$i] and $ref->{key} why Perl doesn't have
>
>$ref->[1,2,3]; # looks better than @{$ref}[1,2,3];
>$ref->{'name','address','email'}; # @{$ref}{'name','address','email'};
>
>The OP "copy construction" question is raised in the same situation.
>
I've tried to cancel my response about $SUBSCRIPT_SEPARATOR but
for the record, it's bogus.
Sigh,
--
Charles DeRykus
------------------------------
Date: Wed, 31 Jan 2001 15:48:07 -0500
From: "Jason Wong" <wo_ah_ho@yahoo.com>
Subject: create a new folder
Message-Id: <959tkr$lgt$1@bcrkh13.ca.nortel.com>
is there a way to create a new folder in a directory in perl
so that a physical folder can be created through the website.
I looked into File::Spec but can't find anything useful
any idea?
Jason
------------------------------
Date: Wed, 31 Jan 2001 16:02:57 -0500
From: "Jason Wong" <wo_ah_ho@yahoo.com>
Subject: Re: create a new folder
Message-Id: <959ugk$m3l$1@bcrkh13.ca.nortel.com>
nevermind... i found mkdir
Jason Wong <wo_ah_ho@yahoo.com> wrote in message
news:959tkr$lgt$1@bcrkh13.ca.nortel.com...
> is there a way to create a new folder in a directory in perl
> so that a physical folder can be created through the website.
>
> I looked into File::Spec but can't find anything useful
>
> any idea?
>
> Jason
>
>
>
------------------------------
Date: Wed, 31 Jan 2001 21:38:19 GMT
From: igotlooks.com <rbfitzpa@my-deja.com>
Subject: Re: Cron task
Message-Id: <95a0ka$4ea$1@nnrp1.deja.com>
Sounds like your using Perl/CGI on a unix platform by the way you named
your script but it sounds like you want to just run an ordinary shell
script every day at 7am by your description.
I would rename the script (although it's not necessary) to
'some_name_script' and put the following in the first line:
#!/path/to/perl
and then run it from crontab as
0 7 * * * /path/to/script
The first loads the perl compiler before running the rest of the
script, this will allow you to run your script on the command line
without typing /path/to/perl script. Hope this works.
http://buildacom.com
---------------
In article <NCFVOK1M36921.7430324074@frog.nyarlatheotep.org>,
jean@ematic.com wrote:
> Hi,
>
> Using Telnet to connect on my remote server, I run a script by:
>
> perl script.cgi [options]
>
> Now, I want run "script.cgi" in a cron task, must I setup crontab
with:
> (for every days at 7 AM)
>
> 0 7 * * * /path/to/perl script.cgi [options]
>
> Or must I write
> 0 7 * * * /path/to/script.cgi [options]
>
> Or rename script.cgi to script, and setup the task as
>
> 0 7 * * * /path/to/script [options]
>
> Thanks !
> Jean
>
> --Part_Boundary-718F15--
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 22:12:19 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Do threads really work?
Message-Id: <750e6.165954$P82.19897384@news1.rdc1.ct.home.com>
In article <3A77859C.3ADE611D@iscusa.com>, Raphael wrote:
>If you can point me to an answer to this question that is great, but I have
>reviewed the Perl FAQ, search the Perl and CPAN web sites and have not been
>able to find the current status of Perl threads. I need to learn the exact
>status in order to decide what approach to take for a major development effort..
Andy posted the snip from README.threads, but the short answer is that
threads under perl 5 are broken, and aren't ever going to work fully. As
long as you avoid their issues they work fine, but there's a not
insignificant risk associated with their use if you're not careful.
Dan
------------------------------
Date: 31 Jan 2001 19:26:22 +0000
From: nobull@mail.com
Subject: Re: Executing external applications in Perl
Message-Id: <u9k87bo74x.fsf@wcl-l.bham.ac.uk>
"Magma" <peter@viasafe.com> writes:
> What I need to do is run an application ( a ".exe") with a list of
> parameters and read back what this application writes to the console
> (to parse the various return values).
>
> I am currently using system() to execute a command as if using the
> command prompt to invoke the application.
If you read the documentation on system() you'll observe that it says
"This is NOT what you want to use to capture the output from a
command, for that you should use.."
> Problem 1: The application I am invoking needs to access certain
> files relative to the directory in which the exe is located . Due to
> where I run my perl script from, the app cannot find these files. I
> have tried setting the path with another system() command ("set path
> blah blah..."), with no success. How can I get this app to run as if
> I were runing it from it's home directory?
Why "as if" why not actually chdir()?
> Problem two: How can I open a pipe in which to read what is written
> to the console when the system() call executes into an array of
> lines to be parsed for specific information I need (:succes or
> failure... etc)?
As I pointed out above one answer to this in the documentation of the
system() function. Oddly it is not, IMHO, the best answer.
For a more detailed discussion of inter-process communication in Perl
take a look at the list of Perl manuals (perldoc perl) and then take a
wild guess which one deals with inter-process communication.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 Jan 2001 19:07:26 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: exists news reply grabber? [somewhat OT]
Message-Id: <t7goje5vt9fpef@corp.supernews.com>
Abigail <abigail@foad.org> wrote:
> J?rg Ziefle (gt4556a@acmey.gatech.edu) wrote on MMDCCX September MCMXCIII
> in <URL:news:slrn97ghiu.ri7.gt4556a@acmey.gatech.edu>:
> }} On 31 Jan 2001 08:58:54 GMT, Abigail <abigail@foad.org> wrote:
> }}
> }} >I guess you could ask Kibo....
> }}
> }} Ok, if now somebody could tell me what or who kibo is or where to find it/him,
> }} then this would all make more sense to me :)
> }}
> }} You're not talking about www.kibo.com, aren't you?
> That's his web site.
> HappyNet rulez.
Doesn't alt.religion.kibology still exist? ;)
As a matter of fact, I just checked Deja, and there are posts from today.
Perhaps Kibo could answer all of our questions about himself in that newsgroup.
Hi, Kibo!
Chris
--
Christopher E. Stith
Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental. -- nobull, clp.misc
------------------------------
Date: Wed, 31 Jan 2001 22:05:26 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: forcing compile errors on undeclared vars?
Message-Id: <G_%d6.165942$P82.19896267@news1.rdc1.ct.home.com>
iwelch@my-deja.com wrote:
> I presume the silence means that the answer here is "no". It is
> impossible to require definition at compilation time when a variable
> name contains a module identifier...
The answer is, in fact, no. Fully qualifying a variable name is enough
to make strict happy.
> In article <94pl2e$lb6$1@nnrp1.deja.com>,
> iwelch@my-deja.com wrote:
>> is it possible to force perl at compile time to check whether package
>> variables have really been declared
>> (using "our")?
>>
>> #!/usr/bin/perl -w
>> use strict;
>> use p1;
>> use strict;
>> print "hello";
>> print "variable 1 is ".$p::var1."\n";
>> print "variable 2 is ".$p::var2."\n"; # NOT DEFINED #print
>> "compile-error".$compileerror."\n";
>>
>> and p1.pm is
>>
>> package p;
>> use strict;
>> our $var1="defined";
>> 1;
>>
>> I would like the perl compiler to die with an error telling me that
> it
>> never saw an "our $var2" declaration in
>> module p.
>>
>> Sent via Deja.com
>> http://www.deja.com/
>>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 21:18:41 GMT
From: nandagopalj@hotmail.com
Subject: format
Message-Id: <959vf6$3b6$1@nnrp1.deja.com>
Hello:
I am using a format statement to print out a report.
format DOUT =
@<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<< @<<<<
$ONE,$TWO,$THREE,$FOUR
.
when the variable $FOUR has the value less than four characters
e.g. "12" then the new line character is printed immediately
after 12. What I want is that 12 must be padded with blank spaces
and then a new line must be printed.
Is there any format related intricacy that can help do this?
Any help is appreciated.
thanks
Nan.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 31 Jan 2001 21:46:56 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GIF Generator
Message-Id: <slrn97h1sk.n8t.mgjv@verbruggen.comdyn.com.au>
[Please, put your reply _after_ the suitably trimmed text you reply
to. It's the commonly accepted quoting method on this group, and
Usenet in general, because it makes threads easier to follow, and
posts easier to read.]
On Wed, 31 Jan 2001 10:16:35 +0100,
wiwo <w-woerlinger@ti.com> wrote:
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn97esfa.n8t.mgjv@verbruggen.comdyn.com.au...
>> On Tue, 30 Jan 2001 15:59:25 GMT,
>> igotlooks.com <rbfitzpa@my-deja.com> wrote:
>> > Does anyone have any simple 'on-the-fly' graphics generator? I'm looking
>> > for something where I could graph an array and create a gif. Any extra
>> > features would be nice but anything will do for now.
>>
>> Two people have pointed you to the GD module. GD, in its later
>> versions does NOT produce GIF, but PNG, JPEG, and some others. If you
>> can find an older version of GD (1.19 or before) you can produce GIF,
>> but you still owe Unisys a license fee for the use of the LZW
>> algorithm.
>>
>> Alternatively, you can use Image::Magick to produce uncompressed GIF,
>> or (after you've paid Unisys) compressed GIF when compiled with the
>> lzw option.
>>
>> Do you really, really need GIF? PNG is far superior, and doesn't
>> require any licensing fees.
>
> I have exactly the same problem.
Are you sure? Your problem sounds distinctly different to me. If you
are saying that you need gif, you are mistaken. You need ppm. Stay
away from GIF :).
> I would love to use 'png' formatted graphs, but up to now I haven't found a
> way to display them with Tk::Photo in a subwindow.
There is a special group for Perl::Tk related questions. You might
have better luck posting there.
Tk::Photo can be given a different image handler, which you write and
register. Maybe someone has already written one for PNG. The standard
Tk distribution only has pnm and gif support.
You could use Image::Magick to transform it.
my $im = Image::Magick->new();
my $rc = $im->Read("image.png");
$widget->Photo(-data => $im->ImageToBlob("ppm"));
or something like that.
> Any ideas or examples would be very helpful !!
I haven't written any image handlers for Tk myself, as I don't use it.
But I'm sure that there is some documentation on it. I would also ask
this question on clp.tk to see if someone else has already done this.
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 185
**************************************