Re: perl OOP problem

2004-04-03 Thread $Bill Luebkert
Rhesa Rozendaal wrote:

> Jeremy A wrote:
> 
> 
>>Hi all,
>>
>>I have an perl oop problem.
>>
> 
> 
> [snip]
> 
> 
>>package Machine;
> 
> 
> Insert this:
> 
> use strict;
> use warnings;
> 
> 
>>sub new() {
>>
>>my $invocant = shift;
>>my $class = ref($invocant) || $invocant;
>>$self = {
> 
> 
> Change that to
>   my $self = {
> 
> 
>>HOSTS  => undef,
>>@_,
>>};
>>
>>return bless $self, $class;
>>}

One more change :

sub host {
my $self = shift;
print $self->{HOSTS},"\n";
}

-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--<  o // //  Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: perl OOP problem

2004-04-03 Thread Rhesa Rozendaal
Jeremy A wrote:

Hi all,

I have an perl oop problem.

[snip]

package Machine;
Insert this:

use strict;
use warnings;
sub new() {

my $invocant = shift;
my $class = ref($invocant) || $invocant;
$self = {
Change that to
my $self = {
HOSTS  => undef,
@_,
};
return bless $self, $class;
}
I bet you would have figured that out for yourself when you would have 
used strict and warnings. Always do that! At least when you're writing 
the code. It will catch a lot of bugs and typo's.

Rhesa
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


TTF Font Program

2004-04-03 Thread Valerie Kramer
I have a number of programs that will display the characters in my fonts
(like Windows Character Map) or even those in fonts that are not installed
(for example, "The Font Thing")  Some allow me to enter a sample string to
be displayed in each font.

All of this is good stuff but I find I'm often looking for a font with
something unique about a single letter. One day it might be a lower case "h"
with a very tall left line. Another day I might be looking for a font where
the letter "E" has a very high (or low) X-height. etc. I can scan thru the
fonts with The Font Thing but it is time consuming, especially if I have to
look through many directories of uninstalled fonts. (I do a lot of
typesetting and have thousands of TTF fonts on my system. No, not all
installed! Windows goes bananas if you have too many fonts installed. 300 is
a good maximum though I have a hard time keeping it down to 500 and all too
often find myself pruning my fonts down from 700 or more but I digress.)

I'd like to have a program that would display a single user-selectable
character from each font (details of how the fonts to be displayed are to be
selected are not critical but uninstalled fonts must be accessible) in a
manner similar to the way Character Map shows all the characters from a
single font.  Clicking on a sample letter would show either a character set
for that font or a user specified string displayed in that font (and, of
course, the font name!)

It seems like Perl now has enough packages including Font-TTF,
Font-TTFMetrics, and TK-FontDialog to make such a program feasable. I
installed the modules and looked at the documentation but I think I'm just a
bit out of my depth. Has anyone done anything like this or can anyone point
me to sample code for anything related to my ideas?

Thanks for any help.

Valerie

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl OOP problem

2004-04-03 Thread Jeremy A
Hi all,

I have an perl oop problem.

I want to do alternating prints (switching).
eg.
192.168.1.101
192.168.1.108
192.168.1.101
192.168.1.108

my problem is it that,
it does not alternate.
eg
192.168.1.108
192.168.1.108
192.168.1.108
192.168.1.108
192.168.1.108
192.168.1.108
etc.

Your help is greatly appreciated.

-Jeremy A.

code below

my $n = Machine->new( HOSTS => "192.168.1.101");
my $g = Machine->new( HOSTS => "192.168.1.108");
while(1)
{
$g->host();
$n->host();
}





package Machine;

sub new() {

my $invocant = shift;
my $class = ref($invocant) || $invocant;
$self = {
HOSTS  => undef,
@_,
};
return bless $self, $class;

}

sub host
{
 print $self->{HOSTS},"\n";
}


1;

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::Daemon::Simple -install question

2004-04-03 Thread Eric Amick
On Sat, 3 Apr 2004 12:00:12 -0800, you wrote:

>When I install a newly compiled script as a service, I see the following
>at the command line:
>
>C:\Development\soap>welagent -install
>Sagiss Windows Event Log Agent 0.1
>Use of uninitialized value in concatenation (.) or string at
>/PerlApp/Win32/Daem
>on/Simple.pm line 239.
>Installed successfully
>C:\Development\soap\welagent.exe
>Use of uninitialized value in concatenation (.) or string at
>/PerlApp/Win32/Daem
>on/Simple.pm line 240.
>
>===
>The 'use' statement I've got in my script is as follows:
>
>use Win32::Daemon::Simple
>Service => 'welagent',
>Name => 'Sagiss Windows Event Log Agent',
>Version => '0.1',
>Info => {
>display =>  'Sagiss Windows Event Log Agent',
>description => 'Polls local Windows event logs and sends events
>to remote server',
>interactive => 0,
>},
>Params => { # the default parameters
>Tick => 0,
>Talkative => 0,
>Interval => 10, # minutes
>LogFile => undef,
>Description => <<'*END*',
>Tick : (0/1) controls whether the service writes a "tick" message to
>the log once a minute if there's nothing to do
>Talkative : controls the amount of logging information
>Interval : how often does the service look for new or modified files
>(in minutes)
>LogFile : the path to the log file
>...
>*END*
>};
>
>
>===
>Did I leave something off that '-install' needs?  I tried starting off
>with a very pared-back 'use' statement (including just the Service,
>Name, Version, and Info options), but found that it wouldn't run at all
>without 'Params => {Tick => 0}'.  So I added the 'Params' back, but I'm
>wondering if I need to add back some more.  What are the minimum
>parameters I need to specify?
>
>It appears to be working OK, but I'd like to eliminate the complaining
>it does when I install the service.

I looked in the source, and it appears the print statement is printing
the value of the 'parameters' key stored in the Info hash without
checking to see if it exists. When you use the module with a compiled
file, no value is stored for that hash key. If I've interpreted the code
correctly, adding

parameters => "",

to the Info hash should keep it quiet. In that case, reporting a bug
would be a good idea.

-- 
Eric Amick
Columbia, MD

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs