Re: how to check whether Display variable is set or not



tony <rajashekar14@xxxxxxxxx> wrote:

I tried both the commnds and its not working


Both of _what_ "commands"?

Please quote some context in followups like everybody else does.

Have you seen the Posting Guidelines that are posted here frequently?


1) When used "Properly_set($display)" cmd it throws following error,
^
^
Undefined subroutine &main::properly_set called at ex_pl.pl line 5
^
^

Those are *different* subroutines.

Case matters.


2) When used if ($ENV{Display} ne $ProperValueForEnvVariable)..no
^^^^^^^
^^^^^^^
errror is thrwon..


That is not what was in the earlier answer.

Case matters!!


I'm guessing you would have gotten some helpful messages if
you had warnings and strict enabled...


But eventhough display is set perplry


What does "properly" mean in this case?

That is, exactly what value do you _want_ DISPLAY to have?


it says Display
is not set properly


Programs don't "say" things.

They can _output_ things though, which is what I think you meant.

But the bit of code that you have shown us does not have any
output statements, so it still can't really be "saying" anything.


Please help if i am using the cmd correctly


We cannot tell you if you are using it correctly, we need more information.

1) what is the "correct" value for your situation?

2) how, exactly, are you setting variable values, doing the
comparison and making output?

If you post a short and complete program that we can run, then
we surely *could* help you fix the problem.

As it is, we cannot even see the place where the problem is.



use PSI::ESP;


You copied the answers verbatim, when they contained "meta" parts
that you did not change to match your actual situation. (We had
to do that because you have never told us the actual situation.)

That is, we do not know what value you want to accept as "proper".

So, I will assume that the value that you want is the 4-char string:

:0.0

if my assumption is wrong, then you will need to modify the
code to accept whatever the correct string is.

Here is a short and complete program that _you_ can run.

You may need to modify it to get it to work of course.


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

# direct comparison
if ( $ENV{DISPLAY} eq ':0.0' )
{ print "set properly\n" }
else
{ print "NOT set properly\n" }


# subroutine does comparison
if ( set_properly($ENV{DISPLAY}) )
{ print "set properly (func)\n" }
else
{ print "NOT set properly (func)\n" }

sub set_properly {
my($display) = @_;
return $display eq ':0.0';
}
------------------------


--
Tad McClellan SGML consulting
tadmc@xxxxxxxxxxxxxx Perl programming
Fort Worth, Texas
.



Relevant Pages

  • Re: Modify Active Directory Schema Attribut Display Names
    ... Well first off, you can't change the lDAPDisplayName of pager or any other base schema attributes and for good reason, that is how applications identify the attributes. ... If you succeeded in changing the attribute, Active Directory Users and Computers wouldn't even know how to display it anymore. ... So if you want to try, what you actually need to do is to modify the display specifier for user objects. ...
    (microsoft.public.windows.server.active_directory)
  • Re: How do I change a name in the Global Address List?
    ... Change the user's account properties - first name, display name, and the ... The offline address book will be automatically updated or you can ... You may also want to modify her Outlook profile ...
    (microsoft.public.windows.server.sbs)
  • Re: Field1 controls what is displayed in Field2
    ... to display the second column of the combo's row source ... I can just modify someone else's format, ... The Access Web resources page: ...
    (microsoft.public.access.gettingstarted)
  • Re: Date and Time field
    ... You can add a new Calculated column that shows just the date portion of the ... Then modify the view to include your new BeginDate column instead of Begin. ... >>I created a new custom field "Date" which I figured we could use instead ... I'm wanting to display only the Date portion of this ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Symbolic Reference Problem
    ... >> I previously had some repetitive code that I wanted to simplify. ... but all my subroutines downstream are expecting scalar values. ... Display vara ... but I want to make it work under the use strict ...
    (comp.lang.perl.misc)