[21802] in Perl-Users-Digest
Perl-Users Digest, Issue: 4006 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 21 14:05:54 2002
Date: Mon, 21 Oct 2002 11:05:10 -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 Mon, 21 Oct 2002 Volume: 10 Number: 4006
Today's topics:
Actions on PDF files <anthony.heuveline@wanadoo.fr>
Re: Actions on PDF files <wsegrave@mindspring.com>
Array List Output (BUCK NAKED1)
Re: Array List Output <kurzhalsflasche@netscape.net>
Re: Array List Output <nobull@mail.com>
Re: Array List Output <Graham.T.Wood@oracle.com>
Re: Array List Output <mbudash@sonic.net>
Columns Limit (Naser El-Bathy)
Re: cyrpt() and other questions.... (Tad McClellan)
Re: cyrpt() and other questions.... (Bryan Castillo)
Re: cyrpt() and other questions.... <krahnj@acm.org>
Re: DBI module INSERT command problem <pilsl_use@goldfisch.at>
Re: exclusive execution of a perl script <jason@baugher.pike.il.us>
Re: exclusive execution of a perl script <jason@baugher.pike.il.us>
Re: Handling Arguments passed to script <hari_yarlagadda@adc.com>
Re: maximum string length with the system command (Richard Hospital)
Object-Oriented Question (Brian Green)
Re: Object-Oriented Question (tî'pô)
Re: Object-Oriented Question <ubl@schaffhausen.de>
Re: Object-Oriented Question (Tad McClellan)
Re: Object-Oriented Question <nobull@mail.com>
Re: perl CGI call java class problem (Tad McClellan)
Re: removing commas in an element of an array of csv fi (Doggy)
Re: Stopping IIS website <dvassilev_NO_SPAM_@tlogica.com>
while loop to stop take #2 <kashmirnospam@bellnet.ca>
Re: while loop to stop take #2 <jason@baugher.pike.il.us>
Re: while loop to stop take #2 <pinyaj@rpi.edu>
Re: while loop to stop take #2 <mbudash@sonic.net>
Re: while loop to stop take #2 (Tad McClellan)
Re: while loop to stop take #2 <pinyaj@rpi.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Oct 2002 17:29:46 +0200
From: "Anthony" <anthony.heuveline@wanadoo.fr>
Subject: Actions on PDF files
Message-Id: <ap16c8$2ma$1@news-reader10.wanadoo.fr>
Hi,
I'd like to provide my website visitors with two ways of using PDF
files: The first one is opening the file in their web browser using a button
called "See" and the other way is to force the opening of the save as dialog
with a another button called "Download".
Thanks for your help.
Anthony.
------------------------------
Date: Mon, 21 Oct 2002 12:06:24 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Actions on PDF files
Message-Id: <ap1ca8$dor$3@slb6.atl.mindspring.net>
"Anthony" <anthony.heuveline@wanadoo.fr> wrote in message
news:ap16c8$2ma$1@news-reader10.wanadoo.fr...
> Hi,
>
> I'd like to provide my website visitors with two ways of using PDF
> files: The first one is opening the file in their web browser using a
button
> called "See" and the other way is to force the opening of the save as
dialog
> with a another button called "Download".
>
This is not a Perl question.
One simple way is:
To "see" the PDF file, click on the link with the left mouse button. To
download the file, click on the link with the right mouse button. If you
_must_ have separate links, then provide them, one labeled "See" and one
labeled "Download", with the appropriate links, also not a Perl issue.
Bill Segraves
------------------------------
Date: Sat, 19 Oct 2002 07:07:56 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Array List Output
Message-Id: <8734-3DB14B1C-423@storefull-2272.public.lawson.webtv.net>
I have the following list in an array.
@dirs = ("home/", "user/", "demo/", "style/");
I want to print out the following from the above array.
home/
home/user/
home/user/demo/
home/user/demo/style/
What do I need to add to
for (@dirs) {
print "$_\n";
}
to get it that output?
Regards,
Dennis
------------------------------
Date: Mon, 21 Oct 2002 18:37:33 +0200
From: Dominik Seelow <kurzhalsflasche@netscape.net>
Subject: Re: Array List Output
Message-Id: <3DB42D4D.4050902@netscape.net>
BUCK NAKED1 announced:
> I have the following list in an array.
>
> @dirs = ("home/", "user/", "demo/", "style/");
>
> I want to print out the following from the above array.
>
> home/
> home/user/
> home/user/demo/
> home/user/demo/style/
>
> What do I need to add to
>
> for (@dirs) {
> print "$_\n";
> }
>
> to get it that output?
>
>
> Regards,
> Dennis
>
>
>
>
for my $n (0..$#dirs){
print join ('',@dirs[0..$n],"\n");
}
should do
HTH,
Dominik
------------------------------
Date: 21 Oct 2002 17:36:53 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Array List Output
Message-Id: <u9d6q3bvfe.fsf@wcl-l.bham.ac.uk>
dennis100@webtv.net (BUCK NAKED1) writes:
> I have the following list in an array.
>
> @dirs = ("home/", "user/", "demo/", "style/");
>
> I want to print out the following from the above array.
>
> home/
> home/user/
> home/user/demo/
> home/user/demo/style/
>
> What do I need to add to
>
> for (@dirs) {
> print "$_\n";
> }
>
> to get it that output?
Do I smell homework? What makes you think your teacher doesn't read
comp.lang.perl.misc?
my $path='';
for (@dirs) {
$path .= $_;
print "$path\n";
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 21 Oct 2002 17:48:57 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Array List Output
Message-Id: <3DB42FF9.2FB9CCAA@oracle.com>
BUCK NAKED1 wrote:
> I have the following list in an array.
>
> @dirs = ("home/", "user/", "demo/", "style/");
>
> I want to print out the following from the above array.
>
> home/
> home/user/
> home/user/demo/
> home/user/demo/style/
>
> What do I need to add to
>
> for (@dirs) {
> print "$_\n";
> }
>
> to get it that output?
>
> Regards,
> Dennis
>
>
for (@dirs) {
$all .= $_;
print "$all\n";
}
Graham Wood
------------------------------
Date: Mon, 21 Oct 2002 16:45:39 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Array List Output
Message-Id: <mbudash-FA7E12.09453921102002@typhoon.sonic.net>
In article <8734-3DB14B1C-423@storefull-2272.public.lawson.webtv.net>,
dennis100@webtv.net (BUCK NAKED1) wrote:
> I have the following list in an array.
>
> @dirs = ("home/", "user/", "demo/", "style/");
>
> I want to print out the following from the above array.
>
> home/
> home/user/
> home/user/demo/
> home/user/demo/style/
>
> What do I need to add to
>
> for (@dirs) {
> print "$_\n";
> }
>
> to get it that output?
this sounds curiously like a school assignment, but i'll bite:
one way:
my $path;
for (@dirs) {
print ($path .= $_);
print "\n";
}
------------------------------
Date: 21 Oct 2002 09:48:00 -0700
From: nelbathy@ford.com (Naser El-Bathy)
Subject: Columns Limit
Message-Id: <38ccdbd.0210210848.1a73e757@posting.google.com>
I'm trying to write a cgi script in Perl. This script should generate
Excel version. The maiximum Excell sheet columns should be more than
700 columns.
Is it possible to do so.
Please advise.
Your assistnace is appreciated.
------------------------------
Date: Mon, 21 Oct 2002 09:12:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: cyrpt() and other questions....
Message-Id: <slrnar82r8.e4f.tadmc@magna.augustmail.com>
havoc <mike-_-@excite.com> wrote:
> Okay, i'm really new at this
^^^^
You perhaps don't realize it, but you appear to be new to "these"
rather than "this". :-)
I expect by "this" you meant writing a CGI program in Perl?
If so, there are several different "domains" involved, any one
of which may be the cause of a problem or where you lack understanding.
It will go a Really Long Way towards resolving the problem if
you can suss out what domain it is that you need to look into.
That allows you to concentrate your research (and Usenet postings)
on the area most likely to produce helpful results.
The "Big Three" domains involved in what you are trying to
accomplish are often:
Operating System (Unix in this case)
Application area (CGI in this case)
Programming Language (Perl in this case)
And when your application area happens to be CGI programming,
then a fourth factor to consider is the web server that
you are using.
Several of your questions are not about the programming language
you've chosen to write your CGI program in. They are from one
of the other domains.
You're more likely to get usable answers if you ask those
questions in a newsgroup other than the programming language's
newsgroup.
These newsgroups may be helpful to know about:
comp.os.unix
comp.security.unix
comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
> so please excuse me if my questions sound
> idiotic.
Since you've invoked the "I" word yourself, I can point you
to the URL below without the usual apology for its title :-)
"The Idiot's Guide to Solving Perl CGI Problems"
http://www.perl.com/doc/FAQs/cgi/idiots-guide.html
> I'm trying to set up my own type of 'members only area'
> without using .htpasswd.
Using .htpasswd is the "usual way" of accomplishing your task.
If it won't work for your situation, then you should tell us why.
It makes suggesting a work-around easier if we know what it is
that we must work around. :-)
> Specifically, when a user visits the member
> area, they will be asked to login or register. Once the person logs in
> I want them to be able to surf the members without having to relogin
> on each page.
Your question is about how to maintain state in the stateless
CGI protocol (it is a CGI question, not a Perl question).
> I'm not at all familiar with crypt()
I think Tassilo's followup has covered that already...
> Qustion: What exactly is the salt for?
...though he didn't answer that direct question.
(it is a Unix question, not a Perl question)
The salt is used so password-guessers must make 65536 guesses
for each password they want to try.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Oct 2002 08:06:21 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: cyrpt() and other questions....
Message-Id: <1bff1830.0210210706.3927d1b5@posting.google.com>
> Okay, i'm really new at this so please excuse me if my questions sound
> idiotic. I'm trying to set up my own type of 'members only area'
> without using .htpasswd. Specifically, when a user visits the member
> area, they will be asked to login or register. Once the person logs in
> I want them to be able to surf the members without having to relogin
> on each page. Here are my problems:
>
> I'm not at all familiar with crypt() and I found this snippet of code
> on the net:
I've used the functions in Digest::MD5 such as md5_base64, to do what
you are talking about. I've always assumed that the Digest::<X>
modules are better than using crypt. Are they? md5_base64 doesn't
use salt (at least from an application programmers point of view).
Does the "salt" provide an extra level of security?
------------------------------
Date: Mon, 21 Oct 2002 18:01:20 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: cyrpt() and other questions....
Message-Id: <3DB44107.2A50EDC3@acm.org>
Tad McClellan wrote:
>
> (it is a Unix question, not a Perl question)
>
> The salt is used so password-guessers must make 65536 guesses
> for each password they want to try.
Since crypt(3) uses printable ASCII characters (according to my man
page) it's not as high as 65536. :-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 21 Oct 2002 17:16:21 +0200
From: peter pilsl <pilsl_use@goldfisch.at>
Subject: Re: DBI module INSERT command problem
Message-Id: <3db41a47$1@e-post.inode.at>
Doug wrote:
>>
> Now for the silly question. How do you access the direct console and
> where
> is it etc.? I've never heard of that.
>
Dont know what database you are using, but I'm sure it has some frontend
where you can enter SQL-commands.
In postgres - for this is what I use - its called psql. In MS-Access there
is also some window where one can enter sql-commands, but I dont know how
to access it ..
Anyway: sorry if you felt offended. Only wanted to help debugging
SQL-processing scripts
peter
>> >
>> > Hopefully it is the same
>> > with other DBD's so that when I move this to the linux machine and use
>> > MySQL instead of Access, I'll only have to change the driver call.
>> >
>>
>> Dont hope to much. I dont know how deep you use special features, but I
>> work with mySQL and postgreSQL under linux and while the most basic
>> statements are the same, porting a program is lot of work.
>>
>> best,
>> peter
>>
>>
>>
>> --
>> peter pilsl
>> pilsl_@goldfisch.at
>> http://www.goldfisch.at
>>
>
>
>
--
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Mon, 21 Oct 2002 13:06:21 GMT
From: Jason Baugher <jason@baugher.pike.il.us>
Subject: Re: exclusive execution of a perl script
Message-Id: <Xns92AE52706C692jasonbaugherpikeilus@209.242.76.10>
"Saket Rungta" <saketrungta@hotmail.com> wrote in comp.lang.perl.misc:
> If cron runs perl script ocassionally and we need to check whether
> previous run finished, how should it be done (elegantly)?
>
> (without temp files writing usage, without killing all perl on ps
> etc.)
>
I basically know of 2 ways to do it, since you are running from cron and
hence each individual perl instance knows nothing of the others:
1) Store a value (probably the PID) somewhere to let other instances know
it's already running. This means a temp file, table value in a database,
whatever. You ruled this one out already.
2) Use 'ps' to check if the process is already running. It sounds like
you may be against this, not sure if that's what you meant by "without
killing all perl on ps".
Something that may be possible for you to do, depending on your
requirements, would be to run a single perl instance that forks off a
child instance to do the work while the parent sleeps for a specified
time. Then when the parent wakes up, it would be able to check to see if
the child had terminated yet, and if not, could either wait for it or
kill it, depending on what you want.
--
Jason Baugher
Virtual Adept Professional Consulting Services
1406 Adams Street, Quincy, IL 62301 - (217) 221-5406
jason@baugher.pike.il.us - http://baugher.pike.il.us/virtualadept
------------------------------
Date: Mon, 21 Oct 2002 13:14:21 GMT
From: Jason Baugher <jason@baugher.pike.il.us>
Subject: Re: exclusive execution of a perl script
Message-Id: <Xns92AE53CB9A26Djasonbaugherpikeilus@209.242.76.10>
Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
> The lock/semephore.
>
> Some resource (e.g. a file) is exclusively locked. This has the
> advantage (or, in some contexts, disadvantage) that if the program
> fails unexpectedly the resource is freed.
>
Good point - I forgot about this one in my other post in this thread.
--
Jason Baugher
Virtual Adept Professional Consulting Services
1406 Adams Street, Quincy, IL 62301 - (217) 221-5406
jason@baugher.pike.il.us - http://baugher.pike.il.us/virtualadept
------------------------------
Date: Mon, 21 Oct 2002 09:59:00 -0500
From: Hari Yarlagadda <hari_yarlagadda@adc.com>
Subject: Re: Handling Arguments passed to script
Message-Id: <3DB41634.2371189F@adc.com>
Hari Yarlagadda wrote:
> Hello Folks,
>
> I am trying to pass a string as an argument to a Perl script. This
> string has some metacharacters that I don't want suppressed. For
> example:
>
> \( Project 'isequal' "DVT" \)
>
> is interpreted as
>
> ( Project isequal DVT )
>
> in the ARGV array.
>
> Is there any way to suppress this behavior? Unfortunately I don't have
> control over the input string so I can't use backslashes to escape each
> of the metacharacters I want to keep.
>
> Thanks a lot for the help!
> -chad
------------------------------
Date: 21 Oct 2002 06:49:09 -0700
From: richard.hospital@st.com (Richard Hospital)
Subject: Re: maximum string length with the system command
Message-Id: <6c14c143.0210210549.55018c12@posting.google.com>
Thanks for your answer.
The command line is generated automatically and it's difficult to know
its length before the execution.
Regards.
"Tan Nguyen" <nospam@nospam.com> wrote in message news:<3db0ebbc_5@nopics.sjc>...
> "Richard Hospital" <richard.hospital@st.com> wrote in message
> news:6c14c143.0210180008.abdc307@posting.google.com...
> > Hi all,
> >
> > What is the maximum string length that can be passed to the system
> > command under PC (W2000) ? And is it possible to modify the default
> > value ?
> >
> > Thanks in advance.
>
> Umm....this has nothing to do with Perl. Theoretically, WinNT/2K allows a
> maximum of 32Kb for the entire length of a command line (program name and
> parameters). However, people has reported that it only allows 2Kb in
> practice. There is no environment setting to change this value. What would
> you like to do? There are probably much better ways than hitting a command
> stuffed with forrest of characters.
------------------------------
Date: 21 Oct 2002 06:58:35 -0700
From: brian_green_2002@hotmail.com (Brian Green)
Subject: Object-Oriented Question
Message-Id: <62a44aac.0210210558.36477c37@posting.google.com>
Dear All,
I am new to this newsgroup, so please excuse me if I step on any
toes...! :)
I have a problem with a small program I am writing which uses Perl's
OOP facilities. I declare a package type with a field of the object
defined as an array:
package myPackage;
use strict;
sub new
{
my $type = shift;
my $class = ref($type) || $type;
my $self = {};
my $self->{SIZE} = shift; #send it a value in creation....
#This is the bit which may cause some confusion....
for (my $loop = 0; $loop != $self->{SIZE} ; ++$loop)
{
$self->{GRID}[$loop] = 0; #Initiliase them all
}
bless ($self, $class);
return $self;
}
#That bit seems to be no problem.
#If I then declare a sub to read a value of any given part of the
#GRID, then I can read that with little difficulty:
sub getValue
{
my $self = shift;
my $cell = shift;
return $self->{GRID}[$cell];
}
#This returns the value of whatever was set above.
#If I try to set it, however, using a similar construct:
sub setValue
{
my $self = shift;
my $cell = shift;
my $value = shift;
$self->{GRID}[$cell] = $value;
}
#The value stays the same
return 1;
#Putting this in a new test program:
#!/usr/bin/perl -w
use strict;
use myPackage;
my $test = myPackage->new(100);
my $value = $test->getValue(50);
print $value . "\n";
$test->setValue(50, 10);
$value = $test->getValue(50);
print $value . "\n";
#####
When this is run, $value prints out to be 0 in each occasion, not 0
then 10. Is this to do with scope? Am I altering a *copy* of the
object in the setValue() sub, rather than the actual object itself? If
so, how do I send the object to the sub? I assume it would be by
address, rather than by value, and if so how is this done?
Sorry for so many questions, but this is a little confusing to me! :)
Brian Green
(Using Perl 5.8.0, btw)
------------------------------
Date: Mon, 21 Oct 2002 16:12:26 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: Object-Oriented Question
Message-Id: <ll28ru0rk6oklpffkufju1t7hfk40ibsjp@4ax.com>
Brian Green bravely attempted to attach 89 electrodes of knowledge to
the nipples of comp.lang.perl.misc by saying:
>package myPackage;
>
>use strict;
>
>sub new
>{
> my $type = shift;
> my $class = ref($type) || $type;
> my $self = {};
> my $self->{SIZE} = shift; #send it a value in creation....
# ^^ syntax error, removed
> #This is the bit which may cause some confusion....
> for (my $loop = 0; $loop != $self->{SIZE} ; ++$loop)
> {
> $self->{GRID}[$loop] = 0; #Initiliase them all
> }
<snip>
>When this is run, $value prints out to be 0 in each occasion, not 0
>then 10.
It worked for me, I was actually a bit surprised that it did, I
thought you had to initialize $self->{GRID} to be a reference to an
array ( $self->{GRID} = []; ) but apparently perl is smart enough to
figure it out by itself.
------------------------------
Date: Mon, 21 Oct 2002 17:23:41 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Object-Oriented Question
Message-Id: <ap19gh$h69$1@news.dtag.de>
Brian Green wrote:
> Dear All,
>
> I am new to this newsgroup, so please excuse me if I step on any
> toes...! :)
>
> I have a problem with a small program I am writing which uses Perl's
> OOP facilities. I declare a package type with a field of the object
> defined as an array:
>
> package myPackage;
>
> use strict;
>
> sub new
> {
> my $type = shift;
> my $class = ref($type) || $type;
> my $self = {};
> my $self->{SIZE} = shift; #send it a value in creation....
^
^
^
The last C<my> is illegal, because you are not declaring $self on that
line (You did on the line before) and you should initialize
C<$self->{GRID}> to be an arrayref if you use it like one.
Bye,
->malte
--
srand 108641088; print chr int rand 256 for qw<J A P H>
------------------------------
Date: Mon, 21 Oct 2002 10:15:08 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Object-Oriented Question
Message-Id: <slrnar86fs.ebs.tadmc@magna.augustmail.com>
Teh (tî'pô) <teh@mindless.com> wrote:
> Brian Green bravely attempted to attach 89 electrodes of knowledge to
> the nipples of comp.lang.perl.misc by saying:
>> $self->{GRID}[$loop] = 0; #Initiliase them all
> It worked for me, I was actually a bit surprised that it did, I
> thought you had to initialize $self->{GRID} to be a reference to an
> array ( $self->{GRID} = []; ) but apparently perl is smart enough to
> figure it out by itself.
It is a Perl feature called "autovivification".
See:
The "Using References" section in perlref.pod
and
http://tlc.perlarchive.com/articles/perl/ug0002.shtml
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Oct 2002 17:26:57 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Object-Oriented Question
Message-Id: <u9fzuzbvvy.fsf@wcl-l.bham.ac.uk>
brian_green_2002@hotmail.com (Brian Green) writes:
> I am new to this newsgroup, so please excuse me if I step on any
> toes...! :)
Ouch!
Rather than seeking forgiveness perhaps you should look where you are
putting your feet.
Cut/paste code into your posting. Do not re-type it.
This advice (and much more) can be found in the periodic posting
"Posting Guidelines for comp.lang.perl.misc ($Revision: 1.2 $)"
If you do re-type it you may introduce new errors. Also if the
original error was a typo there's a fair chance you'll fix it.
The code you post contains a trivial typo that causes it to crash out.
Once that is fixed it works as you intended and does not reproduce the
problem you describe.
At least it doesn't on 5.8.0-RC1 - I don't have a true 5.8.0 to test
it on.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 21 Oct 2002 08:52:15 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl CGI call java class problem
Message-Id: <slrnar81kf.dun.tadmc@magna.augustmail.com>
Hong Liang <liang@expert.ics.purdue.edu> wrote:
> On 21 Oct 2002, Tassilo v. Parseval wrote:
>> Also sprach Hong Liang:
>>
>> > I am writing a CGI with perl,
>> > No matter what I try, the CGI just can't see the java class
>> > in the same directory.
^^^^^^^^^^^^^^
Maybe it _isn't_ in the same directory.
You are using a relative, rather than absolute, path to the class file.
> Right, right, I 've tried running it from command line, everything
> worked.
When you run it from the command line, you do in fact know what
your current directory is.
When you run it in a CGI environment, the cwd might be anything,
it depends on how your web server has been setup.
> more help, please???
There is no guarantee as to what your cwd will be in a CGI
environment. It is a common problem that folks think they
know what their cwd is when they really don't.
chdir() to the correct directory before using your relative path,
or change your code to use an absolute path instead.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Oct 2002 08:36:08 -0700
From: tru64dog@yahoo.com (Doggy)
Subject: Re: removing commas in an element of an array of csv file
Message-Id: <18239c3a.0210210736.f886df2@posting.google.com>
Garry Williams <garry@ifr.zvolve.net> wrote in message news:<slrnar6lcs.iuv.garry@zfw.zvolve.net>...
> On 19 Oct 2002 12:56:04 -0700, Doggy <tru64dog@yahoo.com> wrote:
> > Below underneath my Perl code is a snip of a CSV file. I'm using the
> > split function of Perl to parse the CSV file
>
> Why not use the suggestion in the FAQ?
>
> perldoc -q split
> "How can I split a [character] delimited string except when
> inside [character]? (Comma-separated files)"
>
> use Text::ParseWords;
> @words = quotewords(",", 0, $text);
>
> See the Text::ParseWords manual page for details.
Thanks everybody, Text::ParseWords worked great!!!
------------------------------
Date: Mon, 21 Oct 2002 17:17:42 +0300
From: "Dimiter Vassilev" <dvassilev_NO_SPAM_@tlogica.com>
Subject: Re: Stopping IIS website
Message-Id: <ezypKoQeCHA.2588@tkmsftngp12>
Look at Inetpub\AdminAcripts\ directory of your IIS
There is examples start* and stop* vbs scripts
Regards Dimiter
"William Hymen" <t18_pilot@hotmail.spam.com> wrote in message
news:3NRs9.6878$U97.630709@newsread2.prod.itd.earthlink.net...
> I can stop my web server with
> Net Stop "World Wide Web Publishing Service"
>
> How do I stop an individual site from command line?
> Maybe VB or Perl?
>
> Any examples would be great.
>
> Thanks.
>
> Bill
>
>
------------------------------
Date: Mon, 21 Oct 2002 10:43:25 -0400
From: "Kashmir" <kashmirnospam@bellnet.ca>
Subject: while loop to stop take #2
Message-Id: <noUs9.2806$A12.348256@news20.bellglobal.com>
Hi,
On a previous post I requested help and many people kindly replied with
their own preferred flavour of coding. What I want to do is stop a while
loop if it reads from a text file the words "Session Number:"
I received two suggestions which are:
#1- while (<FIC>) && ($_ !~ (/^Session Number:(.*)$/)))
{
# more code in here:
}
and:
#2- last if /^Session Number:/;
The && ($_ !~ (/^Session Number:(.*)$/))) solution is not working and I
don't understand why since it is a logical and that simply say (correct me
if I'm wrong):
while fic is still readable and value in $_ is not equal to Session Number:
do something.
The while loop is simply not executed at all and it bugs me; the other
solution provided is working well. Can somebody sort it out. I have read
about && and $_ and still no light.
Kashmir
------------------------------
Date: Mon, 21 Oct 2002 15:14:56 GMT
From: Jason Baugher <jason@baugher.pike.il.us>
Subject: Re: while loop to stop take #2
Message-Id: <Xns92AE683CDBFD4jasonbaugherpikeilus@209.242.76.10>
"Kashmir" <kashmirnospam@bellnet.ca> wrote in comp.lang.perl.misc:
> #1- while (<FIC>) && ($_ !~ (/^Session Number:(.*)$/)))
> {
> # more code in here:
> }
>
> and:
>
> #2- last if /^Session Number:/;
this is probably something like:
while (FIC) {
last if /^Session Number:/;
# more code in here:
}
>
> The && ($_ !~ (/^Session Number:(.*)$/))) solution is not working and
> I don't understand why since it is a logical and that simply say
> (correct me if I'm wrong):
> while fic is still readable and value in $_ is not equal to Session
> Number:
> do something.
>
Well, you could try just "while (<FIC>)" to see if it is reading from the
file, which would tell you which part of the && is failing....
But, there are other issues here.
#1 says, read a line from FIC and if it doesn't start with "Session
Number:", do something to it. Loop back and read the next line, etc...
#2 says, (assuming it's in a "while (<FIC>) { }" loop) read a line from
FIC. If it starts with "Session Number:", drop out of the loop
completely. If it doesn't start with "Session Number:", do something to
it, and then loop back and read the next line, etc...
So, #1 will process all lines that don't start with "Session Number:",
and #2 will only process lines UNTIL it finds one that starts with
"Session Number:".
Which do you want?
--
Jason Baugher
Virtual Adept Professional Consulting Services
1406 Adams Street, Quincy, IL 62301 - (217) 221-5406
jason@baugher.pike.il.us - http://baugher.pike.il.us/virtualadept
------------------------------
Date: Mon, 21 Oct 2002 11:17:13 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: while loop to stop take #2
Message-Id: <Pine.A41.3.96.1021021111125.54190E-100000@vcmr-104.server.rpi.edu>
On Mon, 21 Oct 2002, Kashmir wrote:
>#1- while (<FIC>) && ($_ !~ (/^Session Number:(.*)$/)))
> {
> # more code in here:
> }
I hope you don't think I gave that to you. First, there's a syntax error
-- you need one more ( at the start of the conditional. Second, I told
you that reading from <FH> doesn't populate $_ unless it's there by
itself:
while (<FH>) { ... } # populates $_
while (<FH> && $this) { ... } # does not populate $_
If you do:
while (($_ = <FH>) && ($_ !~ /^Session Number:/)) { ... }
or
while (($_ = <FH>) && !/^Session Number:/) { ... }
or
while (($_ = <FH>) !~ /^Session Number:/) { ... }
you should have no problems.
--
Jeff "japhy" Pinyan RPI Acacia Brother #734 2002 Acacia Senior Dean
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: Mon, 21 Oct 2002 15:28:48 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: while loop to stop take #2
Message-Id: <mbudash-1B9D79.08284821102002@typhoon.sonic.net>
In article
<Pine.A41.3.96.1021021111125.54190E-100000@vcmr-104.server.rpi.edu>,
Jeff 'japhy' Pinyan <pinyaj@rpi.edu> wrote:
> while (<FH>) { ... } # populates $_
> while (<FH> && $this) { ... } # does not populate $_
thanks jeff... i missed that! (and i'll bet a few more of us did, too)
------------------------------
Date: Mon, 21 Oct 2002 10:30:00 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: while loop to stop take #2
Message-Id: <slrnar87bo.ebs.tadmc@magna.augustmail.com>
Kashmir <kashmirnospam@bellnet.ca> wrote:
> What I want to do is stop a while
> loop if it reads from a text file the words "Session Number:"
>
> I received two suggestions which are:
>
> #1- while (<FIC>) && ($_ !~ (/^Session Number:(.*)$/)))
That is a horrid "solution", seeing as it will not even compile.
Please post Real Perl Code, not pseudocode.
Please use copy/paste rather than attempting to retype code.
Please see the Posting Guidelines that are posted here weekly.
> The && ($_ !~ (/^Session Number:(.*)$/))) solution is not working
You must get it to compile before you can even try it to see
if it is "working".
> The while loop is simply not executed at all
Since you have not put anything into $_, that match can never succeed.
> Can somebody sort it out. I have read
> about && and $_ and still no light.
See the "I/O Operators" section in perlop.pod:
Ordinarily you must assign the returned value to a variable, but
there is one situation where an automatic assignment happens...
Your situation is not that one situation, so you must assign
it yourself:
while ( defined($_ = <FIC>) && ($_ !~ /^Session Number:/))
(the (.*)$ at the end of the pattern serves no purpose, I removed it)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 21 Oct 2002 12:02:27 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: while loop to stop take #2
Message-Id: <Pine.A41.3.96.1021021120157.54192A-100000@vcmr-104.server.rpi.edu>
On Mon, 21 Oct 2002, Michael Budash wrote:
>In article
><Pine.A41.3.96.1021021111125.54190E-100000@vcmr-104.server.rpi.edu>,
> Jeff 'japhy' Pinyan <pinyaj@rpi.edu> wrote:
>
>> while (<FH>) { ... } # populates $_
>> while (<FH> && $this) { ... } # does not populate $_
>
>thanks jeff... i missed that! (and i'll bet a few more of us did, too)
In a related note, this does populate $_:
while (<FH> && 1) { ... }
but that's because of Perl's hunky-dory constant folding.
--
Jeff "japhy" Pinyan RPI Acacia Brother #734 2002 Acacia Senior Dean
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
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 4006
***************************************