[18155] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 323 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 20 21:05:36 2001

Date: Tue, 20 Feb 2001 18:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982721110-v10-i323@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 20 Feb 2001     Volume: 10 Number: 323

Today's topics:
    Re: (OFF TOPIC) Re: This is driving me nuts and I need  <gaverth@home.com>
    Re: Can't get a value from microsoft access using win32 <jhelman@wsb.com>
    Re: Change unknown filenames <bart.lateur@skynet.be>
        Difficult Split Question (Christopher Burke)
    Re: Difficult Split Question (Mahesh A)
    Re: Difficult Split Question (Eric Bohlman)
    Re: FAQ 4.49:   How do I permute N elements of a list? (Chris Fedde)
    Re: FAQ 4.49:   How do I permute N elements of a list? <godzilla@stomp.stomp.tokyo>
    Re: How can I use template files? <mischief@velma.motion.net>
    Re: inconsistent behavior in CGI->param()? <fchanny@lbl.gov>
        Is this taint example correct? <ddunham@redwood.taos.com>
    Re: Is this taint example correct? (Michael Fuhr)
    Re: MacPerl help for a newbie <bart.lateur@skynet.be>
    Re: Need help creating a simple class. <c.manley@chello.nl>
    Re: Need help creating a simple class. <c.manley@chello.nl>
    Re: Need help creating a simple class. (Steven Smolinski)
    Re: Need help creating a simple class. <c.manley@chello.nl>
        Perl PATH <shino_korah@yahoo.com>
    Re: Perl PATH <bmb@ginger.libs.uga.edu>
        SW processes don't finish, HELP!!! <mackiew@seciu.edu.uy>
        using lwp::useragent (LDHOLMES4)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 20 Feb 2001 23:46:17 GMT
From: "Tim Gaverth" <gaverth@home.com>
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <dlDk6.109803$B6.26243374@news1.rdc1.md.home.com>


Frank Miller <no@email.com> wrote in message
news:PMXj6.441520$U46.13025111@news1.sttls1.wa.home.com...
> >"Abigail" <abigail@foad.org> wrote in message
> news:slrn990fvd.ph4.abigail@tsathoggua.rlyeh.net...
>
> > If you manage to remain oblivous of the FAQ doing what Frank claimed to
> > do, what good is it to answer his questions? He'll probably miss the
> > answers anyway.
> >
>
> I think responses like this pretty much prove my point.
>
> FrankM
>
Since I posted the original drivel that started this completely off topic
discussion, I'll pipe up again. While I was devastated by being killfiled by
the prolific and cool JAPH writer Abigail, I believe I learned my lesson. In
the grand scheme of things, getting plonked isn't going to destroy me or my
career. I still write programs, and I still use perl to do it, and I still
read this ng.
I also figured out my original problem myself, after a couple of pointers
and another day or so. So let it go. Follow the rules, and we'll all be
better for it. Conform, be assimilated, whatever.

--
Aloha,
Tim





------------------------------

Date: Wed, 21 Feb 2001 01:59:53 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Can't get a value from microsoft access using win32::ODBC
Message-Id: <ir769t80mj5gnlnfq5emfpge69dglc9k6j@4ax.com>

On Tue, 20 Feb 2001 16:39:27 GMT, "Denis Hudon"
<mortarandpestle@hotmail.com> wrote:

>Below is a Perl script and the HTML code it generates.  For some reason,
>$Status remains undefined, generating an empty set of HTML paragraph tags at
>line 15.  I know that I'm connecting to the database correctly, because the
>other two pieces of data come through alright.  In my access database, I am
>sure that I have a field in the table 'Users' identified as 'Status,' using
>the same spelling and capitalization as the code below.

Why not let make sure?

