[13762] in Perl-Users-Digest
Perl-Users Digest, Issue: 1172 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 27 21:07:43 1999
Date: Wed, 27 Oct 1999 18:07:00 -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: <941072820-v9-i1172@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Oct 1999 Volume: 9 Number: 1172
Today's topics:
"dynamic modules" makau@multimania.com
Re: "dynamic modules" <gellyfish@gellyfish.com>
Re: "dynamic modules" makau@multimania.com
Re: "dynamic modules" (Brett W. McCoy)
&read_to - insert data slamnet@my-deja.com
Re: &read_to - insert data <rootbeer@redcat.com>
Re: 'Crypt' function on CPAN <rootbeer@redcat.com>
Re: 'Crypt' function on CPAN <rootbeer@redcat.com>
Re: 'use FileHandle' fails if indirectly referenced fro <andrew.mclaren@swx.ch>
Re: 'use FileHandle' fails if indirectly referenced fro <andrew.mclaren@swx.ch>
Re: 'use FileHandle' fails if indirectly referenced fro <rootbeer@redcat.com>
Re: 'use FileHandle' fails if indirectly referenced fro <rootbeer@redcat.com>
*.perl.org web sites are back. (brian d foy)
2dimensional database neven@bigfoot.com
2dimensional database neven@bigfoot.com
Re: 2dimensional database (Craig Berry)
Re: 2dimensional database (Alan Curry)
[SOLVED] Sys::Syslog problems (Alan Mead)
Re: _Please_ improve localtime! (Abigail)
a newbie and his DOS (Arctor002)
Re: a newbie and his DOS <dchristensen@california.com>
Re: a newbie and his DOS <sswaminathan@micron.com>
Re: a newbie and his DOS (Steve Harvey)
Re: a newbie and his DOS <dchristensen@california.com>
Re: a newbie and his DOS <dchristensen@california.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 25 Oct 1999 14:42:11 GMT
From: makau@multimania.com
Subject: "dynamic modules"
Message-Id: <7v1q82$6at$1@nnrp1.deja.com>
Is it possible to use "dynamic modules"?
I tried this :
@types = ('linespoints','mixed','lines','bars','area');
$graph = new GIFgraph::$types[2];
But Perl complains "Bad name after :: at script.pl line xxx"
Is there a work around?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 25 Oct 1999 16:30:52 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "dynamic modules"
Message-Id: <381477ac_2@newsread3.dircon.co.uk>
makau@multimania.com wrote:
> Is it possible to use "dynamic modules"?
>
> I tried this :
> @types = ('linespoints','mixed','lines','bars','area');
> $graph = new GIFgraph::$types[2];
>
> But Perl complains "Bad name after :: at script.pl line xxx"
>
> Is there a work around?
>
Yes - you can use eval($string);
eval "\$graph = new GIFgraph::$types[2];";
But this is rather horrid IMO ...
/J\
--
"I managed to take her completely by surprise" - Prince Edward
------------------------------
Date: Mon, 25 Oct 1999 15:25:32 GMT
From: makau@multimania.com
Subject: Re: "dynamic modules"
Message-Id: <7v1sp6$8ah$1@nnrp1.deja.com>
> I tried this :
> @types = ('linespoints','mixed','lines','bars','area');
> $graph = new GIFgraph::$types[2];
OK, I've found.
I just wrote :
@types =
('GIFgraph::linespoints','GIFgraph::mixed','GIFgraph::lines','GIFgraph::
bars','GIFgraph::area');
$graph = $types[2]->new;
and it curiously worked !
I do wonder why "$types[2]->new" should work but not "new $types[2]" !
it's weird
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 25 Oct 1999 15:54:15 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: "dynamic modules"
Message-Id: <slrn818vi3.v01.bmccoy@moebius.foiservices.com>
Also Sprach makau@multimania.com <makau@multimania.com>:
>> I tried this :
>> @types = ('linespoints','mixed','lines','bars','area');
>> $graph = new GIFgraph::$types[2];
>
>OK, I've found.
>
>I just wrote :
>@types =
>('GIFgraph::linespoints','GIFgraph::mixed','GIFgraph::lines','GIFgraph::
>bars','GIFgraph::area');
>$graph = $types[2]->new;
>
>and it curiously worked !
>
>I do wonder why "$types[2]->new" should work but not "new $types[2]" !
What kind of error did you get back from Perl when you tried the former
style? My guess would be that using the -> notation is less ambiguous --
Perl can resolve the reference properly whereas using 'new $types[2]' it
is getting confused -- it may think that you are passing the string
"lines" as a argument to the 'new' member function.
Are you attemping to do this as some sort of polymorphism?
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Tue, 26 Oct 1999 21:46:39 GMT
From: slamnet@my-deja.com
Subject: &read_to - insert data
Message-Id: <7v57fu$mu3$1@nnrp1.deja.com>
Folks,
I'm trying to insert a record into a page after the last record but
before the footer HTML.
I'm going to use &read_to to get to a marker at the end of the area in
which I want to insert the info, but I need to get to that marker and
then move up one line so I can insert the info before the end marker. I
don't have a clue how to do that. Would anyone like to take a stab at
that line of code? I would sure appreciate it.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 26 Oct 1999 15:58:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: &read_to - insert data
Message-Id: <Pine.GSO.4.10.9910261557320.29843-100000@user2.teleport.com>
On Tue, 26 Oct 1999 slamnet@my-deja.com wrote:
> I'm trying to insert a record into a page after the last record but
> before the footer HTML.
Sounds as if you're editing HTML. You'll probably want HTML::Parser, from
CPAN. Also, you should see what the FAQ says about editing a text file.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 26 Oct 1999 20:15:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: 'Crypt' function on CPAN
Message-Id: <Pine.GSO.4.10.9910262014000.29843-100000@user2.teleport.com>
On Wed, 27 Oct 1999, Pete wrote:
> Maybe I shoulda mentioned that my hoster is running NT and IIS4 so that
> 'Crypt::UnixCrypt' module would be for UNIX right?
Actually, we wanted to call it that because it's providing the Unix
crypt's functionality even on non-Unix systems. But maybe it should have
been called Crypt::ForEveryNonUnixSystem. :-)
In answer to your other question, it should show up on http://www.cpan.org
along with the rest of the CPAN sites. Soon, I hope....
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 26 Oct 1999 15:15:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: 'Crypt' function on CPAN
Message-Id: <Pine.GSO.4.10.9910261458460.29843-100000@user2.teleport.com>
On Wed, 27 Oct 1999, Pete wrote:
> Just tried to install and then run a guestbook which didn't like the
> flavour of PERL installed by my host. Anyone know where I can find out
> about CPAN port of Perl and ask whether they plan to incorporate this
> 'crypt' feature that apparently is found in the 'Activestate' port of
> perl??
Why don't you just get the ActiveState port?
But there is no "CPAN port". If what you've got doesn't support crypt,
though, a module should be making its way to CPAN soon. By installing that
module, you should be able to use crypt even if you're stuck with a port
suffering from "paranoia".
Look for Crypt::UnixCrypt, which should appear Any Day Now(tm).
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Oct 1999 11:23:38 GMT
From: aml <andrew.mclaren@swx.ch>
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <7v6nbp$nkt$1@nnrp1.deja.com>
I've reread this, but I'm afraid I'm no clearer (maybe just plain
dumb). For a normal package it makes sense - a 'use' is effectively a
'require' followed by an 'import' performed at compile time. However,
for a version, presumably an 'import' makes no sense as there is no
package there to do an import from (and in fact, Perl attempting to do
this import and failing was what triggered the original question). This
would then imply that there is no (at least obvious) difference between
a 'use <version>' and a 'require <version>'. The camel book only refers
to the 'require' form of version checking, but perlfunc at least
alludes to being able to do a 'use <version> as well.
Is there any difference between these?
Andrew
In article <Pine.GSO.4.10.9910261429140.29843-
100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Tue, 26 Oct 1999, aml wrote:
>
> > I am still unclear what the implications of a 'use <version>' rather
> > than a simple require are? Can anyone shed any light on this?
>
> I think that the entry on 'use' in the perlfunc manpage says it all.
> Although if you still have questions after reading it, perhaps it
could be
> made clearer.
>
> Cheers!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
--
Andrew McLaren
Swiss Stock Exchange
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 26 Oct 1999 07:27:55 GMT
From: aml <andrew.mclaren@swx.ch>
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <7v3l5p$i52$1@nnrp1.deja.com>
Making progress, but it's slow...
First thing I tried was replacing the 'use <version>' in FileHandle.pm
with a require. This resolved the failure trying to treat this as a
package, and execute an import method on it. I am not sure of the
mechanism Perl uses to determine whether the parameter to a use is a
package or a version, but it appears to somehow get confused, and when
setuid is on, treats the <version> as a package name that will support
an import.
I am still unclear what the implications of a 'use <version>' rather
than a simple require are? Can anyone shed any light on this?
I am looking at a simpler model simply using the setuid process to
switch users, then exec'ing a new process to do the rest of the work.
This costs an extra process, but means the bulk of the logic (incliding
FileHandle) doesn't have to be setuid compliant. It also has to be
safer.
On the related, but non-Perl issues, Netscape apparently doesn't
support any mechanism to use any user other than the server default,
but CGIwrap will work under a Netscape environment.
--
Andrew McLaren
Swiss Stock Exchange
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Oct 1999 11:20:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <Pine.GSO.4.10.9910271116530.29843-100000@user2.teleport.com>
On Wed, 27 Oct 1999, aml wrote:
> This would then imply that there is no (at least obvious) difference
> between a 'use <version>' and a 'require <version>'.
Except that the 'use' happens at compile time. Either way, though, it's
insisting that the current version of perl be at least the given number.
> The camel book only refers to the 'require' form of version checking,
> but perlfunc at least alludes to being able to do a 'use <version> as
> well.
If I'm not mistaken, the latter was invented since the book was published.
Which brings to mind the possibility that, if it's not working for you,
you could be using an old version of perl to emulate set-id scripts. Print
out the $] variable within the program to check.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 26 Oct 1999 14:31:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <Pine.GSO.4.10.9910261429140.29843-100000@user2.teleport.com>
On Tue, 26 Oct 1999, aml wrote:
> I am still unclear what the implications of a 'use <version>' rather
> than a simple require are? Can anyone shed any light on this?
I think that the entry on 'use' in the perlfunc manpage says it all.
Although if you still have questions after reading it, perhaps it could be
made clearer.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Oct 1999 08:59:58 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: *.perl.org web sites are back.
Message-Id: <brian-ya02408000R2710990859580001@news.panix.com>
the web sites www.perl.org, www.pm.org, and www.news.perl.org are
back online. many of the user groups web sites (*.pm.org) that are
hosted by Perl Mongers should be available as well, and the ones that
aren't i'm working on. we're still working on getting other services
back.
any wierdness is probably my fault in recovering the data or
installing new software, and i haven't had time to thoroughly
look at everything yet. if you see anything that doesn't look
right, please tell me about it in personal mail. include the URL
that you looked at and a concise description of the problem.
thanks :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 25 Oct 1999 17:14:25 GMT
From: neven@bigfoot.com
Subject: 2dimensional database
Message-Id: <7v235c$ddh$1@nnrp1.deja.com>
Hi,
I have a problem. I am trying to setup a script that will read a two
dimensional (file) database to display the distance between two cities:
XX;Boston;NewYork;SanFrancisco
Boston;0;300;5000
NewYork;300;0;4700
SanFrancisco;5000;4700;0
The user enters a 'from' which gets read in row one and a 'to' which is
read in the column and matches the respective number.
I have absolutely no idea where to start. Any ideas?
Thanks!
Neven
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 25 Oct 1999 17:13:40 GMT
From: neven@bigfoot.com
Subject: 2dimensional database
Message-Id: <7v233v$dd6$1@nnrp1.deja.com>
Hi,
I have a problem. I am trying to setup a script that will read a two
dimensional (file) database to display the distance between two cities:
XX;Boston;NewYork;SanFrancisco
Boston;0;300;5000
NewYork;300;0;4700
SanFrancisco;5000;4700;0
The user enters a 'from' which gets read in row one and a 'to' which is
read in the column and matches the respective number.
I have absolutely no idea where to start. Any ideas?
Thanks!
Neven
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 25 Oct 1999 23:25:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: 2dimensional database
Message-Id: <s19pmqptgbb44@corp.supernews.com>
neven@bigfoot.com wrote:
: I have a problem. I am trying to setup a script that will read a two
: dimensional (file) database to display the distance between two cities:
:
: XX;Boston;NewYork;SanFrancisco
: Boston;0;300;5000
: NewYork;300;0;4700
: SanFrancisco;5000;4700;0
:
: The user enters a 'from' which gets read in row one and a 'to' which is
: read in the column and matches the respective number.
:
: I have absolutely no idea where to start. Any ideas?
This sounded fun, so I knocked out a quick script to do this -- the data
setup part, anyway, I leave user interaction to you. The basic data
structure is a hash keyed by origin cities, each value of which is a hash
keyed by destination cities, each value of which is the distance to that
city. This makes lookup pleasantly direct. Enjoy!
#!/usr/bin/perl -w
# dist - display distances between cities
# Craig Berry (991025)
use strict;
chomp(my $line = <DATA>);
my @dest = split /;/, $line;
shift @dest;
my %miles;
while (<DATA>) {
chomp;
my @figures = split /;/;
my $origin = shift @figures;
@{$miles{$origin}}{@dest} = @figures;
}
print <<EOF;
Examples:
Boston to New York: $miles{Boston}{NewYork}
New York to Boston: $miles{NewYork}{Boston}
New York to SF: $miles{NewYork}{SanFrancisco}
EOF
__DATA__
XX;Boston;NewYork;SanFrancisco
Boston;0;300;5000
NewYork;300;0;4700
SanFrancisco;5000;4700;0
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Mon, 25 Oct 1999 18:52:28 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: 2dimensional database
Message-Id: <MF1R3.37470$E_1.2120257@typ11.nn.bcandid.com>
In article <7v233v$dd6$1@nnrp1.deja.com>, <neven@bigfoot.com> wrote:
>I have a problem. I am trying to setup a script that will read a two
>dimensional (file) database to display the distance between two cities:
>
>XX;Boston;NewYork;SanFrancisco
>Boston;0;300;5000
>NewYork;300;0;4700
>SanFrancisco;5000;4700;0
>
>The user enters a 'from' which gets read in row one and a 'to' which is
>read in the column and matches the respective number.
Build a hash of hashes with the row/column headings as keys:
#!/usr/bin/perl -w
use strict;
open(FILE, "file") or die "file: $!\n";
my @columnheads=split(/;/, <FILE>);
shift(@columnheads); # lose XX
chomp($columnheads[-1]);
my %dist=();
while(<FILE>) {
my @row=split(/;/,$_);
my $rowlabel=shift(@row);
chomp($row[-1]);
if(@row != @columnheads) {
die "Wrong number of fields on this line: $_\n";
}
$dist{$rowlabel} = { map { $columnheads[$_] => $row[$_] } 0..$#row };
}
close(FILE);
print $dist{Boston}{NewYork}, "\n";
print $dist{Boston}{SanFrancisco}, "\n";
print $dist{NewYork}{NewYork}, "\n";
print $dist{NewYork}{Boston}, "\n";
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Wed, 27 Oct 1999 21:10:01 GMT
From: adm@ipat.com (Alan Mead)
Subject: [SOLVED] Sys::Syslog problems
Message-Id: <38176886.198149133@news.soltec.net>
I guess this probably comes up from time to time and many of you have
seen it, but in researching the problem, I saw several unanswered
posts within my ISP's news history...
So, here are two Deja links to a solution which seems to be working
for me using Perl 5.005003 on Red Hat Linux 6.0 (2.2.5-22 kernel).
Big thanks to Jonathan Stowe and Noel.
http://x35.deja.com/getdoc.xp?AN=480847110&search=thread&CONTEXT=941058223.1742143500&HIT_CONTEXT=941057438.1671233554&HIT_NUM=5&hitnum=3
and
http://x25.deja.com/getdoc.xp?AN=533154055&CONTEXT=941058661.2116091915&hitnum=1
-Alan
------------------------------
Date: 25 Oct 1999 08:48:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: _Please_ improve localtime!
Message-Id: <slrn818ns8.fji.abigail@alexandra.delanet.com>
Russell Schulz (Russell_Schulz@locutus.ofB.ORG) wrote on MMCCXLV
September MCMXCIII in <URL:news:19991024.142856.3Q8.rnr.w164w@locutus.ofB.ORG>:
<>
<> It blows me away to see how AmEx has billboards proclaiming they are
<> `Y3K Compliant' (not a typo), and yet the 20-foot-high cards shown on
<> the billboards have 2-digit expiry years! Talk about not solving the
<> problem once and for all (for 8000 years, anyway) when you have a chance.
Eh? What makes you think that having 2 digits years makes you *not*
YNK compliant, for whatever N you want to pick?
Perhaps you have credit cards dating from the beginning of this
century, which are still being accepted today by stores; I'm quite
sure you won't find any AmEx cards from the period.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 26 Oct 1999 18:56:17 GMT
From: arctor002@aol.com (Arctor002)
Subject: a newbie and his DOS
Message-Id: <19991026145617.16292.00001060@ng-fx1.aol.com>
Hi. I'm trying to get started in the brave new world of Perl, and I've hit a
snag that I was hoping somebody could help me with: I need some basic
proficiency with MS-DOS. If anyone could help me with the following tasks under
MS-DOS, I'd be wildly grateful. 1) how do you run a Perl program from an MS-DOS
command line? 2) How do you NOT run a Perl program, but instead open it and
read/edit the program? 3) If I'm in a directory, how do I open a subdirectory?
4) What is a batch file? 5) What other kinds of files are there? 6) If I create
or download a Perl program while I'm on Windows, how do I find and use that
program in an MS-DOS window?
The RTFM method hasn't worked out too well... I was an IDIOT and bought a
DUMMY book. In chapter 2, where these things are supposed to be covered...
they're not covered. Just for the sake of posterity, if anyone knows another
newbie, tell them not to buy that book. I would have gotten the O'Reilly book,
but I thought that questions like mine would be more likely to be handed in a
'for Dummies' book. And I haven't found a good book on DOS, either.
Some technical clues: As per the instructions in my book, I created a C:\Perl
directory, where all the Perl stuff is stashed. Also, if I run a Perl program,
a DOS window pops up and goes away really fast. I'm assuming that what's
happening is that the program is being executed, and then dies. The scary thing
about that is that the program is supposed to wait for some user input (I
think). Oh yeah, The Perl in question is ActiveState Perl 5.00502
Folks, If you can help me with this, I'd be most grateful. And I'd spend a lot
less time playing Starcraft.
------------------------------
Date: Wed, 27 Oct 1999 13:39:51 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: a newbie and his DOS
Message-Id: <38175f5b$1_5@news5.newsfeeds.com>
comp.lang.perl.misc:
David Christensen wrote in message <381613ca_4@news5.newsfeeds.com>...
>> C:\My Documents>perldoc perl
>
>
>Make that:
>
> C:\Perl\html\index.html
Oops! Corrected something that was correct:
>> C:\My Documents>perldoc perl
Is good.
>> C:\Perl\html\perlmain.html
Needs to be fixed:
C:\Perl\html\index.html
Doh!
--
David Christensen
dchristensen@california.com
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 26 Oct 1999 17:02:53 -0700
From: Shuba Swaminathan <sswaminathan@micron.com>
To: Arctor002 <arctor002@aol.com>
Subject: Re: a newbie and his DOS
Message-Id: <3816412D.E483E939@micron.com>
Try this book for DOS: I swear by it and is worth every $ of the 30 you will invest in it.
Using MS-DOS 6.2 -Special Edition by Allen.L.Wyatt Sr, W.Edward Tiley and Jon Paisley
ISBN: 1-56529-646-x
HTH,
Shuba
------------------------------
Date: 26 Oct 1999 20:01:58 GMT
From: steveharvey@geocities.com (Steve Harvey)
Subject: Re: a newbie and his DOS
Message-Id: <slrn81c25l.1bo.steveharvey@itc001472.usitc.gov>
In article <19991026145617.16292.00001060@ng-fx1.aol.com>, Arctor002 wrote:
> Hi. I'm trying to get started in the brave new world of Perl, and I've hit a
>snag that I was hoping somebody could help me with: I need some basic
>proficiency with MS-DOS. If anyone could help me with the following tasks under
>MS-DOS, I'd be wildly grateful. 1) how do you run a Perl program from an MS-DOS
>command line? 2) How do you NOT run a Perl program, but instead open it and
>read/edit the program? 3) If I'm in a directory, how do I open a subdirectory?
>4) What is a batch file? 5) What other kinds of files are there? 6) If I create
>or download a Perl program while I'm on Windows, how do I find and use that
>program in an MS-DOS window?
Let me see if I can take a stab at some of these...
1. From the DOS prompt, type "perl progname.pl", assuming perl.exe is in
your $PATH (you may have to set this in your autoexec.bat file).
2. Umm, "edit progname.pl"
3. From DOS, the command is "cd c:\pathname\subdir". In Perl, the command
to change to a different working directory is "chdir"
I won't answer numbers 4-6 because they are really general DOS questions
and therefore outside the scope of comp.lang.perl. You may have better
luck on a DOS newsgroup or searching for a good DOS general info site
(I don't know of any to recommend).
A couple tips to get started typing in programs, though. Assuming you've
got Perl installed on your machine (and assuming you're running Windows of
some variety and not plain DOS), try the following.
1. Go to the Start menu and bring up a MS-DOS prompt.
2. Hit alt-enter to make the DOS window go full screen. Now you can
concentrate on Perl and not fooling with Windows.
3. At the DOS prompt, type "cd c:\perl"
4. Type "edit test.pl" (note: you'll eventually want to make a seperate
directory for your Perl programs, but now you just want to get up and
running). In the DOS editor, type a simple program like
print "Hello, World.\n";
5. Save the program and exit the editor.
6. Back at the DOS prompt, type "perl test.pl". If all goes well you
have just written your first Perl program and can go on and try out some
sample programs from your book.
(P.S. the O'Reilly books are excellent, but presuppose a working knowledge
of the underlying OS -- it sounds like you need to bone up a little in that
area before diving too deep into the world of programming)
Good luck,
Steve
------------------------------
Date: Tue, 26 Oct 1999 13:30:14 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: a newbie and his DOS
Message-Id: <38160c41_2@news5.newsfeeds.com>
Arctor:
Arctor002 wrote in message
<19991026145617.16292.00001060@ng-fx1.aol.com>...
> Hi. I'm trying to get started in the brave new world of Perl, and I've
hit a snag that I was hoping somebody could help me with: I need some
basic proficiency with MS-DOS. If anyone could help me with the
following tasks under MS-DOS, I'd be wildly grateful.
It sounds like you're really running MS-Windows 95, 98, or 98/2, which
include an "MS-DOS Prompt" console (or shell, in Un*x parlance). MS-DOS
used to ship with a fairly decent manual, but now everything seems to be
on-line. Try Start | Help. Set aside a couple of hours and dig
through the whole thing -- it will be worth it.
> 1) how do you run a Perl program from an MS-DOS command line?
- Open a DOS box (click on MS-DOS Prompt on your desktop)
- Change your current directory to the directory containing the Perl
script (via the 'cd' command):
C:\>cd \david\code\perl\hello
- Invoke Perl with the name of the script as the argument:
C:\david\code\perl\hello>perl hello.pl
Hello, world!
As an aside, many DOS commands have little reminders, available by
typing the command name followed by '/?':
C:\david\code\perl\hello>cd /?
Displays the name of or changes the current directory.
CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]
.. Specifies that you want to change to the parent directory.
Type CD drive: to display the current directory in the specified
drive.
Type CD without parameters to display the current drive and
directory.
Perl's reminder uses the Un*x convention ('--help'), but will scroll off
the screen. You can create a command pipeline using '|' and send the
ouput of one program into the input of another (the 'more' paging
utility, for example):
C:\My Documents>perl --help | more
Perl also has a documentation program called 'perldoc', which already
knows about 'more':
C:\My Documents>perldoc perl
ActiveState comes with web (html) documentation. Point your browser at:
C:\Perl\html\perlmain.html
> 2) How do you NOT run a Perl program, but instead open it and
read/edit the program?
Invoke Edit with the name of the script as the argument:
C:\david\code\perl\hello>edit hello.pl
> 3) If I'm in a directory, how do I open a subdirectory?
To change your current directory, use the 'cd' command.
To see what's inside a directory, use the 'dir' command:
C:\david\code\perl\hello>dir
Volume in drive C has no label
Volume Serial Number is 0C64-13D9
Directory of C:\david\code\perl\hello
. <DIR> 10-26-99 12:23p .
.. <DIR> 10-26-99 12:23p ..
HELLO PL 51 10-26-99 1:01p hello.pl
1 file(s) 51 bytes
2 dir(s) 272,322,560 bytes free
> 4) What is a batch file?
A program written in MS-DOS or MS-Windows batch programming langauge.
Your c:\autoexec.bat file is a good example (it gets run each time your
system boots). Let me know if you find a good book on Win98 batch
programming language.
> 5) What other kinds of files are there?
Bizillions.
> 6) If I create r download a Perl program while I'm on Windows, how do
I find and use that program in an MS-DOS window?
You need to know which directory your downloaded it into (C:\My
Documents?), then use the 'cd' command to navigate there. For example:
C:\david\code\perl\hello>cd "\My Documents"
Note the double-quotes -- they're required if the path has embedded
spaces.
> The RTFM method hasn't worked out too well... I was an IDIOT and
bought a DUMMY book. In chapter 2, where these things are supposed to be
covered... they're not covered. Just for the sake of posterity, if
anyone knows another newbie, tell them not to buy that book. I would
have gotten the O'Reilly book, but I thought that questions like mine
would be more likely to be handed in a 'for Dummies' book. And I haven't
found a good book on DOS, either.
Find a good techno bookstore. I'm fortunate -- I work in Sunnyvale and
there are two good ones around the corner.
> Some technical clues: As per the instructions in my book, I created a
C:\Perl directory, where all the Perl stuff is stashed.
Good.
> Also, if I run a Perl program, a DOS window pops up and goes away
really fast. I'm assuming that what's happening is that the program is
being executed, and then dies. The scary thing about that is that the
program is supposed to wait for some user input (I think).
Your program is probably generating a compiler error, and so it never
even starts. Get it working in a DOS box before you light it off using
Windows Explorer.
> Oh yeah, The Perl in question is ActiveState Perl 5.00502
ActivePerl is usually specified by build number.
> Folks, If you can help me with this, I'd be most grateful. And I'd
spend a lot less time playing Starcraft.
I've been Jones'n for Star Fleet Command lately... ;-)
--
David Christensen
dchristensen@california.com
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 26 Oct 1999 14:04:48 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: a newbie and his DOS
Message-Id: <381613ca_4@news5.newsfeeds.com>
> C:\My Documents>perldoc perl
Make that:
C:\Perl\html\index.html
--
David Christensen
dchristensen@california.com
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 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 V9 Issue 1172
**************************************