How do I change the font color of a checkbox group

2005-06-13 Thread miwalsh
I am building a web page using CGI. The page contains checkboxes, popup menus 
etc. I have been able to change the font of most of the page by surrounding 
the statements on the page with the font color='color tag. For example, some 
of the code might look like this: print font color='red'This is my web 
page./font;


I would like to change the font of the words in the checkbox groups so that 
they match the rest of the page. However, I don't know how to do this and I 
can't find anything in the documentation that helps. If anyone has any ideas 
about this I would be greatfull to hear them.


M. Walsh


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Active Perl Script to delete 4 hours old files on Windows

2005-06-13 Thread Asad
All:
I need to write a script to delete 4 hours old files and directories on 
Windows. I am planning to use Perl to accomplish this. I understand the -M 
would delete at least a day old files, but is there a way to delete 4 hours old 
files and directories.
Thank you.
Asad


-
Discover Yahoo!
 Stay in touch with email, IM, photo sharing  more. Check it out!

RE: Active Perl Script to delete 4 hours old files on Windows

2005-06-13 Thread Bob Showalter
Asad wrote:
 All:
 I need to write a script to delete 4 hours old files and
 directories on Windows. I am planning to use Perl to accomplish
 this. I understand the -M would delete at least a day old files,
 but is there a way to delete 4 hours old files and directories. Thank
 you.   

The -M operator returns a floating point value, so you can compute 4 hours
as:

  $hours = (-M $somefile) * 24;
  if ($hours  4) {
 ...file is more than 4 hours old
  }

You need to be careful using -M in a daemon because the age is base on the
script start time and not the current time. If that's a concern, you can
make -M use current time by doing this:

  $hours = do { local $^T = time; (-M $somefile) * 24 };

or you can use stat() insteamd of -M like this:

  $hours = (time - (stat $somefile)[9]) / 3600;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Active Perl Script to delete 4 hours old files on Windows

2005-06-13 Thread Chris Devers
On Mon, 13 Jun 2005, Asad wrote:

 I need to write a script to delete 4 hours old files and
 directories on Windows. I am planning to use Perl to accomplish this.
 I understand the -M would delete at least a day old files, but is
 there a way to delete 4 hours old files and directories.

Yes, it should be possible.

Hint: on Unix, stat $filename would help you:

http://perldoc.perl.org/functions/stat.html

I don't use Windows so I can't verify that it'll behave the same way
with ActiveState/Windows, but I suspect it will work just fine.

 Thank you.

You're welcome.



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Just to know why ?: is not working here

2005-06-13 Thread J. Alejandro Ceballos Z.


I made a CGI that must send a piece of code to screen, otherwise, must 
return a redirect command (is a banner CGI)



What it is stange to me is that the construction:

# blah, blah above
#
# Returns code or redirect to the page
print ($str_codetoreturn)
   ? $cgi_this-header().$str_codetoreturn
   : $cgi_this-redirect(-uri=$str_redirecto);
#
# end of cgi


sends a premature end of headers error; but:


# blah, blah above
#
# Returns code or redirect to the page
if ($str_codetoreturn)
  { print $cgi_this-header().$str_codetoreturn; }
else
  { print $cgi_this-redirect(-uri=$str_redirecto); }
#
# end of cgi


works fine.

($cgi_this is my CGI object)



Why is this?

TIA,



   J. Alejandro Ceballos Z. |
 ---+--
 http://alejandro.ceballos.info |
  [EMAIL PROTECTED] |


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Just to know why ?: is not working here

2005-06-13 Thread Oliver Schnarchendorf
On Mon, 13 Jun 2005 21:20:26 -0500, J. Alejandro Ceballos Z. wrote:
Alejandro,

the problem here is that you are evaluating a PRINT function for its 
results but not the string. Perl needs to print, to evaluate the print 
function, thus the writing of the header is prematurely ended.

You want the following:

$str_codetoreturn 
? print $cgi_this-header().$str_codetoreturn 
: print $cgi_this-redirect(-url=$str_redirectto);

/oliver/

 What it is stange to me is that the construction:
 print ($str_codetoreturn)
? $cgi_this-header().$str_codetoreturn
: $cgi_this-redirect(-uri=$str_redirecto);
 sends a premature end of headers error; but:
 if ($str_codetoreturn)
   { print $cgi_this-header().$str_codetoreturn; }
 else
   { print $cgi_this-redirect(-uri=$str_redirecto); }
 works fine.


--
If you believe everything you read, you better not read. -Japanese Proverb


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Just to know why ?: is not working here

2005-06-13 Thread Ovid
--- J. Alejandro Ceballos Z. [EMAIL PROTECTED] wrote:
 I made a CGI that must send a piece of code to screen, otherwise,
 must 
 return a redirect command (is a banner CGI)
 
 What it is stange to me is that the construction:
 
 # blah, blah above
 #
 # Returns code or redirect to the page
 print ($str_codetoreturn)
 ? $cgi_this-header().$str_codetoreturn
 : $cgi_this-redirect(-uri=$str_redirecto);
 #
 # end of cgi
 
 sends a premature end of headers error; but:

That's because the code, while valid syntax, is not doing what you
want.  The ternary operator is switching basssed on the return value of
the print statement, not on the value of $str_codetoreturn.  The
following should illustrate:

  perl -le 'print (42) ? foo : bar'
  42

That can be fixed by moving the right parenthesis to encompass the
expression you wish to evaluate:

  perl -le 'print (42 ? foo : bar)'
  foo

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response