[23069] in Perl-Users-Digest
Perl-Users Digest, Issue: 5290 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 29 21:05:37 2003
Date: Tue, 29 Jul 2003 18:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 29 Jul 2003 Volume: 10 Number: 5290
Today's topics:
Re: embedding a module in a script <noreply@gunnar.cc>
Re: embedding a module in a script <skuo@mtwhitney.nsc.com>
Re: embedding a module in a script <grazz@pobox.com>
Re: Help with parsing text file <kstairley@coppernospam.com>
Re: How do you Call a Perl subroutine with a variable n <skuo@mtwhitney.nsc.com>
Re: How do you Call a Perl subroutine with a variable n <noreply@gunnar.cc>
Re: How do you Call a Perl subroutine with a variable n <uri@stemsystems.com>
Re: How do you Call a Perl subroutine with a variable n <grazz@pobox.com>
Re: HTML / text parsing - best module(s) to use? <asu1@c-o-r-n-e-l-l.edu>
Re: New to Perl <grazz@pobox.com>
Re: New to Perl (Tad McClellan)
Perl - how to compute totals via hash request (shree)
Re: Perl - how to compute totals via hash request ctcgag@hotmail.com
Re: Perl - how to compute totals via hash request (Tad McClellan)
Re: perl problem on windows <mgarrish@rogers.com>
Re: Perl training resources? <mgarrish@rogers.com>
Re: porting perl scripts from NT to UNIX <kalinabears@iinet.net.au>
Re: remote readdir() <pkent77tea@yahoo.com.tea>
Re: zero but true? <NOSPAM@bigpond.com>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 Jul 2003 01:11:46 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: embedding a module in a script
Message-Id: <bg6v41$lhk98$1@ID-184292.news.uni-berlin.de>
Timothy Dietrich wrote:
> I have a need to embed a module in a perl script. Basically, I want
> to cut and paste the contents of the module directly into my
> script, but otherwise have the script and module interact in the
> same way as if the module and script were in different files.
<snip>
> # Main body of script
> package main;
> use strict;
> BEGIN
> {
> import ModuleA;
> import ModuleB;
I think you need to say:
import ModuleA '&a';
import ModuleB '&b';
i.e. even if the symbols '&a' and '&b' are included in the @EXPORT
arrays, they must be explicitly imported since you don't 'use' the
modules.
Normally in Perl 5 you skip the ampersands, and if the real names are
anything else but 'a' and 'b' you should likely do so.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 29 Jul 2003 16:36:58 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: embedding a module in a script
Message-Id: <Pine.GSO.4.21.0307291633170.7205-100000@mtwhitney.nsc.com>
On Tue, 29 Jul 2003, Timothy Dietrich wrote:
> I have a need to embed a module in a perl script. Basically, I want to
> cut and paste the contents of the module directly into my script, but
> otherwise have the script and module interact in the same way as if the
> module and script were in different files.
<snipped>
> #!/usr/bin/perl
>
> # First module
> package ModuleA;
> use strict;
> require Exporter;
> use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
> @ISA = qw(Exporter);
> @EXPORT = qw(&a);
>
> sub a
> {
> print "This is function a.\n";
> }
>
> 1;
>
> #-------------------------------
>
> # Second module
> package ModuleB;
> use strict;
> require Exporter;
> use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
> @ISA = qw(Exporter);
> @EXPORT = qw(&b);
>
> sub b
> {
> print "This is function b.\n";
> }
>
> 1;
>
> #-------------------------------
>
> # Main body of script
> package main;
> use strict;
> BEGIN
> {
> import ModuleA;
> import ModuleB;
> }
>
> &a();
>
> &b();
>
Try:
package main;
use strict;
*a = \&ModuleA::a;
*b = \&ModuleB::b;
a();
b();
--
Hope this helps,
Steven
------------------------------
Date: Wed, 30 Jul 2003 00:58:19 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: embedding a module in a script
Message-Id: <LKEVa.555$7h6.499@nwrdny03.gnilink.net>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Timothy Dietrich wrote:
> > # Main body of script
> > package main;
> > use strict;
> > BEGIN
> > {
> > import ModuleA;
> > import ModuleB;
>
> I think you need to say:
>
> import ModuleA '&a';
> import ModuleB '&b';
>
> i.e. even if the symbols '&a' and '&b' are included in the @EXPORT
> arrays, they must be explicitly imported since you don't 'use' the
> modules.
The problem was that the modules did
require Exporter;
@ISA = qw(Exporter);
All of which happens at runtime. The "main" section did
BEGIN { Module->import }
Which happens at compile-time, and expects all the Exporter
machinery to be in place.
This works:
#!/usr/bin/perl
use strict; # whole file
use Exporter; # only once
{
package A;
our @ISA = qw(Exporter);
our @EXPORT = qw(a);
sub a { print "a" }
}
{
package B;
our @ISA = qw(Exporter);
our @EXPORT = qw(b);
sub b { print "b" }
}
A->import;
B->import;
a();
b();
And it would also work with the "package" blocks as BEGIN
blocks.
But isn't this simpler?
#!/usr/bin/perl
use strict;
sub a { print "a" }
sub b { print "b" }
a();
b();
Unless there's some compelling reason for the OP to keep
the package structure in the new single file, I'd suggest
just moving everything into main::.
[ Name conflicts would be a compelling reason to keep the
packages, and there are a few others. ]
--
Steve
------------------------------
Date: Tue, 29 Jul 2003 20:23:14 -0400
From: "Kent" <kstairley@coppernospam.com>
Subject: Re: Help with parsing text file
Message-Id: <3f270ff9_1@athena.netset.com>
If I recall correctly, stderr, I think, comes back and says File not
found.
I've got the regex matching, printing out the line, using $fh->getline(),
still trying to get the next few lines after the match upto or until
a different regex.
Thanks,
Kent
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbidn8p.4fa.tadmc@magna.augustmail.com...
> Kent <kstairley@coppernospam.com> wrote:
>
> > can I pass $ARGV[1] instead of myfile.txt as
> > the file to open?
>
>
> What happened when you tried it?
>
>
>
>
>
> [ snip TOFU. Please do not do that anymore. ]
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Tue, 29 Jul 2003 13:51:22 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: How do you Call a Perl subroutine with a variable name?
Message-Id: <Pine.GSO.4.21.0307291348230.7205-100000@mtwhitney.nsc.com>
On Tue, 29 Jul 2003, Gunnar Hjalmarsson wrote:
> Brian McCauley wrote:
(snipped)
> > You _are_ using a symbolic reference but you are doing so in a way
> > that is explicitly exempted from "strict refs".
> Hmm.. Obviously I am. Thanks for pointing it out. Seems as if I need
> to read more about it.
>
> However, in the meantime, can somebody explain why (or rather _how_)
> the following code works:
>
> sub x { print "'sub x' was called via \$coderef->().\n" }
> my $function = 'x';
> my $coderef = \&$function;
> $function = "The value of \$function is no longer 'x'.\n";
> print $function;
> $coderef->();
>
> As far as I can see, $coderef behaves like a real reference.
$coderef is a symbolic reference. It's analogous to $symref below:
no strict;
use warnings;
use vars qw($bar $baz);
our $bar = 'BAR'; # package scoped
our $baz = 'BAZ'; # package scoped
my $foo = 'bar';
my $symref = \$$foo; # symbolic reference
$foo = 'baz'; # redefine lexical
print $$symref; # dereference symbolic reference
__END__
Output:
BAR
--
Hope this helps,
Steven
------------------------------
Date: Wed, 30 Jul 2003 01:26:13 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How do you Call a Perl subroutine with a variable name?
Message-Id: <bg6vv4$lo5n4$1@ID-184292.news.uni-berlin.de>
Gunnar Hjalmarsson wrote:
> sub x { ... }
> my $function = 'x';
> my $coderef = \&$function;
>
> As far as I can see, $coderef behaves like a real reference.
Steve Grazzini replied:
> That's because it *is* a real ("hard") reference.
<snip>
> HTH!
Steven Kuo replied:
> $coderef is a symbolic reference.
<snip>
> Hope this helps,
Sorry to disappoint you, guys, but I'm not fully helped yet. ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 30 Jul 2003 00:01:04 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: How do you Call a Perl subroutine with a variable name?
Message-Id: <x7llugq3wf.fsf@mail.sysarch.com>
>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
GH> Gunnar Hjalmarsson wrote:
>> sub x { ... }
>> my $function = 'x';
>> my $coderef = \&$function;
>> As far as I can see, $coderef behaves like a real reference.
GH> Steve Grazzini replied:
>> That's because it *is* a real ("hard") reference.
GH> <snip>
>> HTH!
GH> Steven Kuo replied:
>> $coderef is a symbolic reference.
GH> Sorry to disappoint you, guys, but I'm not fully helped yet. ;-)
he meant your use was a symref and not a true coderef. a coderef is
either an anon sub:
my $code_ref = sub { print "foo\n" } ;
or a direct hard reference to a named sub:
sub foo { print "foo\n" } ;
my $code_ref = \&foo ;
notice there is no use of a variable containing a name. that would be a
symref. symrefs are looked up at runtime. coderefs are created at
compile time (in general).
note that runtime and compile time are not absolute due to BEGIN and
eval and friends.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 30 Jul 2003 00:17:30 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: How do you Call a Perl subroutine with a variable name?
Message-Id: <u8EVa.499$7h6.433@nwrdny03.gnilink.net>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Gunnar Hjalmarsson wrote:
> > sub x { ... }
> > my $function = 'x';
> > my $coderef = \&$function;
> >
> > As far as I can see, $coderef behaves like a real reference.
>
> Sorry to disappoint you, guys, but I'm not fully helped yet. ;-)
You can identify real (hard) references with ref().
#!/usr/bin/perl -l
sub x { }
my $soft = 'x';
my $hard = \&x;
print ref($soft); # ""
print ref($hard); # "CODE"
And armed with this knowledge it's not hard to figure out
that $code is a hard reference:
my $code = \&$soft;
print ref($code); # "CODE"
I think you already knew this, and were asking "why?"...
And of course my other explanation was too light-hearted,
so let's start over.
You started with a soft reference, which is just the
*name* of something:
1) $soft => name of subroutine ("x")
And then you dereferenced it as a subroutine, yielding
the sub itself. That's maybe a tricky concept, since
you can't touch the subroutine *itself* in Perl.
2) &$soft => the subroutine itself
But that's what you have. And at this point you can do
anything with "&$soft" that you would have done with "&x",
including taking a hard reference:
3) \&$soft => hard reference to subroutine
Is that clear?
There was a parallel example like this
our $foo = 42;
my $soft = 'foo'; # name of variable
my $copy = $$soft; # variable itself
my $hard = \$$soft; # hard reference to $foo
It works the same way.
You start with the name of something, then dereference it
to get the thing itself. And then you can create a real
reference.
The whole business is silly -- why do you want the symref
in the first place? -- but that's how it works.
--
Steve
------------------------------
Date: 29 Jul 2003 23:41:28 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: HTML / text parsing - best module(s) to use?
Message-Id: <Xns93C7C84FC5C95asu1cornelledu@132.236.56.8>
use63net@yahoo.com (Unknown Poster) wrote in
news:c62e93ec.0307291316.4ac76339@posting.google.com:
> Assuming I have used LWP to get an HTML document into a response
> object, I'd like to know what module(s) to use for the following task.
> I would like to disregard the content of HTML tags (that is, everything
> in angled brackets) and then break the "real" text into words so that
> I can do a frequency count, etc.
HTML::Parser will get you the plain text with little effort. See:
http://search.cpan.org/src/GAAS/HTML-Parser-3.28/eg/htext
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Tue, 29 Jul 2003 22:54:51 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: New to Perl
Message-Id: <%WCVa.261$Jz2.102@nwrdny02.gnilink.net>
This is great (and funny) advice -->
Tad McClellan <tadmc@augustmail.com> wrote:
> If you merely test your code before offering it to thousands of
> people around the world, then such a problem can be avoided without
> the added effort of thinking.
Of course you need somebody to say "Right.. I wasn't thinking"
as a set-up. (There never seems to be a shortage.) Anyway, I
think some similar advice for Answerers would be helpful in the
Posting Guidelines.
--
Steve
------------------------------
Date: Tue, 29 Jul 2003 19:21:09 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: New to Perl
Message-Id: <slrnbie3rl.5vh.tadmc@magna.augustmail.com>
Steve Grazzini <grazz@pobox.com> wrote:
> Tad McClellan <tadmc@augustmail.com> wrote:
>> If you merely test your code before offering it to thousands of
>> people around the world, then such a problem can be avoided without
>> the added effort of thinking.
> I
> think some similar advice for Answerers would be helpful in the
> Posting Guidelines.
That occurred to me too when I typed the above for the 2nd time in 2 days.
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 29 Jul 2003 16:59:44 -0700
From: srigowrisn@hotmail.com (shree)
Subject: Perl - how to compute totals via hash request
Message-Id: <49b5740e.0307291559.1c1f7be4@posting.google.com>
Dear Perl Gurus,
I have a tab delimited log file that contains data of system
downtimes. It has 4 fields namely ID, type of downtime (whether
planned or unplanned), date and duration of downtime (in secs). I'm
asked to compute totals for each month of each type. See input data
file provided and mocked output file.
Data File (does not contain header line)
ID Type Date DowntimeSecs
1 Planned 01/19/2003 5000
2 Unplanned 01/27/2003 900
3 Unplanned 01/29/2003 300
4 Unplanned 02/12/2003 3690
5 Planned 02/27/2003 1800
..
..
80 Planned 07/12/2003 6000
81 Unplanned 07/15/2003 8400
Hence, the needed output file should be like
MonthYear Planned Unplanned TotalDownTime
Jan2003 5000 1200 6200
Feb2003 1800 3690 5490
..
..
I started with the following code
my %count;
while(<DATA>) {
chomp;
my ($id, $type, $date, $downtime_secs) = split (/\t/, $_);
$count{$type} += $downtime_secs;
}
while (my ($key, $val) = each %count) {
print "$key, $val \n";
}
which outputs
Unplanned, 82000
Planned, 90000
How can I modify the above, to give my customer what they wanted. Also
if anyone can educate me to how to extract more detailed info as shown
below, I would greatly appreciate it. Thank you
MonthYear Planned Unplanned Total NoPlanned NoUnplanned NoOfTotal
Jan2003 5000 1200 6200 1 2 3
Feb2003 1800 3690 5490 1 1 2
..
..
------------------------------
Date: 30 Jul 2003 00:28:14 GMT
From: ctcgag@hotmail.com
Subject: Re: Perl - how to compute totals via hash request
Message-Id: <20030729202814.202$At@newsreader.com>
srigowrisn@hotmail.com (shree) wrote:
> Dear Perl Gurus,
>
> I have a tab delimited log file that contains data of system
> downtimes. It has 4 fields namely ID, type of downtime (whether
> planned or unplanned), date and duration of downtime (in secs). I'm
> asked to compute totals for each month of each type. See input data
> file provided and mocked output file.
>
> Data File (does not contain header line)
> ID Type Date DowntimeSecs
> 1 Planned 01/19/2003 5000
> 2 Unplanned 01/27/2003 900
> 3 Unplanned 01/29/2003 300
> 4 Unplanned 02/12/2003 3690
> 5 Planned 02/27/2003 1800
> ..
> ..
> 80 Planned 07/12/2003 6000
> 81 Unplanned 07/15/2003 8400
>
> Hence, the needed output file should be like
> MonthYear Planned Unplanned TotalDownTime
> Jan2003 5000 1200 6200
> Feb2003 1800 3690 5490
> ..
> ..
>
> I started with the following code
>
> my %count;
%sum would be a better name than %count.
> while(<DATA>) {
> chomp;
> my ($id, $type, $date, $downtime_secs) = split (/\t/, $_);
my ($id, $type, $mon, $day, $year, $downtime_secs) = split (/\t|\//, $_);
> $count{$type} += $downtime_secs;
$count{$mon.$year}{$type} += $downtime_secs;
> }
>
> while (my ($key, $val) = each %count) {
> print "$key, $val \n";
print "$key, $val->{Planned}, $val->{Unplanned}\n";
> }
> which outputs
> Unplanned, 82000
> Planned, 90000
>
> How can I modify the above, to give my customer what they wanted.
The above should start you down the path...
> Also
> if anyone can educate me to how to extract more detailed info as shown
> below, I would greatly appreciate it. Thank you
Keep two hashes, one named %sum and one named %count, and do the
obvious with thing with each.
>
> MonthYear Planned Unplanned Total NoPlanned NoUnplanned NoOfTotal
> Jan2003 5000 1200 6200 1 2 3
> Feb2003 1800 3690 5490 1 1 2
> ..
> ..
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Tue, 29 Jul 2003 19:43:49 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl - how to compute totals via hash request
Message-Id: <slrnbie565.5vh.tadmc@magna.augustmail.com>
shree <srigowrisn@hotmail.com> wrote:
> Hence, the needed output file should be like
> MonthYear Planned Unplanned TotalDownTime
> Jan2003 5000 1200 6200
> Feb2003 1800 3690 5490
> Also
> if anyone can educate me to how to extract more detailed info as shown
Errr, you do not need to extract any more info, you are already
extracting it all.
> below, I would greatly appreciate it. Thank you
>
> MonthYear Planned Unplanned Total NoPlanned NoUnplanned NoOfTotal
> Jan2003 5000 1200 6200 1 2 3
> Feb2003 1800 3690 5490 1 1 2
Oh, you need to record something that you are already extracting,
plus perform some calculations based on those values.
-----------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
my %count;
while ( <DATA> ) {
chomp;
my($id, $type, $date, $downtime_secs) = split;
(my $key = $date) =~ s#/\d+##;
$count{$key}{$type} += $downtime_secs;
$count{$key}{ substr $type, 0, 1 }++;
}
foreach my $key ( sort keys %count ) {
printf "%-15s %10d %10d %10d %3d %3d %3d\n", $key,
$count{$key}{Planned}, $count{$key}{Unplanned},
$count{$key}{Planned}+$count{$key}{Unplanned},
$count{$key}{P}, $count{$key}{U},
$count{$key}{P} + $count{$key}{U};
}
__DATA__
1 Planned 01/19/2003 5000
2 Unplanned 01/27/2003 900
3 Unplanned 01/29/2003 300
4 Unplanned 02/12/2003 3690
5 Planned 02/27/2003 1800
80 Planned 07/12/2003 6000
81 Unplanned 07/15/2003 8400
-----------------------------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 29 Jul 2003 23:50:26 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: perl problem on windows
Message-Id: <6LDVa.2410$rsJ.378@news04.bloor.is.net.cable.rogers.com>
"dw" <me@verizon.invalid> wrote in message
news:opnVa.21285$FP5.19256@nwrddc02.gnilink.net...
>
> It seems to work for me. Could it be a setup issue?
>
It should run from an 2000 or XP box that way (not sure anymore about NT),
but not any of the Win9x variants (I've never tried ME, but it's essentially
just 98 so I'd count it out too...). Win9x only have the file association
from an Explorer window (you always have to type "perl myscript.pl" from the
command line). You could get away with something like:
my $com = 'perl';
my $script = 'c:\program files\myscript.pl';
system $com, $script;
but you just need to watch out that you don't try and run "system $script"
on all Windows platforms and expect it to work. I know he didn't say what OS
he was using or what kind of program he was trying to run, but I just wanted
to mention that as a possible sticking point.
Matt
------------------------------
Date: Wed, 30 Jul 2003 00:28:13 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: Perl training resources?
Message-Id: <xiEVa.2426$rsJ.104@news04.bloor.is.net.cable.rogers.com>
"William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
news:bg6f0e$ih7$1@apollo.nyed.circ2.dcn...
>
> Yeah, I figured as much. What I'm looking for though is a way to reduce
the
> trial/error cycle and learn from other's experiences in a concise manner
> (you know, best-practices and all that). I'm sure I could glean everything
> from google, but I seem to ramp-up on a new language more quickly with a
> little structure.
>
A little time spent reading the Camel book and/or the docs *will* get you
what you're looking for (there is a lot of good instruction and "best
practices" in the documentation; it's not just a listing of functions). Just
reading perlfaq1 - perlfaq9 should give you a really good foundation on what
to look out for (once you get a handle on the syntax, of course). You're
also going to find that best practices in Perl can often be summed up in two
lines:
use strict;
use warnings;
Matt
------------------------------
Date: Wed, 30 Jul 2003 10:31:52 +1000
From: "Sisyphus" <kalinabears@iinet.net.au>
Subject: Re: porting perl scripts from NT to UNIX
Message-Id: <3f271308$0$23595$5a62ac22@freenews.iinet.net.au>
"mani srinivas potnuru" <potnuru@students.uiuc.edu> wrote in message
news:Pine.GSO.4.31.0307291308060.25837-100000@ux13.cso.uiuc.edu...
.
>
> But my problem is a different guy works on the win32 version of the script
> and it continously evolving and he refuses to do anything with UNIX. So i
> am trying to figure out a good way (less nightmarish) of being in sync
> with his script.
>
> Creating a new module (something like UWIN32), with exact API for whatever
> routines the script uses in win32 module is one idea. But is it worth the
> trouble?
No - Win32::API allows access to the functions in a vast number of Win32
dll's. Better to just convert the changes when he makes them. I would think
that he has too many options for you to be able to successfully cover them
in advance.
Of course it would make your job a lot easier if he wrote his scripts (for
Win32 only) *without* using any Win32-specific modules. You could point that
out to him. Even if you could get him to agree that future changes to the
script be made via perl functions (as opposed to Windows dll functions) that
would be a step in the right direction.
Other solutions that come to mind would have a detrimental effect on his
well-being and are, rightfully, illegal :-)
Cheers,
Rob
------------------------------
Date: Wed, 30 Jul 2003 01:11:28 +0100
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: remote readdir()
Message-Id: <pkent77tea-EE2088.01112830072003@usenet.force9.net>
In article <4a7949b4.0307290506.66fc711f@posting.google.com>,
Arthurkog@yahoo.com (ARod) wrote:
> Is there a way to use readdir to get the directory structure of a
> remote server? If not, is there another function that can do this?
In the special case that the remote directory is available locally (say
as a mapped drive on Windows or mounted from the remote NFS export) then
you can read the directory just like any other. But I expect that isn't
the case here. What you'll need to do is somehow get the directory read
on teh remote machine and get the data to your local machine. There are
many ways of doing this, from CGI programs, RPC things, custom daemons,
custom inetd programs, to using ssh or rsh. Your options might be
limited by the operating systems involved, your network and so on.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Wed, 30 Jul 2003 08:39:28 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: zero but true?
Message-Id: <bg6t0r$l3i8n$1@ID-202028.news.uni-berlin.de>
"bill" <bill_knight2@yahoo.com> wrote in message
news:bg6i4s$p8m$1@reader1.panix.com...
>
>
> $ perl -e 'print "$]: ", 0E0 ? "OK\n" : "not OK\n"'
> 5.008: not OK
>
> Isn't 0E0 supposed to evaluate to true?
>
When does 0 evaluate to true in Boolean logic?
If you expect 0 to evaluate to true, do you expect 1 to evaluate to false?
gtoomey
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5290
***************************************