my $DataInput = new Win32::ODBC("NorthwayExchange");
if ($DataInput->Sql("SELECT First_Name, Last_Name, Status FROM Users
WHERE UserID = 'Hudon1'")) {
    print "SQL Query Failed!\n";
    print $DataInput->Error();
} else {
    my %Hash = $DataInput->DataHash();
    foreach (sort keys %Hash) {
        print "$_ = $Hash{$_}\n";
    }
}

This will print a list of all the defined key-value pairs returned by
the database.  I'm betting that Status either won't be there, will be
their with different capitalization, or will have an undefined value.

>1   $DataInput = new Win32::ODBC("NorthwayExchange");
>2   $DataInput->Sql("SELECT First_Name, Last_Name, Status FROM Users WHERE
>UserID = 'Hudon1'");
>3   $DataInput->FetchRow();
>4   %AccessPageData = $DataInput->DataHash("First_Name", "Last_Name",
>"Status");
>5   $FirstName = $AccessPageData {First_Name};
>6   $LastName = $AccessPageData {Last_Name};
>7   $Status = $AccessPageData {Status};
>8   $DataInput->Close();

First off, please don't number your lines.  This isn't BASIC.  It just
makes your code harder to test since users will have to take out the
line numbers manually.

Secondly, by first defining a hash and then defining individual
scalars, you are wasting the computer's time.  How 'bout changing line
4 to read:

my ($FirstName, $LastName, $Status) = $DataInput->Data('First_Name',
'Last_Name', 'Status');

This let's you get rid of the next three lines altogether and makes
your code easier to read, too.

Hope this helps,
JH


------------------------------

Date: Tue, 20 Feb 2001 23:35:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Change unknown filenames
Message-Id: <vkv59t4itsuu2692e01qkl4m9hh6je4hbq@4ax.com>

Bart Lateur wrote:

>	use File::Find;
>	find sub {
>	    -f or return;
>	    (my $new = $_) =~ s/\.(pl|cgi|exe)$/.txt/i and
>	        rename $_, $new;
>	}, $tempdir;

Oh damned, I alway fall for this one. It won't work, because you simply
cannot declare a lexical variable ($new), assing it a value, and read
that variable again in the same statement. Solution: either make the
declaration a separate statement, or replace then "and" by a real "if",
again making the second part a separate statement.

	find sub {
	    -f or return;
	    my $new = $_;
	    $new =~ s/\.(pl|cgi|exe)$/.txt/i and
	        rename $_, $new;
	}, $tempdir;

or

	find sub {
	    -f or return;
	    if((my $new = $_) =~ s/\.(pl|cgi|exe)$/.txt/i) {
	        rename $_, $new;
	    }
	}, $tempdir;

-- 
	Bart.


------------------------------

Date: 21 Feb 2001 00:07:53 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Difficult Split Question
Message-Id: <904F6AF95craznar@130.102.2.1>

I have input lines of the form :

a,b,c,xyz(p,q,r),d
a,def(x,y,z),b,pqr(m,n)

I wish to split the line based on all ',' characters that are not between 
'(' and ')'.

Is there any "simple" way of doing this using split or regex or do I need 
to do some 'brute force' coding ?



------------------------------

Date: Wed, 21 Feb 2001 01:02:28 GMT
From: maheshasolkar@yahoo.com (Mahesh A)
Subject: Re: Difficult Split Question
Message-Id: <3a931340.719789933@news>

On 21 Feb 2001 00:07:53 GMT, craznar@hotmail.com (Christopher Burke)
wrote:

|I have input lines of the form :
|
|a,b,c,xyz(p,q,r),d
|a,def(x,y,z),b,pqr(m,n)
|
|I wish to split the line based on all ',' characters that are not
between 
|'(' and ')'.
|
|Is there any "simple" way of doing this using split or regex or do I
need 
|to do some 'brute force' coding ?
|

I doubt, but does this come any close? I am sure, by the time I post
this, someone must have done this in less than one line...

my $Str = "a,b,c,xyz(p,q,r),da,def(x,y,z)abc,b,pqr(m,n),s,q,l";
# my $Str = "a,b,c,xyz,s,q,l";

my @Arr = ();

if ($Str =~ /[^,]*\([^\|(^\)]+\)[^,]*/) {
    do {
        print "$`-$&-$' \n";
        push (@Arr, split (/,/, $`));
        push (@Arr, $&);
    } while ($' =~ /[^,]*\([^\|(^\)]+\)[^,]*/);
    push (@Arr, split (/,/, $'));
} else {
    push (@Arr, split (/,/, $Str));
}
map { print "$_|"; } @Arr;
print "\n";

M.


------------------------------

Date: 21 Feb 2001 01:26:17 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Difficult Split Question
Message-Id: <96v5fp$opd$1@bob.news.rcn.net>

Christopher Burke <craznar@hotmail.com> wrote:
> I have input lines of the form :

> a,b,c,xyz(p,q,r),d
> a,def(x,y,z),b,pqr(m,n)

> I wish to split the line based on all ',' characters that are not between 
> '(' and ')'.

> Is there any "simple" way of doing this using split or regex or do I need 
> to do some 'brute force' coding ?


This is actually only a minor variation of the problem of splitting 
comma-separated strings that may have quotes; it should be possible to 
adapt most of the solutions to the latter (starting with the one in 
perlfaq4) to handle it.



------------------------------

Date: Tue, 20 Feb 2001 23:52:32 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: FAQ 4.49:   How do I permute N elements of a list?
Message-Id: <4rDk6.303$zN2.188989440@news.frii.net>

In article <3A92CF52.2A31874B@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Chris Fedde wrote:
>
>I wouldn't be so quick to announce PerlFAQ a success. However
>it is appropriate to express gratitude to those who took 
>time to critique. This is professional behavior.
>

Thanks. I'll take that as a complement.  I hope that it was meant
as one.

>Your failure in professional editing is in not publishing these new FAQ
>documents for critique as well. Doing this, a pre-release of new
>documentation for further critique, is professionally prudent.
>

You may have noticed that the FAQ postings continue.  I had hoped
that this would serve as release for further review.  At the same
time it seems to me that the end of each "lap" would be a reasonable
time to provide feedback from this forum to the perl development
team.  That was my only intention. 

The FAQ survives because readers of this news group provide their
review and editorial comments.  I make my best effort to keep up
with it but am in fact all too human.  I sometimes overlook simple
mistakes.  

But the FAQ is not a professional document.  And I am obviously not a
professional writer. I must lean on the expertise of others such
as yourself for what little professional polish rubs off.

>A moderate change of topic, my presumption is your FAQ regarding
>CGI.pm and read / parse routines has been completely trash canned
>and will reflect reality, with a completely new and accurate FAQ.
>

I recall your comments on the topic.  I did in fact consider
ways to incorporate them into the answer to that question
but abandoned the effort because it required too much interpretation
of your intent.  IIRC you made some valid points.   Still the virtue
of laziness would direct one to use something like CGI.pm and
getting on with solving my problem rather than spending time to
become an expert at the CGI.  I look forward to your comments when
next that FAQ is posted.

>Incidently, what does this "Pumpking" expression mean? I am unfamiliar
>with this slang term and am a firm believer in clear and concise
>communication within a public forum. What does it mean?
>

Pumpking refers to the one who is 'holding the pumpkin' or is in
charge of the 'patch pumpkin'.  In this case it refers to the person
who reviews patches for the various parts of Perl.  You can find
out more about this by asking any web search engine.

>Godzilla!
-- 
    This space intentionally left blank


------------------------------

Date: Tue, 20 Feb 2001 18:01:58 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: FAQ 4.49:   How do I permute N elements of a list?
Message-Id: <3A932196.B434C421@stomp.stomp.tokyo>

Chris Fedde wrote:

> Godzilla! wrote:
> >Chris Fedde wrote:

> >I wouldn't be so quick to announce PerlFAQ a success. However
> >it is appropriate to express gratitude to those who took
> >time to critique. This is professional behavior.
 
> Thanks. I'll take that as a complement.  I hope that it was meant
> as one.

My comment is meant as a compliment. It is exceptionally
rare to read a simple 'thank you' within this newsgroup.
My habit is to give credit when due and appropriate. It
is also my habit to rip heads off and play soccer, when
just and appropriate.

 
> >Your failure in professional editing is in not publishing these new FAQ
> >documents for critique as well. Doing this, a pre-release of new
> >documentation for further critique, is professionally prudent.
 
> You may have noticed that the FAQ postings continue.  I had hoped
> that this would serve as release for further review.  At the same
> time it seems to me that the end of each "lap" would be a reasonable
> time to provide feedback from this forum to the perl development
> team.  That was my only intention.

This is logical if your intent is to rewrite these FAQ documents
and post them again for fresh critiques. It is always difficult
for any of us to accept critique gracefully. Some of us do, however.
Running these laps of yours, each time with a fresh new start,
each time with fresh new critiques, will clearly lead to higher
quality documentation, a reflection of pride in work. Strikes
me Perl could use an injection of old fashion Pride.

 
> The FAQ survives because readers of this news group provide their
> review and editorial comments.  I make my best effort to keep up
> with it but am in fact all too human.  I sometimes overlook simple
> mistakes.

Yes, we all overlook our simple mistakes. This is human nature
and quite understandable. This is why we have English teachers
such as myself to humiliate you for the most simple and most
human of mistakes; we English teachers are inhuman.
 
> But the FAQ is not a professional document.  And I am obviously not a
> professional writer. I must lean on the expertise of others such
> as yourself for what little professional polish rubs off.

Your diplomatic skills exceed my estimations. This is good.
Still, diplomacy rolls off my back like water on a duck. I am
very much a down and dirty nitty gritty kinda of gal; no nonsense.
Nonetheless, I am diplomatically well armed, in subtle ways.

I will adamantly disagree with your notion FAQ documents are not
professional in nature. Perl is used world wide as you know, used 
for commercial applications and does turn a profit. Perl is a business
venture and should or must reflect professionalism if Perl is to
be recognized as a bit of professional programming. I read leaders
of Perl all too often expressing your sentiments; Perl is not
professional programming nor to be taken seriously. This does
disturb me. This is a defeatist attitude which is unacceptable
by my personal standards.

Regarding your lack of professional writing skills, you do ok.
I take a firm but fair stance on language usage. This is to be
expected of an English teacher and professor. We are a tad cranky
about such matters. Nonetheless, more decades back than I care
to admit, I started out as an exceptionally ignorant and truly
penniless farm girl. My use of language was atrocious; I was a
true uneducated hick. Today this is not the case, in both respects,
language and finances. This turn about in my life is a direct
result of hard work and dedication to improvement, for decades
and decades to come. I can and did do it. So can you and others.

You will find ample self-help guides, ample reference material
on both improving writing skills and specifically, how to write
documentation correctly, available everywhere; your library,
your school and, naturally, our internet. Personally, I accept
no excuses for people not taking advantage of this plethora
of free knowledge.

> >A moderate change of topic, my presumption is your FAQ regarding
> >CGI.pm and read / parse routines has been completely trash canned
> >and will reflect reality, with a completely new and accurate FAQ.

> I recall your comments on the topic.  I did in fact consider
> ways to incorporate them into the answer to that question
> but abandoned the effort because it required too much interpretation
> of your intent.  IIRC you made some valid points.   Still the virtue
> of laziness would direct one to use something like CGI.pm and
> getting on with solving my problem rather than spending time to
> become an expert at the CGI.  I look forward to your comments when
> next that FAQ is posted.

I have no doubt you recall my comments vividly; they were caustic.
Your virtuous laziness is no excuse to disseminate false information.
Appears you dropped your diplomatic pants on this and have been caught,
red cheeked. If you use an excuse of "too much effort" to not write
documentation correctly and factually, if you use an excuse of "this
is too much work" to not write excellent Perl programs, then I will
personally fire you, after ripping your head off and playing a rather
rousing round of soccer, with your head.

Nice dialog. My hopes are blistering your bottom will encourage
you and, in turn prompt you to encourage others, to treat Perl
with respect and, to take exceptional pride in Perl. Doing this
will lead you to taking pride in all things you do, including
your own life and lifestyle.

You will discover on the final day of your life's Winter, pride
is all you will truly have, or not have.

Godzilla!


------------------------------

Date: Wed, 21 Feb 2001 01:45:01 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: How can I use template files?
Message-Id: <t967ctpmkb8h3e@corp.supernews.com>

Ameesh Oza <ameesh@interweavetech.com> wrote:
> Anno Siegel wrote:

>> Ameesh Oza  <ameesh@interweavetech.com> wrote in comp.lang.perl.misc:
> Thanks for the "tip". I am aware of what I want. My array IS a list of
> variable name strings.
> Note the comment above in parens where I have defined the array.

> $array[0] = "$var1"  and so on.

> Now I want a quick way of making $array[0] = "value of $var1";

> Essentially I am reading the variable names from a file and assigning to an
> array. Now I want the
> array to magically take on the values of the variables. Do you have the
> wand??

I don't have a wand, but I'll see what I can do without that (or a staff,
which I'd like but for which I have no budget).

The separation of the below examples is to compare the ideas they embody.
It is not intended to show the contrast among the nature of the
implementations of solutions. In fact, some come far from being complete
solutions for the OP's problem. 

### Important ###########################################################
These are examples of ideas leading up to the solution I propose, and 
are not all meant to solve the problem independently.
#########################################################################

Example a:
The following takes the contents of a line each time through the loop and
sets the next element of the array to that:

###--------------------
my @array;
while( <> ) {
    push( @array, $_ );
}
###--------------------


Example b:
The following takes the contents of a line, splits that on whitespace, then
assigns each value to an element of the array:

###-------------------------
my @array;
while( <> ) {
    push( @array, split );
}
###-------------------------


Example c:
The following takes the contents of a line, splits on whitespace,
interpolates each value, then pushes the values onto the array.
This is an overkill example comparable to solution 'c' in overall
functionality. This method, though, uses more operations and will
have a higher memory overhead:

###-------------------------
#!/usr/bin/perl -w
use strict;

my @array;
my $expletive = 'blanking';
while( <> ) {
    push( @array,  map( eval "qq{$_}", split ) );
}
foreach( @array ) {
    print $_ . "\n";
}
###-------------------------


Example d:
The following takes the contents of a line and makes any variable-like
strings in it refer to the named variables in the Perl program. The
variables are interpolated, then the contents of the line are assigned
to an array. It suffers less overhead than 'c' above, considering there
is overhead per element of the array and this uses fewer elements, but
especially considering this uses fewer Perl-level operations (which
should turn into fewer machine-level operations):

###---------------------------
#!/usr/bin/perl -w
use strict;

my @array;
my $expletive = 'blanking';

while( <> ) {
    push( @array, eval "qq/$_/" );
}
foreach( @array ) {
    print;
}
###---------------------------

There are other examples which I could compose from the specification I
read above, making different small points by example. 

From my understanding of the problem, example 'd' may be a better way
than the OP mentions to do things. One doesn't have to explicitly store
the name of a variable to store its value. If one really needs to store
both, perhaps it would be wise to use a combination of example 'a' or 'b'
and example 'd'.

What appears to be a variable to Perl is can be defined by a regex.
What appears to be a variable by which one is likely to be interested
may be easier (for example, one might make it clear that $_, $^, $/,
and the other "punctuation special variables" of Perl are not to be
used as variable names in the file). One could then find what appears
to be variables and assign those to one array while using a method
similar to example 'd' above to assign values to another. I can think
of only one reason why one would need to keep track of which variables
had been placed into templated text, and that is to make sure all of
the variables in a certain list has been sent to output (thereby making
sure the templates are complete for the current task).

Text::Template of perhaps HTML::Template should be a good thing to
explore.

If I was to home-brew my own template system (which obviously I have
done very rudimentary work on for this post), I might make sure I had
something more specific than /\$[_A-Za-z]\w+/ as a variable in 
templates so I didn't get things like q/140$USD/ or q/Micro$oft/
confusing the issue. This means choosing some sort of sentinel that
is rare in natural input to denote a variable that should be
interpolated. q/{{something_identifying_the_variable}}/ seems to be
a popular choice in other code I've seen, and is what OpenSRS uses for
their automatic domain registration scripts. I don't know if
Text::Template or HTML::Template use the same sort of thing, as I've
yet to use them. (I'm sure I will have cause to do so shortly, as my
boss requests fancier HTML to be generated by my CGIs. It seems
one-line responses are below his standards when we offer the
applications to customers as part of value-added hosting ;-)
One could then use a substitution to make sure anything matching
/{{\$.*}}/ got replaced with /$variable/ 

    s/{{(\$.*)}}/$1/eeg; ### double eval on right side of s///

which is ugly, or

    s/{{(.*)}}/$1/eeg; ### don't make this mistake!!! 

which is still really ugly and pukes on strings within double
sets of brackets which don't happen to start with q<$>, or as
OpenSRS does it,

    s/{{(.*)}}/$Hash_of_things_to_replace->{$1}/g;

which is cleaner because it doesn't need the double eval and gets
around having to worry about dollar signs in the template file since
it uses hash keys.


Doing templates yourself is possible, but the modules may be a
better course.


Chris

-- 
Christopher E. Stith
For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.



------------------------------

Date: Tue, 20 Feb 2001 17:55:51 -0800
From: Frank Hanny <fchanny@lbl.gov>
Subject: Re: inconsistent behavior in CGI->param()?
Message-Id: <3A932027.34C5D11E@lbl.gov>

Woops. Make that 5 elements in param 'b'. Sorry. Question still applies.

Frank Hanny

Frank Hanny wrote:
> 
> In the following program, I would expect the contents of parameters 'a'
> and 'b' to be the same. Instead, 'a' contains only 3 elements, while 'b'
> contains 6. Is this a bug or a feature?
> 
> Thanks,
> 
> Frank Hanny
> 
> #!/usr/local/bin/perl
> use strict;
> use CGI();
> 
> my $q;
> 
> $q = CGI->new();
> 
> $q->param( 'a', 0, undef, 1, undef, 2 );
> $q->param( -name=>'b', -value=>[ 0, undef, 1, undef, 2 ] );
> 
> print
>     $q->header(),
>     $q->start_html(),
>     $q->dump(),
>     $q->end_html();


------------------------------

Date: Tue, 20 Feb 2001 23:09:25 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Is this taint example correct?
Message-Id: <FOCk6.81$uj7.89172@news.pacbell.net>

% perl -wT -e 'system {"/bin/echo"} "Arg0", "Arg1";'
Insecure $ENV{PATH} while running with -T switch at -e line 1.
% perl -wT -e 'system {"/bin/echo"} "/Arg0", "Arg1";'
Arg1

So even though the first element of the LIST to system is not executed
or operated upon, it looks to me like it still has to pass the "relative
path" test.

Is this a bug?

I'm using 5.005_03.

Thanks!

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


------------------------------

Date: 20 Feb 2001 16:44:53 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Is this taint example correct?
Message-Id: <96uvhl$ft9@flatland.dimensional.com>

Darren Dunham <ddunham@redwood.taos.com> writes:

> % perl -wT -e 'system {"/bin/echo"} "Arg0", "Arg1";'
> Insecure $ENV{PATH} while running with -T switch at -e line 1.
> % perl -wT -e 'system {"/bin/echo"} "/Arg0", "Arg1";'
> Arg1
>
> So even though the first element of the LIST to system is not executed
> or operated upon, it looks to me like it still has to pass the "relative
> path" test.
>
> Is this a bug?
>
> I'm using 5.005_03.

I'd guess that because the program receives the first element as
argv[0], that argument needs to pass the path test.  The called program
might use argv[0] to exec itself under certain circumstances such as
a configuration change (sendmail does this, for example) -- if argv[0]
weren't taint-clean, you could have a security problem.

Just a guess.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


------------------------------

Date: Tue, 20 Feb 2001 23:40:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: MacPerl help for a newbie
Message-Id: <90069t8hck5soqf58hg91rjf65g70i7nn3@4ax.com>

mbb wrote:

>I have a number of folders containing *.wk1 files (old Lotus 123 format)
>that I need to convert to MS Excel *.xls format.

>I can't figure out how to ask it
>to rename all the file's last 3 characters to "xls".

Actually, .WK1 files and .XLS files are not the same format. So simply
changing creator and file type, and extension, is cheating. I don't care
about the creator, but you'd better leave the other properties alone.
For Windows, all you need to do is associate the file extension .WK1
with Excel.

I'd be surprised if Excel didn't do that by default, when installing. It
would be very µ-softish.

-- 
	Bart.


------------------------------

Date: Tue, 20 Feb 2001 15:25:20 GMT
From: Craig Manley <c.manley@chello.nl>
Subject: Re: Need help creating a simple class.
Message-Id: <3A928C82.A0DA5940@chello.nl>

I read the perltoot but it doesn't explain how to access class variables
as in my example. I don't want to use accessor methods, but a sort
of $dude->{'age'} = 10; thingy just as in the DBI when you say
$dbh->{AutoCommit} = 1; Setting $dbh->{AutoCommit} in the DBI causes
multiple statements to be executed instead of just setting a class
variable.




Beable van Polasm wrote:
> 
> Craig Manley <c.manley@chello.nl> writes:
> 
> > Hi all,
> >
> > I've been trying to create a test class called Person that works as
> > shown in the example below but can't get it right (using tie etc). Could
> > somebody please supply me with a simple class to get going.
> 
> Have you seen the example in "Tom's object-oriented tutorial for perl"?
> Read this:
> perldoc perltoot
> 
> cheers
> Beable van Polasm
> --
> I'm bloody tired of you nut-jobs always whining about Einstein.
>       -- Daniel Buettner
>                          IQC 78189333
> http://members.nbci.com/_______/index.html


------------------------------

Date: Tue, 20 Feb 2001 11:38:56 GMT
From: Craig Manley <c.manley@chello.nl>
Subject: Re: Need help creating a simple class.
Message-Id: <3A9257A2.ED9D9EF1@chello.nl>

I read the perltoot but it doesn't explain how to access class variables
as in my example below. I don't want to use accessor methods, but a sort
of $dude->{'age'} = 10 thingy just as in the DBI when you say
$dbh->{AutoCommit} = 1; Setting $dbh->{AutoCommit} in the DBI causes
statements to be executed instead of just setting a class variable.



Beable van Polasm wrote:
> 
> Craig Manley <c.manley@chello.nl> writes:
> 
> > Hi all,
> >
> > I've been trying to create a test class called Person that works as
> > shown in the example below but can't get it right (using tie etc). Could
> > somebody please supply me with a simple class to get going.
> 
> Have you seen the example in "Tom's object-oriented tutorial for perl"?
> Read this:
> perldoc perltoot
> 
> cheers
> Beable van Polasm
> --
> I'm bloody tired of you nut-jobs always whining about Einstein.
>       -- Daniel Buettner
>                          IQC 78189333
> http://members.nbci.com/_______/index.html


------------------------------

Date: Wed, 21 Feb 2001 01:51:20 GMT
From: sjs@linux.ca (Steven Smolinski)
Subject: Re: Need help creating a simple class.
Message-Id: <slrn996c85.62g.sjs@ragnar.stevens.gulch>

Craig Manley <c.manley@chello.nl> wrote:
> I read the perltoot but it doesn't explain how to access class variables
> as in my example below. I don't want to use accessor methods, but a sort
> of $dude->{'age'} = 10 thingy just as in the DBI when you say
> $dbh->{AutoCommit} = 1; Setting $dbh->{AutoCommit} in the DBI causes
> statements to be executed instead of just setting a class variable.

So you *don't* want to use a method, like $dude->age(10), but you want to 
'set class variables' which 'causes statements to be executed.'  Right.
Why not just use a method?  They kill your dog or something?  Proper
tool for hte job and all that.

I haven't written a DBD:: module, but I'd be mighty impressed if just
changing a variable through a hashref (as in $dude->{variable})
triggered code.  More likely, the value would just be checked on the
next method call.  But if this is the behaviour you desire, the DBI and
DBD code is there for you.

Steve
-- 
Steven Smolinski => http://www.steven.cx/


------------------------------

Date: Wed, 21 Feb 2001 02:01:01 GMT
From: Craig Manley <c.manley@chello.nl>
Subject: Re: Need help creating a simple class.
Message-Id: <3A932127.E1F9065E@chello.nl>

> Craig Manley <c.manley@chello.nl> wrote:
> > I read the perltoot but it doesn't explain how to access class variables
> > as in my example below. I don't want to use accessor methods, but a sort
> > of $dude->{'age'} = 10 thingy just as in the DBI when you say
> > $dbh->{AutoCommit} = 1; Setting $dbh->{AutoCommit} in the DBI causes
> > statements to be executed instead of just setting a class variable.
> 
> So you *don't* want to use a method, like $dude->age(10), but you want to
> 'set class variables' which 'causes statements to be executed.'  Right.
> Why not just use a method?  They kill your dog or something?  Proper
> tool for hte job and all that.

Well I just want to know how that works. That would then be similar to
how properties work in Kylix / Delphi.

> I haven't written a DBD:: module, but I'd be mighty impressed if just
> changing a variable through a hashref (as in $dude->{variable})
> triggered code.  More likely, the value would just be checked on the
> next method call.  But if this is the behaviour you desire, the DBI and
> DBD code is there for you.

If $dbh->{AutoCommit} == 0 and then you go and set it to 1, you'll cause
a database commit to be executed and you'll therefore be impressed. If I
could have figured out how the DBI does it then I wouldn't have posted
my question.

So far no help.


------------------------------

Date: Tue, 20 Feb 2001 16:44:20 -0800
From: "terminalsplash" <shino_korah@yahoo.com>
Subject: Perl PATH
Message-Id: <96v315$3ui@news.or.intel.com>

Hi

Can anyone help me with the Perl path.. Suppose I want to edit th path ie
@INC /usr/lib/perl/.....

How to edit that? Is that in a config file or some thing?If yes where is
taht file?

Thanks




------------------------------

Date: Tue, 20 Feb 2001 20:19:22 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Perl PATH
Message-Id: <Pine.A41.4.21.0102202018250.11360-100000@ginger.libs.uga.edu>

On Tue, 20 Feb 2001, terminalsplash wrote:
> Can anyone help me with the Perl path.. Suppose I want to edit th path ie
> @INC /usr/lib/perl/.....
> 
> How to edit that? Is that in a config file or some thing?If yes where is
> taht file?

Try perldoc lib

Brad



------------------------------

Date: Tue, 20 Feb 2001 21:40:52 -0300
From: "andres mackiewicz" <mackiew@seciu.edu.uy>
Subject: SW processes don't finish, HELP!!!
Message-Id: <96u64p$td5$1@vaimaca.rau.edu.uy>

I have a Perl program that creates parallel processes.
During its execution some of these processes get the "SW" state, what I see
executing the "ps" command.
Most times, after being a while in this state, the processes return to their
normal execution, but sometimes one of them remains in "SW" state forever
(this is, more than 12 hours when the normal duration is about 1 hour),
having to terminate it with the "kill" command.

I'd like to know why a process can get this state, how to avoid it or taking
it out from such state.

Thanks so much...







------------------------------

Date: 21 Feb 2001 01:57:04 GMT
From: ldholmes4@aol.com (LDHOLMES4)
Subject: using lwp::useragent
Message-Id: <20010220205704.04305.00000753@ng-ck1.aol.com>

  I am trying out LWP::UserAgent as described in the lwpcookbook. As an example
I am 
trying a search on Lycos. However when I run scripts 2 and 3 (as shown below),
Lycos returns a
500 Internal Server Error. When I run script 1 with LWP::Simple I get the page
I expect. Does anyone know what I am doing wrong. 
   I am running ActivePerl 5.6 on a PC under Windows 98. Also I have the
libwww-perl installed. 

Thanks

Script 1
---------
use LWP::Simple;
use URI::URL;

$url = url('http://www.lycos.com/srch/');

$url->query_form(query => 'ghost');

$html = get($url);

print $html;
 
Script 2 
-----------------------
use HTTP::Request::Common qw(POST); 
use LWP::UserAgent;

$ua = LWP::UserAgent->new;


my $req = POST 'http://www.lycos.com/srch/',
   [query => 'ghost'];

print $ua->request($req)->as_string;

Script 3
--------------------
use LWP::UserAgent;
$ua = LWP::UserAgent->new;

my $req = HTTP::Request->new(POST => 'http://www.lycos.com/srch/');

$req->content_type('application/x-www-form-urlencoded');
$req->content('query=ghost');
my $res = $ua->request($req);

print $res->as_string;


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 323
**************************************


home help back first fref pref prev next nref lref last post