From: J. Gleixner on
Steve M wrote:
[...]
> Often times I'm working on a web site for someone where I do not have
> command line access, only web browser access, and I wish to check for
> specific modules that are a little off the beaten path, such as
> Spreadsheet::WriteExcel.
>
> In such a case, the above examples are perhaps not as 'to the point' as
> a reader might wish.
>
> I use a different (simpler?) method than any shown above, and wonder if
> it might be a good concept to include in the above options. In essence I
> run something like below.
>
> *********
>
> To construct a simple CGI script to test for module availability when
> the command line is not available, but you do have CGI capability:

For that specific case, perldiver provides a lot of information
via a browser too.
From: Steve M on
On 4/8/2010 3:06 PM, Uri Guttman wrote:
>>>>>> "SM" == Steve M<stevem_clipthis_(a)clubtrout.com> writes:
>
> SM> #!/usr/bin/perl
> SM> use warnings;
>
> why not strict too?
>
> SM> $! = 1;
>
> huh? i think you meant $| = 1. and that will not have any real affect
> with such a short output and also with the buffering done by the
> server.
>

I did mean $|.. have no idea how that got there.... And no, it won't
have any effect with the short example output... the list I use in real
life is considerably longer than the example I posted.

> SM> print "Content-type: text/html\n\n";
>
> SM> print qq~Testing for availability of Perl Modules<br><br>\n~;
>
> why are you using alternate quote chars when there are no quote chars
> in the string? and if you do use alternate quotes, the best ones are the
> paired chars. i use (and PBP recommends it too) q{} or qq{}.

Editor syntax color issue. It's undoubtedly poor style, but I shift back
and forth on quoting to make 'things' easier for my ancient eyes and
brain to parse.

>
> SM> my @test_list = (
> SM> 'CGI',
> SM> 'DBI',
> SM> 'Spreadsheet::WriteExcel',
> SM> 'Spreadsheet::ParseExcel',
> SM> );
>
> SM> for( @test_list ){
> SM> print qq~$_: ~;
>
> no need for alternate quotes there.
>
>
> SM> eval "use $_; 1" ? ( print 'Available' ) : ( print 'MISSING!!!' );
> SM> print "<br>\n";
>
> and that could all be done in one print:
>
> print "$_: ",
> ( eval "use $_; 1" ) ? 'Available' : 'MISSING!!!',
> "<br>\n";
>
> a lot easier to see what you are doing that way. and no need for all
> those extra print calls. also it removes the side effect thing inside ?:
> which is bad style. ?: is meant to return a value, not choose which side
> effect to execute.

True, does work though. Actually I rarely use a ternary quite that way.

>
> but your concept is valid only if you have a lousy web service without a
> shell. it is easier to switch services than to hack code only after you
> ftp it there!
>
> uri
>

Sigh... I agree up to a point on your last point.

However.

John or Jane Q. client comes to me with a programming job. They've been
with XYZ hosting company forever and XYZ does NOT provide shell access....

So, I tell them to change providers or I'll walk away from the job?

Nope.


\s

--
"There is no use in your walking five miles to fish when you can depend
on being just as unsuccessful near home." M. Twain
From: Uri Guttman on
>>>>> "SM" == Steve M <stevem_clipthis_(a)clubtrout.com> writes:

SM> On 4/8/2010 3:06 PM, Uri Guttman wrote:
>>
>> print "$_: ",
>> ( eval "use $_; 1" ) ? 'Available' : 'MISSING!!!',
>> "<br>\n";
>>
>> a lot easier to see what you are doing that way. and no need for all
>> those extra print calls. also it removes the side effect thing inside ?:
>> which is bad style. ?: is meant to return a value, not choose which side
>> effect to execute.

SM> True, does work though. Actually I rarely use a ternary quite that way.

which way - yours or mine? your way is very bad as it is all about the
side effect (print). my way returns a value to be printed. yours has 2
print calls (reduntant) in the ?: and you need () to make it work
correctly. in the normal use of ?: it doesn't need () as it generates a
value and is lower binding than =.

SM> Sigh... I agree up to a point on your last point.

SM> John or Jane Q. client comes to me with a programming job. They've
SM> been with XYZ hosting company forever and XYZ does NOT provide shell
SM> access....

SM> So, I tell them to change providers or I'll walk away from the job?

SM> Nope.

well, your choice. their mistake for using such a service. it is amazing
what people will stick with. there are major numbers of web services out
there and most decent ones give you shell access. tell them about it as
it will make their lives easier too.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
From: Steve M on
On 4/8/2010 7:50 PM, Uri Guttman wrote:
>>>>>> "SM" == Steve M<stevem_clipthis_(a)clubtrout.com> writes:
>
> SM> On 4/8/2010 3:06 PM, Uri Guttman wrote:
> >>
> >> print "$_: ",
> >> ( eval "use $_; 1" ) ? 'Available' : 'MISSING!!!',
> >> "<br>\n";
> >>
> >> a lot easier to see what you are doing that way. and no need for all
> >> those extra print calls. also it removes the side effect thing inside ?:
> >> which is bad style. ?: is meant to return a value, not choose which side
> >> effect to execute.
>
> SM> True, does work though. Actually I rarely use a ternary quite that way.
>
> which way - yours or mine? your way is very bad as it is all about the
> side effect (print). my way returns a value to be printed. yours has 2
> print calls (reduntant) in the ?: and you need () to make it work
> correctly. in the normal use of ?: it doesn't need () as it generates a
> value and is lower binding than =.

I don't normally do it the way I posted, though I DO make commonly make
assignments. And the () are required to sidestep binding issues as you
mention, and I agree, it's probably not a good thing to make a habit of
doing 'stuff' that way. Even if it is handy sometimes. :-)

