[22309] in Perl-Users-Digest
Perl-Users Digest, Issue: 4530 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 10 18:07:28 2003
Date: Mon, 10 Feb 2003 15:06:24 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 Feb 2003 Volume: 10 Number: 4530
Today's topics:
Access violation (Jack Cane)
Re: Access violation <abigail@abigail.nl>
Re: Accessing remote files in NT (flyershistory)
Re: Accessing remote files in NT <goldbb2@earthlink.net>
Re: Accessing remote files in NT (flyershistory)
ActivePerl, upgraded then downgraded, problems! <rob@webteacher.com>
Re: ActivePerl, upgraded then downgraded, problems! (Randy Kobes)
Re: ActivePerl, upgraded then downgraded, problems! <rob@webteacher.com>
Re: ActivePerl, upgraded then downgraded, problems! <randy@theoryx5.uwinnipeg.ca>
Re: ActivePerl, upgraded then downgraded, problems! <bart.lateur@pandora.be>
Re: ActivePerl, upgraded then downgraded, problems! (Philip Lees)
Re: ActivePerl, upgraded then downgraded, problems! (Randy Kobes)
ANNOUNCEMENT: POE 0.25 Released <troc@netrus.net>
Argument detection not working <j.j.konkle-parker@larc.nasa.gov>
Re: Argument detection not working <uri@stemsystems.com>
Re: Argument detection not working <j.j.konkle-parker@larc.nasa.gov>
Re: Argument detection not working <j.j.konkle-parker@larc.nasa.gov>
Re: Argument detection not working <spamtrap@nowhere.com>
Re: Argument detection not working <mothra@nowhereatall.com>
Re: Argument detection not working <spamtrap@nowhere.com>
Re: Argument detection not working <abigail@abigail.nl>
Re: Argument detection not working <abigail@abigail.nl>
backup a text file <pdhze@yahoo.co>
Re: backup a text file <abigail@abigail.nl>
Re: backup a text file (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Feb 2003 10:35:33 -0800
From: jwcane@enw-ltd.com (Jack Cane)
Subject: Access violation
Message-Id: <3f29ccb2.0302081035.1cfeef05@posting.google.com>
The following code is an extension of a working, simple select query.
For some reason the join query is causing an application error
"instruction...could not be read".
I hope someone can show me how to avoid the error.
Here is a code snippet.
=========================
my $row1 = param( "ROWSTART" );
my $row2 = param( "ROWEND" );
my $Q1 = "Select m.FirstName, m.MidInitial, m.LastName, a.Email,
a.address1, a.city, a.staat, a.zipcode, a.phonenr from MemberNames m,
MbrAddress a where m.MbrNr > ";
my $Q2 = " and m.mbrNr < ";
my $Q3 = " and a.MbrNum = m.MbrNr";
my $querystring = $Q1.$row1.$Q2.$row2.$Q3;
$DSN = "LTmembers";
print header;
if (!($Data = new Win32::ODBC($DSN)))
{
print "Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}
if ($Data->Sql($querystring))
{
print "SQL failed.\n";
print "Error: " . $Data->Error() . "\n";
$Data->Close();
exit;
}
======================
------------------------------
Date: 09 Feb 2003 00:44:02 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Access violation
Message-Id: <slrnb4b92i.sb.abigail@alexandra.abigail.nl>
Jack Cane (jwcane@enw-ltd.com) wrote on MMMCDXLVIII September MCMXCIII in
<URL:news:3f29ccb2.0302081035.1cfeef05@posting.google.com>:
:) The following code is an extension of a working, simple select query.
:) For some reason the join query is causing an application error
:) "instruction...could not be read".
I don't think that's a Perl error. But if it is, you can read about
it in "man perldiag".
If it isn't a Perl error, this is the wrong group to ask.
Abigail
--
# Count the number of lines; code doesn't match \w. Linux specific.
()=<>;$!=$=;($:,$,,$;,$")=$!=~/.(.)..(.)(.)..(.)/;
$;++;$*++;$;++;$*++;$;++;`$:$,$;$" $. >&$*`;
------------------------------
Date: 9 Feb 2003 07:04:20 -0800
From: flyershistory@hockeymail.com (flyershistory)
Subject: Re: Accessing remote files in NT
Message-Id: <d7bdcf6c.0302090704.4e2f12cb@posting.google.com>
> [snip]
>
> > $this = pack($sockaddr, 2, 0, $thisaddr);
> >
> > if (!socket (S, 2, 1, 6)) {
>
> Where are these magic numbers coming from? They might be right on one
> platform [your particular version of unix], but not necessarily on other
> platforms.
I guess I wasn't clear in my initial questiobn .. I'm basically asking
where I get these magic numbers from.
I only have access to a certain directory on a web server. I have no
control over the installation of perl. The @INC file is basically
empty - and all attempts to get a proper installation done has failed
- so I'm trying to get a script to work without using any "use"
statements. With the empty @inc file, all I can use is whatever is in
the current directory. Even the "use IO::Socket;" statement causes a
compilation error. So without using "use IO::Socket;" or LWP, how can
I get the script to work ? Where can I get those "magic numbers" ?
------------------------------
Date: Sun, 09 Feb 2003 22:54:17 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Accessing remote files in NT
Message-Id: <3E472269.3FB2BDE@earthlink.net>
flyershistory wrote:
>
> > [snip]
> >
> > > $this = pack($sockaddr, 2, 0, $thisaddr);
> > >
> > > if (!socket (S, 2, 1, 6)) {
> >
> > Where are these magic numbers coming from? They might be right on
> > one platform [your particular version of unix], but not necessarily
> > on other platforms.
>
> I guess I wasn't clear in my initial questiobn .. I'm basically asking
> where I get these magic numbers from.
ITYM, where *should* you be getting those numbers from -- and the
answer, is, from Socket.pm, *if* you feel the need to use the low-level
functions such as socket(), bind(), etc..
But it would be far simpler to use IO::Socket, which provides a nice,
good looking, object oriented interface to sockets.
> I only have access to a certain directory on a web server. I have no
> control over the installation of perl. The @INC file is basically
> empty - and all attempts to get a proper installation done has failed
> - so I'm trying to get a script to work without using any "use"
> statements. With the empty @inc file, all I can use is whatever is in
> the current directory. Even the "use IO::Socket;" statement causes a
> compilation error.
What version of perl do you have? IO::Socket has been a standard part
of perl since (at least) perl 5.005_03. If you have that perl, or a
later one, and do not have IO::Socket, then that indicates that your
current installation is seriously broken.
If you've an earlier version of perl5... well, perhaps you have
Socket.pm available?
If you're running perl4, then you can try getting the constants by
require()ing 'socket.ph'... and if that fails, you're probably out of
luck.
> So without using "use IO::Socket;" or LWP, how can
> I get the script to work ? Where can I get those "magic numbers" ?
Have you considered trying to upload, compile and install a whole new
perl? You don't need to install it as root, in the 'standard' location,
you can just install it in your own directories, the same place as
you're allowed to upload perl scripts too.
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: 10 Feb 2003 06:33:53 -0800
From: flyershistory@hockeymail.com (flyershistory)
Subject: Re: Accessing remote files in NT
Message-Id: <d7bdcf6c.0302100633.f2208b8@posting.google.com>
Thanks for your help. The perl installation is completely messed up. I
only have FTP access to upload files to certain directories, so it
isn't the easiest thing to figure out exactly "how" things are exactly
messed up. I can't see the perl directories (other than my own), and I
can't log onto the server itself to see what's-what.
I did change my print command to the one you used, and that did make a
difference. It now works 50% of the time, which is "good enough". So
thanks very much for your help !
Peter
------------------------------
Date: Fri, 07 Feb 2003 19:00:37 GMT
From: Robert Young <rob@webteacher.com>
Subject: ActivePerl, upgraded then downgraded, problems!
Message-Id: <3E440319.594F42CA@webteacher.com>
Hi All;
This is my first time posting. I have searched the archives and FAQs and
could not find
a solution. I hope someone on this board can help. I have been a happy
user of ActivePerl
for a long time and I recommend it whenever possible. The summary of my
question is
this:
I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
install DBD-mysql
I get a message that the module was found but is is not built for my
version of Perl.
Here are the details:
My box is a PIII750mhz/512mb w/ W2KPro
First I upgraded to ActivePerl 5.8.0 (I ran the Windows uninstaller
first from "Add/Remove programs"
first to clean out ActivePerl 5.6.1).
I found, unfortunately, that the PPM repository for build 5.8.0 is
missing many of the modules I needed,
including DBD::mysql and Tk::JPEG. In fact, according to the lists at
http://ppm.activestate.com/PPMPackages/zips,
there are 3296 modules in the 5.6.x archive, and only 1665 modules in
the 5.8.x archive.
For the DBD::mysql problem, it didn't take long to find numerous posts
referring to the
PPM repository at uwinnipeg.ca that the author of DBD-mysql
hosts with the module for 5.8, but even after I ran the PPM install for
it and added c:\mysql\bin\opt to my PATH, I still
had problems. For one I kept getting "could not load
c:\perl\site\lib\DBD\mysql.dll", even though it was right there at the
specified location.
Because of this problem and the numerous missing modules, I decided to
downgrade to build 5.6.1. Again I
used the "add/remove programs" control panel to uninstall ActivePerl
5.8, and then I downloaded and installed
a fresh copy of 5.6.1. However, something is still not right. In the
past, using 5.6.1, typing:
ppm> install DBI
ppm> install DBD-mysql
has worked flawlessly. Now, I get the following error:
Error installing package 'DBD-mysql': Read a PPD for 'DBD-mysql',
but it is not intended for this build of Perl (MSWin32-x86-multi-thread)
One final note. I had one of my software users call me today with
exactly the same story. Upgraded, Downgraded, and
now gets a "not intended for this build" error. This will probably
happen frequently until the 5.8 repository is complete, so I hope
this thread becomes a valuable resource for others in the same boat.
Many bows and thanks for reading my long message.
Rob
--
------------------------------------------------
Webteacher Software, LLC
'Webdata' - the first EASY database for the web
'JavaScript for the Total Non-Programmer'
'CGI for the Total Non-Programmer'
http://www.webteacher.com
mailto:sales@webteacher.com
------------------------------------------------
------------------------------
Date: 7 Feb 2003 19:30:18 GMT
From: randy@theoryx5.uwinnipeg.ca (Randy Kobes)
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <slrnb481u3.3lv.randy@theoryx5.uwinnipeg.ca>
On Fri, 07 Feb 2003 19:00:37 GMT, Robert Young <rob@webteacher.com> wrote:
>Hi All;
>This is my first time posting. I have searched the archives and FAQs and
>could not find
>a solution. I hope someone on this board can help. I have been a happy
>user of ActivePerl
>for a long time and I recommend it whenever possible. The summary of my
>question is
>this:
>
>I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
>install DBD-mysql
>I get a message that the module was found but is is not built for my
>version of Perl.
>
>Here are the details:
>
>My box is a PIII750mhz/512mb w/ W2KPro
>
>First I upgraded to ActivePerl 5.8.0 (I ran the Windows uninstaller
>first from "Add/Remove programs"
>first to clean out ActivePerl 5.6.1).
>
>I found, unfortunately, that the PPM repository for build 5.8.0 is
>missing many of the modules I needed,
>including DBD::mysql and Tk::JPEG. In fact, according to the lists at
>http://ppm.activestate.com/PPMPackages/zips,
>there are 3296 modules in the 5.6.x archive, and only 1665 modules in
>the 5.8.x archive.
>
>For the DBD::mysql problem, it didn't take long to find numerous posts
>referring to the
>PPM repository at uwinnipeg.ca that the author of DBD-mysql
>hosts with the module for 5.8, but even after I ran the PPM install for
>it and added c:\mysql\bin\opt to my PATH, I still
>had problems. For one I kept getting "could not load
>c:\perl\site\lib\DBD\mysql.dll", even though it was right there at the
>specified location.
Is "c:\mysql\bin\opt" the location on your system where
libmySQL.dll is? Or should that be "c:\mysql\lib\opt"?
If adding that directory to your PATH doesn't work,
which it might not in a web environment, try copying
libmySQL.dll to some place like C:\Perl\bin, or perhaps
to C:\Perl\site\lib\auto\DBD\mysql\, where mysql.dll lives.
--
best regards,
randy kobes
------------------------------
Date: Fri, 07 Feb 2003 23:40:23 GMT
From: Robert Young <rob@webteacher.com>
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <3E4444AF.F36ECAC5@webteacher.com>
Thanks for that. That was a typo in the post, but I had the path right when I
was
doing it. I've gotten several helpful e-mails now with ideas for getting the
DBD::mysql
module to run under version 5.8 using the repository at uwinnipeg.ca, but that
would
only fix one of the 1600 modules which is missing from the 5.8 repository. At
this
time I would much rather revert back to 5.6.1 so I can take advantage of the
3000+
perl modules on ActiveWare's PPM server that install right the first time.
Can't anyone think why "install DBD-mysql" used to work great under ActivePerl
5.6.1,
but now that I've upgraded to 5.8, uninstalled, and reinstalled 5.6.1 it gives
me the
"incorrect build" error?
Randy Kobes wrote:
> On Fri, 07 Feb 2003 19:00:37 GMT, Robert Young <rob@webteacher.com> wrote:
> >Hi All;
> >This is my first time posting. I have searched the archives and FAQs and
> >could not find
> >a solution. I hope someone on this board can help. I have been a happy
> >user of ActivePerl
> >for a long time and I recommend it whenever possible. The summary of my
> >question is
> >this:
> >
> >I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
> >install DBD-mysql
> >I get a message that the module was found but is is not built for my
> >version of Perl.
> >
> >Here are the details:
> >
> >My box is a PIII750mhz/512mb w/ W2KPro
> >
> >First I upgraded to ActivePerl 5.8.0 (I ran the Windows uninstaller
> >first from "Add/Remove programs"
> >first to clean out ActivePerl 5.6.1).
> >
> >I found, unfortunately, that the PPM repository for build 5.8.0 is
> >missing many of the modules I needed,
> >including DBD::mysql and Tk::JPEG. In fact, according to the lists at
> >http://ppm.activestate.com/PPMPackages/zips,
> >there are 3296 modules in the 5.6.x archive, and only 1665 modules in
> >the 5.8.x archive.
> >
> >For the DBD::mysql problem, it didn't take long to find numerous posts
> >referring to the
> >PPM repository at uwinnipeg.ca that the author of DBD-mysql
> >hosts with the module for 5.8, but even after I ran the PPM install for
> >it and added c:\mysql\bin\opt to my PATH, I still
> >had problems. For one I kept getting "could not load
> >c:\perl\site\lib\DBD\mysql.dll", even though it was right there at the
> >specified location.
>
> Is "c:\mysql\bin\opt" the location on your system where
> libmySQL.dll is? Or should that be "c:\mysql\lib\opt"?
> If adding that directory to your PATH doesn't work,
> which it might not in a web environment, try copying
> libmySQL.dll to some place like C:\Perl\bin, or perhaps
> to C:\Perl\site\lib\auto\DBD\mysql\, where mysql.dll lives.
>
> --
> best regards,
> randy kobes
--
------------------------------------------------
Webteacher Software, LLC
'Webdata' - the first EASY database for the web
'JavaScript for the Total Non-Programmer'
'CGI for the Total Non-Programmer'
http://www.webteacher.com
mailto:sales@webteacher.com
------------------------------------------------
------------------------------
Date: Fri, 7 Feb 2003 23:26:30 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <ay01a.38868$7_.165223@news1.mts.net>
"Robert Young" <rob@webteacher.com> wrote in message
news:3E4444AF.F36ECAC5@webteacher.com...
[ ... ]
> Can't anyone think why "install DBD-mysql" used to work great under
> ActivePerl 5.6.1, but now that I've upgraded to 5.8, uninstalled, and
> reinstalled 5.6.1 it gives me the "incorrect build" error?
I'm not familiar enough with what goes on with an "uninstall", but it may
be that the directories are not completely wiped clean, and the reinstall
may be picking up some remnants of the earlier installation. In
particular, some files (eg, ppm.xml) may be left over. What if you
try uninstalling again, and then remove the desired installation
directory before reinstalling?
best regards,
randy kobes
------------------------------
Date: Sat, 08 Feb 2003 12:02:26 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <lbs94v02kjrqtsm6v24g4nsq9jgn52diol@4ax.com>
Robert Young wrote:
>I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
>install DBD-mysql
>I get a message that the module was found but is is not built for my
>version of Perl.
That sounds as if the settings for PPM for the repository are wrong.
Perhaps those settings for 5.8 have stuck. Try checking/setting it
manually. Type "help" in PPM, or looks at the docs for PPM to find out
how.
--
Bart.
------------------------------
Date: Mon, 10 Feb 2003 07:49:37 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <3e47590b.236602828@news.grnet.gr>
On Fri, 07 Feb 2003 19:00:37 GMT, Robert Young <rob@webteacher.com>
wrote:
>I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
>install DBD-mysql
>I get a message that the module was found but is is not built for my
>version of Perl.
> Error installing package 'DBD-mysql': Read a PPD for 'DBD-mysql',
>but it is not intended for this build of Perl (MSWin32-x86-multi-thread)
I've been getting exactly this problem recently trying to install
CGI::Session or Apache::Session with ppm.
I'm using perl 5.6.1 on Windows 2000 and I haven't upgraded or
downgraded at all.
Does anybody know what's going on?
Phil
--
Ignore coming events if you wish to send me e-mail
------------------------------
Date: 10 Feb 2003 15:24:50 GMT
From: randy@theoryx5.uwinnipeg.ca (Randy Kobes)
Subject: Re: ActivePerl, upgraded then downgraded, problems!
Message-Id: <slrnb4fglg.3gd.randy@theoryx5.uwinnipeg.ca>
On Mon, 10 Feb 2003 07:49:37 GMT,
Philip Lees <pjlees@ics.forthcomingevents.gr> wrote:
>On Fri, 07 Feb 2003 19:00:37 GMT, Robert Young <rob@webteacher.com>
>wrote:
>
>>I upgraded to 5.8, then downgraded to 5.6.1, and now when I run in ppm:
>>install DBD-mysql
>>I get a message that the module was found but is is not built for my
>>version of Perl.
>> Error installing package 'DBD-mysql': Read a PPD for 'DBD-mysql',
>>but it is not intended for this build of Perl (MSWin32-x86-multi-thread)
>
>I've been getting exactly this problem recently trying to install
>CGI::Session or Apache::Session with ppm.
>
>I'm using perl 5.6.1 on Windows 2000 and I haven't upgraded or
>downgraded at all.
>
>Does anybody know what's going on?
The message about "not intended for this build ..." means
that ppm found a ppd file whose name matched what you were
after, but the ARCHITECTURE tag in the ppd file didn't
correspond to your system.
--
best regards,
randy kobes
------------------------------
Date: Fri, 07 Feb 2003 23:27:11 -0000
From: Rocco Caputo <troc@netrus.net>
Subject: ANNOUNCEMENT: POE 0.25 Released
Message-Id: <3e443d6c_2@news.teranews.com>
Keywords: multitasking, networking, framework, components, robust, cool
--------
Rejoice!
--------
Version 0.25 of the POE networking and multitasking framework has been
released. Thanks go out to everyone who assisted in its development,
especially our new committers and testers.
- ActivePerl 5.8.0 is supported. Changes in AS Perl 5.8.0 had broken
ioctl() calls to stop sockets from blocking. Tk also has confirmed
breakage under ActivePerl 5.8.0, and it has been worked around
until ActiveState can resolve the problem.
- Gentoo Linux is supported. Gentoo's version of Perl includes some
signals which ought not be there, causing segmentation faults. POE
now avoids those signals.
- TCP clients and servers now support different kinds of sessions
(Session, NFA, and custom types). This enables more interesting
network applications without much increase in complexity.
- TCP servers now gracefully handle aborted connections. Previously
they would shut down under heavy load.
- TCP client and server components have more configuration options.
- Several unimplemented features in Wheel::Run have been completed.
- POE::Kernel's call() honors array vs. scalar context now.
- A garbage collection test was removed from version 0.24, causing
POE to sometimes not exit on its own. It has been replaced.
- A leak in the signal dispatcher has been fixed. Terminal signals
should stop sessions at the proper times now.
As if that wasn't enough, POE's web site contains detailed change logs
for every public release ever.
- http://poe.perl.org/?POE_CHANGES
Even now the latest tarball should be hurtling towards your favorite
CPAN mirror. It is also on the web, and so is a Windows PPD. Users
who need advanced notice of changes can follow it via anonymous CVS or
POE's mailing list.
- http://poe.perl.org/?Where_to_Get_POE
- http://poe.perl.org/?POE_Support_Resources
Thanks again to everyone who helped with this release. Keep the
feedback and patches coming.
---------
About POE
---------
POE is a networking and multitasking framework for Perl. It has been
in active development since 1996, with its first open release in 1998.
The Perl Conference (now OSCON) named POE "Best New Module" in 1999.
- http://poe.perl.org/?What_POE_Is
POE's users and developers continue to improve and build upon it. See
the CPAN for the most up-to-date list of POE based modules.
- http://search.cpan.org/search?mode=module&query=POE::Component
POE's robustness and performance have made it an integral part of
mission critical applications since its first release. It is used in
several fields and in projects ranging from just a few lines of code
to tens of thousands.
- Financial:
Market servers, clients, billing systems, and automated trading
agents.
- Web:
Commerce servers, content management systems, application servers,
data warehouses, WAP proxies, ad exchanges, web crawlers/spiders,
and a variety of specialized agents.
- System Administration:
Large-scale host monitors and maintenance agents, distributed load
testers, a distributed file system (InterMezzo), radius monitors,
system log managers and reports, and spam detectors.
- Entertainment:
Interactive TV servers; mp3 jukeboxes and streaming servers; game
server monitors, managers, and tournament controllers; and a
plethora of IRC applications and agents (bots).
- Software Development:
Compile farm managers, build managers, distributed testing
frameworks.
- Monitoring and Automation:
X10 home control systems, weather station monitors, alarm monitors.
We look forward to hearing how POE has helped you.
-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
------------------------------
Date: Fri, 07 Feb 2003 14:22:07 -0500
From: Joel Konkle-Parker <j.j.konkle-parker@larc.nasa.gov>
Subject: Argument detection not working
Message-Id: <3E44075F.1050407@larc.nasa.gov>
I'm trying to detect for a '-h' argument to spit out a help list. Here's
my beginning of my script...
----------
#!/bin/perl -w
use strict;
my ($filename, $rawfilename, $span, $ls_spacing, $lc_spacing,
$ts_spacing, $tc_spacing, $outboard_chord, $grid_type);
$ENV{PATH} = "/bin:/usr/local/bin";
#####################
# Argument handling
#####################
for (my $i=0; $i<$#ARGV; $i++) {
if ($ARGV[$i] eq '-f') {
$rawfilename = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-s') {
$span = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-oc') {
$outboard_chord = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-ls') {
$ls_spacing = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-lc') {
$lc_spacing = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-ts') {
$ts_spacing = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-tc') {
$tc_spacing = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-gt') {
$grid_type = $ARGV[$i+1];
}
if ($ARGV[$i] eq '-h') {
print STDOUT<<'HELPTEXT';
Command line arguments:
-f output file name, no extension
-s span of wing as multiple of chord
(e.g. 2 means the span will be twice the chord)
-oc outboard chord length (inboard chord is 1.0000)
-gt grid type (s = structured, u = unstructured)
-ls point spacing - leading edge, spanwise
-lc point spacing - leading edge, chordwise
-ts point spacing - trailing edge, spanwise
-tc point spacing - trailing edge, chordwise
HELPTEXT
exit;
}
}
unless (defined $rawfilename) {
print "Enter output file name (no extension): ";
$rawfilename = <STDIN>;
chomp ($rawfilename);
}
unless (defined $span) {
print "Enter span of wing, as multiple of chord: ";
$span = <STDIN>;
chomp ($span);
}
unless (defined $outboard_chord) {
print "Enter chord at tip of wing (root chord is 1.0000): ";
$outboard_chord = <STDIN>;
chomp ($outboard_chord);
}
unless (defined $grid_type) {
print "Enter type of grid to generate (u for unstructured, s for
structured): ";
$grid_type = <STDIN>;
chomp ($grid_type);
}
.
.
.
stuff
.
.
.
----------
When the script is run with just 'scriptname.pl -h', it starts asking
the questions defined in the 'unless' sections, and doesn't display any
help. What's wrong?
- Joel
------------------------------
Date: Fri, 07 Feb 2003 19:41:25 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Argument detection not working
Message-Id: <x74r7fho9n.fsf@mail.sysarch.com>
use one of the standard option munging modules that come with perl. or
use one of the many on cpan. but please don't roll your own.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
------------------------------
Date: Fri, 07 Feb 2003 15:19:38 -0500
From: Joel Konkle-Parker <j.j.konkle-parker@larc.nasa.gov>
Subject: Re: Argument detection not working
Message-Id: <3E4414DA.5030504@larc.nasa.gov>
Uri Guttman wrote:
> use one of the standard option munging modules that come with perl. or
> use one of the many on cpan. but please don't roll your own.
>
> uri
>
>
such as?
------------------------------
Date: Fri, 07 Feb 2003 15:24:53 -0500
From: Joel Konkle-Parker <j.j.konkle-parker@larc.nasa.gov>
Subject: Re: Argument detection not working
Message-Id: <3E441615.9000207@larc.nasa.gov>
Uri Guttman wrote:
> use one of the standard option munging modules that come with perl. or
> use one of the many on cpan. but please don't roll your own.
>
> uri
>
>
And why not, anyway? I mean except for -h, my system works beautifully.
------------------------------
Date: Fri, 07 Feb 2003 20:36:34 GMT
From: Andrew Lee <spamtrap@nowhere.com>
Subject: Re: Argument detection not working
Message-Id: <l6684vk7os41j5l8f5pe1el6e5okfnrn6g@4ax.com>
On Fri, 07 Feb 2003 14:22:07 -0500, Joel Konkle-Parker
<j.j.konkle-parker@larc.nasa.gov> wrote:
>I'm trying to detect for a '-h' argument to spit out a help list. Here's
>my beginning of my script.
use Getopt::Std;
------------------------------
Date: Fri, 7 Feb 2003 12:40:53 -0800
From: "Mothra" <mothra@nowhereatall.com>
Subject: Re: Argument detection not working
Message-Id: <3e441849@usenet.ugs.com>
"Joel Konkle-Parker" <j.j.konkle-parker@larc.nasa.gov> wrote in message
news:3E4414DA.5030504@larc.nasa.gov...
> Uri Guttman wrote:
>
> > use one of the standard option munging modules that come with perl. or
> > use one of the many on cpan. but please don't roll your own.
> >
> > uri
> >
> >
>
> such as?
>
use Getopt::Long;
or
use Getopt::Std;
Mothra
------------------------------
Date: Fri, 07 Feb 2003 20:38:27 GMT
From: Andrew Lee <spamtrap@nowhere.com>
Subject: Re: Argument detection not working
Message-Id: <38684vsgd4r1fm6ov0hoeand0vnaj01nap@4ax.com>
On Fri, 07 Feb 2003 15:24:53 -0500, Joel Konkle-Parker
<j.j.konkle-parker@larc.nasa.gov> wrote:
>Uri Guttman wrote:
>
>> use one of the standard option munging modules that come with perl. or
>> use one of the many on cpan. but please don't roll your own.
>>
>> uri
>>
>>
>
>And why not, anyway? I mean except for -h, my system works beautifully.
You can save yourself time and energy by using modules. You can always
rewrite a module if you have more functionality to add.
------------------------------
Date: 08 Feb 2003 11:01:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Argument detection not working
Message-Id: <slrnb49osq.sb.abigail@alexandra.abigail.nl>
Uri Guttman (uri@stemsystems.com) wrote on MMMCDXLVII September MCMXCIII
in <URL:news:x74r7fho9n.fsf@mail.sysarch.com>:
``
`` use one of the standard option munging modules that come with perl. or
`` use one of the many on cpan. but please don't roll your own.
``
That doesn't help explaining why his code is wrong. See my other post.
Abigail
--
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";
------------------------------
Date: 08 Feb 2003 11:04:48 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Argument detection not working
Message-Id: <slrnb49p2g.sb.abigail@alexandra.abigail.nl>
Joel Konkle-Parker (j.j.konkle-parker@larc.nasa.gov) wrote on MMMCDXLVII
September MCMXCIII in <URL:news:3E44075F.1050407@larc.nasa.gov>:
""
"" for (my $i=0; $i<$#ARGV; $i++) {
This is the problem. $#ARGV is the index of the last element. If you
want to inspect the last element as well, you need to write either:
for (my $i=0; $i<=$#ARGV; $i++) {
or
for (my $i=0; $i<@ARGV; $i++) {
Of course, you do have other problems as well. You are inspecting
each argument, even the values belonging to the options. You are
also not checking to see whether @ARGV is large enough if you
access $ARGV [$i + 1].
Abigail
--
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'
------------------------------
Date: Sun, 09 Feb 2003 20:38:05 GMT
From: piet <pdhze@yahoo.co>
Subject: backup a text file
Message-Id: <Usenet.stmpcqmm@localhost>
what is the code to backup a plain text file containing max. 300 lines.
I found it on the internet but did not bookmark it so and can't find
it anymore.
Thanks
Piet
------------------------------
Date: 09 Feb 2003 22:56:19 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: backup a text file
Message-Id: <slrnb4dn4j.2re.abigail@alexandra.abigail.nl>
piet (pdhze@yahoo.co) wrote on MMMCDXLIX September MCMXCIII in
<URL:news:Usenet.stmpcqmm@localhost>:
|| what is the code to backup a plain text file containing max. 300 lines.
|| I found it on the internet but did not bookmark it so and can't find
|| it anymore.
There's no one particular command to backup a file. It all depends.
What is your backup solution? Maybe it's mere existence means it'll
be part of the nightly backup.
What on earth does this have to do with Perl anyway?
Abigail
--
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
------------------------------
Date: Sun, 9 Feb 2003 17:07:22 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: backup a text file
Message-Id: <slrnb4dnpa.td.tadmc@magna.augustmail.com>
piet <pdhze@yahoo.co> wrote:
> what is the code to backup a plain text file
1) cp important.file important.file.bak
or
2) perl -MFile::Copy -e "copy 'important.file', 'important.file.bak'"
or
3)
-----------------------
#!/usr/bin/perl
use strict;
use warnings;
open IN, 'important.file' or die "could not open 'important.file' $!";
open OUT, '>important.file.bak' or die "could not open 'important.file.bak' $!";
print OUT while <IN>;
close IN;
close OUT;
-----------------------
If those don't do it, then maybe you should share what OS you use,
and what media you have for writing backups to.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 4530
***************************************