I also the cardinal sin of NOT posting exactly what I use in real life.
So add in ad-lib code work, 4 hours of sleep and that's the kind of
garbage I am capable of. :-)

>
> SM> Sigh... I agree up to a point on your last point.
>
> SM> John or Jane Q. client comes to me with a programming job. They've
> SM> been with XYZ hosting company forever and XYZ does NOT provide shell
> SM> access....
>
> SM> So, I tell them to change providers or I'll walk away from the job?
>
> SM> Nope.
>
> well, your choice. their mistake for using such a service. it is amazing
> what people will stick with. there are major numbers of web services out
> there and most decent ones give you shell access. tell them about it as
> it will make their lives easier too.
>
> uri
>

Thanks for your comments Uri, I get stuck in my own little world a lot
of the time and some decent peer review is a nice reality check. You
helped me to step back to consider for a moment.

A good thing.

\s

From: Uri Guttman on
>>>>> "SM" == Steve M <stevem_clipthis_(a)clubtrout.com> writes:

SM> On 4/8/2010 7:50 PM, Uri Guttman wrote:

SM> True, does work though. Actually I rarely use a ternary quite that way.
>>
>> which way - yours or mine? your way is very bad as it is all about the
>> side effect (print). my way returns a value to be printed. yours has 2
>> print calls (reduntant) in the ?: and you need () to make it work
>> correctly. in the normal use of ?: it doesn't need () as it generates a
>> value and is lower binding than =.

SM> I don't normally do it the way I posted, though I DO make commonly
SM> make assignments. And the () are required to sidestep binding issues
SM> as you mention, and I agree, it's probably not a good thing to make a
SM> habit of doing 'stuff' that way. Even if it is handy sometimes. :-)

but it never is handy. you are using blinders even in jest. knowing you
need the () to deal with precedence means you understand the issue. any
time you use ?: with side effects it can usually be written better by
factoring out the common ops and using it for its value. else use a
proper if/else block. there is really no 'handiness' for using ?: the
wrong way. it makes it harder to read, maintain and understand.

SM> I also the cardinal sin of NOT posting exactly what I use in real
SM> life. So add in ad-lib code work, 4 hours of sleep and that's the kind
SM> of garbage I am capable of. :-)

>>
SM> Sigh... I agree up to a point on your last point.
>>
SM> John or Jane Q. client comes to me with a programming job. They've
SM> been with XYZ hosting company forever and XYZ does NOT provide shell
SM> access....
>>
SM> So, I tell them to change providers or I'll walk away from the job?
>>
SM> Nope.
>>
>> well, your choice. their mistake for using such a service. it is amazing
>> what people will stick with. there are major numbers of web services out
>> there and most decent ones give you shell access. tell them about it as
>> it will make their lives easier too.
>>
>> uri
>>

SM> Thanks for your comments Uri, I get stuck in my own little world a lot
SM> of the time and some decent peer review is a nice reality check. You
SM> helped me to step back to consider for a moment.

this whole excuse of no shell access is such a pain. sure you need to
work with clients but it should be your professional duty to move them
to a better service. you can get web with shell accounts for as little
at $5/month. that can't be more than they are paying now so you will
save them money there and save yourself much pain and time too. you can
install your own perl modules easily (use local::lib to install them in
your home dir) and never need to deal with the service's admins for
that.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------