Re:Regexp needed

2002-05-23 Thread Jorge Goncalvez

Hi, i have this:
open INFILE,  $_Globals{SYSLOG} or die $!;
#ModifiedFile();
while (INFILE) {
if (/([0-9a-z:]+)\s*via eth0)/) {
$_Globals{MAC_ADDR} = $1;
   }
}
And my file is like this:
.
LOG_INFO : BOOTREQUEST from 00:80:9f:2e:0f:9c via eth0
..
it worked but i wanted also to match the mac eddress if i have this
LOG_INFO : BOOTREQUEST from 00:80:9f:2e:0f:9c via eth1

I tried this but it didn't work:
if (/([0-9a-z:]+)\s*via ([eth])/) {
..

Thanks.






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Win32::EventLog

2002-05-21 Thread Jorge Goncalvez


Hi, I wanted to delete some entries in The NT EventLog in the category 
Application:
I have this code:

use Win32::EventLog;
use GetMyRegPath;
my $CMPath = GetMyRegPath::GetCygwinMountsPath();
use Time::CTime;
 my ($Event, @timearray, $filename,
$day, $month, $directory);
 # Where do you want to put the backup files?
$directory = $CMPath/EventLogs/;
unlink $directory/* if -r $directory;
  for ('Application')
{   $Event = new Win32::EventLog ($_, );
@timearray=localtime(time);
$month = sprintf ('%.2d', $timearray[4] +1);
$day = sprintf ('%.2d', $timearray[3]);
$filename = $directory . ($timearray[5]+1900) . '_' .
 $month . '_' . $day . '_' . $_ . '.events';
$Event-Clear($filename);
sprintf $filename;
#`gzip -9 $filename`;
} # End for 

It works quite well but now I wanted to delete only special entries like this:
.
for ('Application/cygwin')  for ('Application/in.tftpd)
...

But it didn't work it deletes nothing.
How can I do  to delete special items in the NT Event Log Application category ?
Thanks.
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:regexp needed

2002-05-14 Thread Jorge Goncalvez

Hi, I have a file like this:
...
SceInfEveryone = Everyone
SceInfGuests = Guests
SceInfGuest = Guest
SceInfPowerUsers = Power Users
SceInfPrintOp = Print Operators
..

And I wanted to extract Guest (without the quotes)i tried this:

my $HISEFILE= c:/hisecdc.inf;
open HISE, $HISEFILE
or die je ne peux ouvrir $HISEFILE :$!;
while (HISE) {
if (/SceInfGuest\s+:\s([0-9a-z]+);/i) {
print found $1 \n;

}
}
close HISE;

It didn't worked why? What's wrong in my code?
thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Regexp correction

2002-04-29 Thread Jorge Goncalvez

Hi, i have this code :
 opendir(DIR,$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/DHS3Linux);
 
 foreach (readdir(DIR)){
unless (/([Comm]+)/){
$box3-insert('end', $_);
}
}
closedir(DIR);

I wanted to have all that there is in DIR except the directory Comm it works 
great but if i have others directories which contains c o m i don't have it and 
i wanted not to take only the directory Comm and take all others directories.

Where is my mistake.
Thanks. 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:regexp needed

2002-04-26 Thread Jorge Goncalvez

HI, I have a file like this:

.
1015322638: in.tftpd : Win32 Process Id = 0xBF : Cygwin Process Id = 0xBF : RRQ 
from 192.40.54.42 filename /bootp/linux/4.0/alize/initrd.img  (in.tftpd)
..

And I wanted to match what is between from and filename ie 192.40.54.42 and what 
comes after filemane ie /bootp/linux/4.0/alize/initrd.img
 without (in.tftpd) 
 
 How can I do thanks to a regexp.
 Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Win32::TieRegistry

2002-04-23 Thread Jorge Goncalvez


Hi, i have this snippet (perl module) which uses Win32::registry(obsolete) but 
it didn't worked very well,I wonder how to get his job with Win32::tieRegistry.

package NIC98;
 require Win32::Registry;
  

sub GetNICName()
{

  my $Register = System\\CurrentControlSet\\Services\\Class\\Net\\;

  $::HKEY_LOCAL_MACHINE-Open($Register,$hkey)|| die $!;

  my @keys;
  $hkey-GetKeys(\@keys);

  my @nic;
  foreach (@keys)
  {
if($::HKEY_LOCAL_MACHINE-Open(System\\CurrentControlSet\\
. Services\\Class\\Net\\$_, $hkey))
{
  my %values;
  $hkey-GetValues(\%values);
  next if exists $values{PointToPointIP}  $values{PointToPointIP}-[2] == 
1;
  next unless exists $values{DriverDesc};
  
  # build interface name ala Unix
  my $_netif = sprintf eth%d, $_;
  push @nic, $_netif;
}
  }
 
  return @nic;
   $::HKEY_LOCAL_MACHINE-Close();
}

1;


Thanks for your precious help.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:insert in a browseentry

2002-04-16 Thread Jorge Goncalvez



Hi, I have this:

opendir(DIR,$_Globals{CDROM}:/DHS3MGR/$tel_version/DHS3Linux);
foreach (readdir(DIR)){
unless (/([Comm]+)/){
$box3-insert('end', $_);
}

$box3 is a browse entry.
It works fine but

My problem is there is a file under DHS3MGR and not only a 
directory($tel_version) it didn't work
Why? 
Thanks. 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:search an executable in path

2002-04-12 Thread Jorge Goncalvez

HI, I wanted to know if the Win32 executable net.exe is on Path.
How can I do this in Perl?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Ip address

2002-04-10 Thread Jorge Goncalvez

Hi, I tried to get the IP address in a Win98 machine I made a perl module and I 
put it in /site/lib with .pm extension.
it is Registry98.pm

But I have this error:
Can't call method Open of a undefined value at Registry98.pm line 22

Why?

Thanks



Registry98.pm
Description: Registry98.pm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE:long path and short Path

2002-03-26 Thread Jorge Goncalvez

Hi, I wonder if Perl under windows know short path like  dos with tildes on it.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Win32::Shortcut

2002-03-13 Thread Jorge Goncalvez

Hi, I use Win32::Shortcut with a perl /tk apllication to make a shortcut on the 
windows Desktop it works  but when I double click my icon my application get a 
littele time to come and I wonder it is possible to add a hourglass when i 
double click my icon to make waiting the user.
thanks .


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:how to pass 2 variables

2002-03-13 Thread Jorge Goncalvez

Hi, I have this but it is a bit repeating I wonder how to pass 2 variables and 
use only function createScut.My code:
my $path=$RegValue\\InstallOXE.lnk;
createScut($path);
my $path2=$RegValue\\remove.lnk;
createScut2($path2);I 

sub createScut() {

  my $CMPath = GetMyRegPath::GetCygwinMountsPath();
  my $lnkLocation = shift;
  $LINK=new Win32::Shortcut();

  $LINK-{'Path'}=qq($CMPath\\Active_Perl\\Bin\\);
  $LINK-{'WorkingDirectory'}=$CMPath/Active_Perl/Bin/;
  $LINK-{'Description'}= Serveur d'installation CS OXE ;
  $LINK-{'ShowCmd'}=SW_SHOWMINNOACTIVE;
  $LINK-{'IconLocation'}=$CMPath/Active_Perl/Bin/ras.ico;
  $LINK-Save($lnkLocation);
  $LINK-Close();

}

sub createScut2() {

  my $CMPath = GetMyRegPath::GetCygwinMountsPath();
  my $lnkLocation = shift;
  $LINK=new Win32::Shortcut();

  $LINK-{'Path'}=qq($CMPath\\);
  $LINK-{'WorkingDirectory'}=$CMPath;
  $LINK-{'Description'}= Désinstallation de cygwin ;
  $LINK-{'ShowCmd'}=SW_SHOWMINNOACTIVE;
  $LINK-{'IconLocation'}=$CMPath/Active_Perl/Bin/cygwin.ico;
  $LINK-Save($lnkLocation);
  $LINK-Close();

}


Thanks.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Create a package

2002-03-05 Thread Jorge Goncalvez

Hi, I wanted to create a package like this:
package GetMyRegPath;

use Win32::Registry;

sub GetCygwinMountsPath(){
  my %Vals = ();
  my $RegPath = SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;
  $main::HKEY_LOCAL_MACHINE-Open($RegPath, my $MountsKey) || die Couldn't
open $RegPath\n;
  $MountsKey-GetValues(\%Vals);
  foreach my $Val (keys %Vals){
my $Key = $Vals{$Val};
if ($$Key[0] eq native){
  my $MountsPath = $$Key[2];

  my ($Path) = $MountsPath =~ /(.+?)cygwin/;

  return  ($Path);

} #end if
  } #end foreach
} #end sub

use GetMyRegPath;

but it fails and i have this why?
thanks

GetMyRegPath.pm did not return a true value at bootnet3.pl line 40.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




re:Regexp needed

2002-03-05 Thread Jorge Goncalvez

hi, i have this:
my ($Path) = $MountsPath =~ /(.+?)cygwin/;
but I wanted to get rid of the /.
because $MountsPath could be c:/cygwin or c:/xyz/cygwin or c:/xyz/zyx/cygwin and 
i wanted $Path = c: or c:/xyz or c:/xyz/zyx .
And now $Path= c:/ or c:/xyz or c:/xyz/zyx.
How can I do ?
thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Interpreting variable

2002-02-27 Thread Jorge Goncalvez

Hi, I have this snippet:
sub GetCygwinMountsPath(){
...

}
my $CMPath = GetCygwinMountsPath();
print (The path is: $CMPath);



system(q{perl -i.orig -pe s!/cygdrive/c!/!g $CMPath/cygwin/etc/passwd});

but in th elast line $CMPath seems not to be interpreted althought $CMPath 
=c:/.
Why?
i have the following error:
The path is: C:/Can't open $CMPathcygwin/etc/passwd: No such file or directory.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Regexp help

2002-02-18 Thread Jorge Goncalvez

Hi, I need some help to have a regexp which could replace : by - in this code:

my $cmd=arp -s $ipadress $_Globals{MAC_ADDRESS};

system($cmd);
 actually
$_Globals{MAC_ADDRESS} is formatted like this :XX:XX:XX:XX:XX:XX and i wanted to 
put it like this: XX-XX-XX-XX-XX-XX
How can i do this thanks a regexp 
thanks for your precious help.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:a better Perl way

2002-02-15 Thread Jorge Goncalvez

Hin I have this piece of code and i wanted to make it simpler and shorter Yhanks

my $Range1 = $1 . ($2 + 1) if $IPREAL[0] =~ /^(.*\.)(.+)$/;
my $Range2 = $1 . ($2 + 1) if $IPREAL[1] =~ /^(.*\.)(.+)$/;
my $Range3 = $1 . ($2 + 2) if $IPREAL[0] =~ /^(.*\.)(.+)$/;
my $Range4 = $1 . ($2 + 2) if $IPREAL[1] =~ /^(.*\.)(.+)$/;

my $newline2=  subnet $IP[0] netmask 255.255.255.0{range dynamic-bootp  
$Range1 $Range3;};
my $newline3=  subnet $IP[1] netmask 255.255.255.0{range dynamic-bootp 
$Range2 $Range4;};

 Thanks.   


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:pl2bat issue

2002-02-13 Thread Jorge Goncalvez


Hi, I tried to make an .bat of a .pl file thanks to pl2bat to execute it from 
both Windows NT and Win 9x.
But when i double clicked it on NT it works but on Win9x it fails and i have the 
following:
Command or filename incorrect
In the header and the finish  of my file i have:

@rem = '--*-Perl-*--
@echo off
if %OS% == Windows_NT goto WinNT
c:\\OXE\\Active_perl\\bin\\perl -x -S %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
c:\\OXE\\Active_perl\\bin\\perl -x -S %0 %*
if NOT %COMSPEC% == %SystemRoot%\system32\cmd.exe goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2nul
goto endofperl
@rem ';

#!/usr/local/bin/perl -w


__END__
:endofperl

thanks




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Kill a process

2002-02-07 Thread Jorge Goncalvez

HI, I wanted to kill a process INETD by code:by hand in the cygwin bash i tried 
this:
ps |awk '/INETD/{print $1}'|xargs kill
and it works, now i wanted to do it by Perl code:
I tried:
system( c:\\cygwin\\bin\\bash.exe('ps |awk '/INETD$/{print $1}|xargs kill'))
or
system(c:\\cygwin\\bin\\ps.exe |c:\\cygwin\\bin\\awk.exe '/INETD/{print 
$1}'|c:\\cygwin\\bin\\xargs.exe c:/cygwin/bin/kill.exe);

neither by replacing \\ by /.

But didn't work why?
thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:pidof a process

2002-02-07 Thread Jorge Goncalvez

Hi, Iw onder if there is a way to obtain the PID of a process with perl?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to delete a symlink

2002-02-06 Thread Jorge Goncalvez

Hi, I wanted to verify if a symlink exists  and delete it if it exists
My code is:
my $program_path = c:\\cygwin\\bootp\\linux;
my @program = (
$program_path\\$_Globals{LX_VERSION},
$program_path\\install,
$program_path\\linux.ram,
$program_path\\alize\\install,
$program_path\\alize\\startup.txt
 );

my $link_prefix = c:\\cygwin\\bin\\ln.exe -s
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Gl
obals{LX_VERSION};
my @link = (
$link_prefix,
$link_prefix\\install,
$link_prefix\\linux.ram,
$link_prefix\\install,
$link_prefix\\alize\\startup.txt
 );


my @pairs;
push @pairs,
{  link = $link[$_] $program[$_],
  program = $program[$_] }
foreach 0 .. $#link;

foreach my $p ( @pairs ) {
system($p-{link} ) unless -e $p-{program};
}


In fact i wanted to delete :
$program_path\\install,
$program_path\\linux.ram,
$program_path\\alize\\install,
$program_path\\alize\\startup.txt

  if they already exists to make new one with the new destination.
  
  Thanks.  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:A more perlish way

2002-02-06 Thread Jorge Goncalvez

Hi, I have this :
my $program_path = c:\\cygwin\\bootp\\linux;
my $Symlink=$program_path\\install.lnk;
my $Symlink2=$program_path\\linux.ram.lnk;
my $Symlink3=$program_path\\alize\\install.lnk;
my $Symlink4=$program_path\\alize\\startup.txt.lnk;

if (-e $Symlink)
{
system rm $Symlink;
 }

if (-e $Symlink2)
{
system rm $Symlink2;
 }


if (-e $Symlink3)
{
system rm $Symlink3;
 }


if (-e $Symlink4)
{
system rm $Symlink4;
 }
 
 
 I tried this:
  @Symlink=($program_path\\install.lnk,
 $program_path\\linux.ram.lnk,
 $program_path\\alize\\install.lnk,
 $program_path\\alize\\startup.txt.lnk);

  foreach (@Symlink)
  {
if (-e $_)
{

system rm $_;

}
   }
   
  but it seems not to work?Why?
  
  Thanks.   


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Destroy a window

2002-01-30 Thread Jorge Goncalvez

Hi, I have a perl tk (in Windows9X) application which contains 2 windows.
What I would like to do is when i click the cross(to destroy the window) of the 
first window to destroy also the another window.
Thanks.

I tried this:

MainLoop;
   
$_Globals{POPUP_WINDOW}-destroy;
$_Globals{TOP_WINDOW}-destroy;

$_Globals{TOP_WINDOW} is the main window.If I call the $_Globals{POPUP_WINDOW} 
from the $_Globals{TOP_WINDOW}  and then i click the cross of the 
$_Globals{TOP_WINDOW} it destroy only $_Globals{TOP_WINDOW} and not 
$_Globals{POPUP_WINDOW}.
How can i do to catch the fact a user clicked the cross of the main window to 
kill all windows.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:foreach issue

2002-01-29 Thread Jorge Goncalvez

Hi I have this:
$but-configure(-state=$state);
$Entry-configure(-state=$state);
$box-configure(-state=$state);
$box2-configure(-state=$state);
$box3-configure(-state=$state);
and I wanted to simplify it by

@configure=($but,$Entry,$box,$box2,$box3);

foreach (@configure)
{
$_-configure(-state=$state);
}   

but it didn't work can't call method for configure.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:What's wrong with this?

2002-01-28 Thread Jorge Goncalvez

hi, I have this code:
use IO::Socket;
$port=21;


$sock = IO::Socket::INET-new(PeerAddr  ='localhost',
PeerPort = $port,
Proto = 'tcp') ;
die inetdconf unless ($sock);


my $cmd4= net stop inetd  net start inetd;
system($cmd4);

sub inetdconf()
{
my $cmd= c:\\oxe\\cygwin\\bin\\sed.exe 's/^\#ftp/ftp/' 
c:\\cygwin\\usr\\local\\etc\\inetd.conf  c:\\cygwin\\usr\\local\\etc\\inetd.new 
;# Comment out ftp entry in /etc/inetd.conf
system($cmd);
my $cmd2= c:\\oxe\\cygwin\\bin\\mv.exe 
c:\\cygwin\\usr\\local\\etc\\inetd.new c:\\cygwin\\usr\\local\\etc\\inetd.conf; 
# Move new file into place
system($cmd2);

}

But it always returns 0.Why?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re:What's wrong with this?

2002-01-24 Thread Jorge Goncalvez

it still not working i tried this:
use Win32::Registry;
my $Register =Software;
my $Register2=.DEFAULT\\Software;
my $hkey;
$HKEY_LOCAL_MACHINE-Open($Register,$hkey)|| die $!;
$hkey-DeleteKey(Cygwin2);
$hkey-Close();
$HKEY_CURRENT_USER-Open($Register,$hkey)|| die $!;
$hkey-DeleteKey(Cygwin2);
$hkey-Close();
$HKEY_USERS-Open($Register2,$hkey)|| die $!;
$hkey-DeleteKey(Cygwin2);
$hkey-Close();

it worked but it is a bit repeating code how can i do tto use a foreach loop to 
simpler the code.
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re:What's wrong with this?

2002-01-24 Thread Jorge Goncalvez

Humm It don't work syntax error at regedit3.pl line 10, near %rkey(
it seems impossible to create a hash like this..


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re:What's wrong with this?

2002-01-24 Thread Jorge Goncalvez

good it works thanks for your precious tips.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to pass arguments

2002-01-22 Thread Jorge Goncalvez

hi, I have the following code:
.
sub MakeSixthEntry()
{
$box = $_Globals{POPUP_FRM}-BrowseEntry( -variable = 
\$_Globals{LX_VERSION},
  -choices =\@IPREAL,
  -browsecmd =\MakeEth,
  -listwidth =60,
  -state = $state)
-pack(-anchor = w);

}

sub ParseDhcpdconf()
{
..
my $newline2=qq{host clin09 \{hardware ethernet 
$_Globals{MAC_ADDRESS};\n
filename /bootp/linux/$_Globals{LX_VERSION}/alize/startup.txt;\n};
.
}

It works but I must use a global variable $_Globals{LX_VERSION} and what I 
wanted is to use a local variable that can use in another function by passing it 
to the function.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:IO::Socket::Inet

2002-01-22 Thread Jorge Goncalvez

Hi, i have this
use IO::Socket;
$port=21;

$server=155.132.48.23;
#$server=192.40.54.41;

$sock = IO::Socket::INET-new(PeerAddr  =$server,
PeerPort = $port,
Proto = 'tcp') ;

 it works but what i wanted is to make it not from a remote host but a local 
host to avoid needing ip adress.
 i tried this:
 $sock = IO::Socket::INET-new(LocalHost  ='localhost',
PeerPort = $port,
Proto = 'tcp') ; 
  but it fails I don't know how to specify 'localhost'
  Thanks.  

  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to make it more perlish

2002-01-18 Thread Jorge Goncalvez

Hi, I have this piece of code and i wanted to simplify it and make it more 
perlish.
thanks


cbkRedrawLink()

sub cbkRedrawLink()
{


my $PROG=c:\\OXE\\cygwin\\bootp\\linux\\$_Globals{LX_VERSION};
my $PROG2=c:\\OXE\\cygwin\\bootp\\linux\\install;
my $PROG3=c:\\OXE\\cygwin\\bootp\\linux\\linux.ram;
my $PROG4=c:\\OXE\\cygwin\\bootp\\linux\\alize\\install;
my $PROG5=c:\\OXE\\cygwin\\bootp\\linux\\alize\\startup.txt;

my $link=c:\\OXE\\cygwin\\bin\\ln.exe -s  
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Globals{LX_VERSION}
 $PROG;
my $link2=c:\\OXE\\cygwin\\bin\\ln.exe -s  
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Globals{LX_VERSION}/install
 $PROG2;
my $link3=c:\\OXE\\cygwin\\bin\\ln.exe -s  
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Globals{LX_VERSION}/linux.ram
 $PROG3 ;
my $link4=c:\\OXE\\cygwin\\bin\\ln.exe -s  
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Globals{LX_VERSION}/install
 $PROG4;
my $link5=c:\\OXE\\cygwin\\bin\\cp.exe -s  
$_Globals{CDROM}:/DHS3MGR/$_Globals{TEL_VERSION}/PCMAO/BOOT_RES/BOOTP/LINUX/$_Globals{LX_VERSION}/alize/startup.txt
 $PROG5 ;
unless (-e $PROG)
{
system($link) ;
}

unless (-e $PROG2)
{
system($link2) ;
}

unless (-e $PROG3)
{
system($link3) ;
}

unless (-e $PROG4)
{
system($link4) ;
}

unless (-e $PROG5)
{
system($link5) ;
}

}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE:Perl tk window issue

2002-01-17 Thread Jorge Goncalvez

Hi,I have a perl tk script under windows where i refresh and update some widget 
in a window, i must destroy and redraw the window to have the modifications 
updated.
But with  this method every time the window is called (so destroyed and 
redrawed) the window goes to the left top corner of the screen and doens't stay 
where it was it is annoying because this windows moves always to this direction 
when it is recreated.
How can get rid of this behaviour?
thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Regex improvment needed

2002-01-15 Thread Jorge Goncalvez

Hi, I have this code to parse a file and get the hardware address:
sub ParseInitDhcpdconf() {
open VIEUX,$_Globals{DHCPDCONF} or die je ne peux ouvrir
$_Globals{DHCPDCONF} :$!;
while (VIEUX) {

if (/hardware ethernet /) {
$_=(split/\{/)[1];
s/[^\d:A-F]//g; # remove anything not 0..9,A..F 
or :
print $_\n;
$_Globals{MAC_ADDRESS}=$_;

}
}
close VIEUX;

It works fine but if that comes after hardware ethernet contains a..f in 
lowercase the letter are ommitted.
How can i get rid of this behaviour.
my file looks like this:
.
host clin09 {hardware ethernet 00:56:9C:6B:8A:15;



but it can be for exemple

host clin09 {hardware ethernet 00:56:9c:6b:8a:15;
..   

Thanks  



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:detect the path of a directory

2002-01-15 Thread Jorge Goncalvez

Hi,first i would like to thanks those who already helped me.
 I am under Windows and What I wanted is to detect where a directory is 
stored(in fact I wanted his path, like for exemple I wanted to detect where the 
directory OXE is,and i wanted his path that could be  c:/OXE, or D:/OXE, Or 
E:/OXE or X:/Y/OXE etc...
Is there a way to do this in perl Thanks in advance for your precious help.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to know if a symlink exists

2002-01-14 Thread Jorge Goncalvez

Hi, I wanted to do this:
ln -s X Y but unless it don't already exists?
How can I do this in Perl?
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Regexp and lower case

2002-01-10 Thread Jorge Goncalvez

Hi, I have this:
if (/hardware ethernet /) { 
$_=(split/\{/)[1];  
s/[^\d:A-F]//g; # remove anything not 0..9,A..F 
#print $_\n;

}

It works but I dont want to remove th eletter between a-f if it is in lower 
case.
How can I do to have the upper and th elower case.
Thanks  



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




[PBML] RE: Extract a value of a key into a hash

2002-01-10 Thread Jorge Goncalvez




Hi, I have this code:
#!/usr/local/bin/perl -w

use Win32::Registry;
my %RegType = (
0 = 'REG_0',
1 = 'REG_SZ',
2 = 'REG_EXPAND_SZ',
3 = 'REG_BINARY',
4 = 'REG_DWORD',
5 = 'REG_DWORD_BIG_ENDIAN',
6 = 'REG_LINK',
7 = 'REG_MULTI_SZ',
8 = 'REG_RESOURCE_LIST',
9 = 'REG_FULL_RESOURCE_DESCRIPTION',
10 = 'REG_RESSOURCE_REQUIREMENT_MAP');

my $Register = Software\\MICROSOFT\\Windows\\CurrentVersion\\explorer\\Shell 
Folders;
my $RegType, $RegValue, $RegKey, $value;
my %values;

$HKEY_LOCAL_MACHINE-Open($Register,$hkey)|| die $!;
#$hkey=Common Desktop;

$hkey-GetValues(\%values);

foreach $value (keys(%values))
{
$RegType= $values{$value}-[1];
$RegValue   = $values{$value}-[2];
$RegKey = $values{$value}-[0];
next if ($RegType eq '');  #do not print default value if not assigned
$RegKey = 'Common Desktop' if ($RegKey eq '');  #name the 
default key
print $RegKey;
print  ($RegType{$RegType}) : ;

SWITCH:
{
if ($RegType == 4)
{printf Ox%1x \n, unpack(L,$RegValue); last SWITCH; 
}
if ($RegType == 5)
{printf Ox%1x, unpack(N,$RegValue); last SWITCH; }
if ($RegType  8 )
{printf $RegValue\n; last SWITCH; }
print \n;
}
}
$hkey-Close();


What i wanted is to print the value of the hash %values for the name Common 
Desktop only;
Now it prints all thereis in th epath 

%values Hash (Name, Type, Value) for each value 

Thanks




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:IP address from the registry

2002-01-10 Thread Jorge Goncalvez

Hi, Is there a way to obtain the IP address from the registry in Both Windows 98 
and NT with Perl moduls.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Parsing and regexp

2002-01-09 Thread Jorge Goncalvez

Hi, I made a parsing of a file which contains :
this:
Adresse IP. . . . . . . . . : 155.132.48.23

like this to obtain the Ip adress.

if ($_ =~/Adresse IP/) {
$_ =~ s/.+://;

$Subnet=$_;

push @IPREAL, $_;

$_=~ s/(\d+\.\d+\.\d+)\.\d+/$1.0/;

push @IP, $_;

It works but my problem is that parsing works only in french files, but I wanted 
to make it working in another language like for exemple English.
I have 
IP Address. . . . . . . . . : 155.132.114.77 

How can I improve my regexp   if ($_ =~/Adresse IP/) to check the IP address 
indepentmently of the language (I know that the searched string contains always 
IP )

Thanks




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:how to delete all keys in the regentry

2002-01-04 Thread Jorge Goncalvez

Hi, I wonder how to delete for exemple all keys that contains test1 and 
test2 from the Windows registry with Perl.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Perl Tk issue

2001-12-27 Thread Jorge Goncalvez

Hi, I wonder if the method update works on Windows because it seems not to work, 
i must destroy my application and redraw it to have the variables updated when 
for exemple a variable is associated at a button .
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Need regex

2001-12-17 Thread Jorge Goncalvez

Hi, I wanted to have the  first 5 elements of a scalar, like for exemple:
my $number=  E14011

my number2=E1401

How can i do this in Perl, thanks?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Count number of characters

2001-12-17 Thread Jorge Goncalvez

How can I count the number of characters of a string ?
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to make a local variable a global variable in Perl

2001-12-12 Thread Jorge Goncalvez

Hi I have this code:
...
sub MakeEth()
{ 
unless ($_Globals{NICIP_ADRESS}==$IPREAL[0])
{
$_Globals{ETH_NETIF} eq eth0;
}
else{

$_Globals{ETH_NETIF} eq eth0:1;

 } 
}

...

sub StartDhcp()
{
my $_cmd = $_Os{$_Globals{OS}}{DHCPD} .. $_Globals{ETH_NETIF};
system($_cmd);
}

I wanted to make $_Globals{ETH_NETIF} affected by what it is in the scope 
MakeEth because in the sub StartDhcp $_Globals{ETH_NETIF} is undef I would to 
make it a variable global after been affected by sub MakeEth.

Still thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Write to a file problem

2001-12-07 Thread Jorge Goncalvez

HI, I have a file which ends by:

host clin09 {hardware ethernet 00:80:9F:2E:3F:5E;
filename /bootp/linux/pre3.1/alize/startup.txt;}
}


I have a perl tk application where a user types a MAc Adress in an entry the 
variable is $_Globals{MAC_ADDRESS} .

I wanted to replace what's come after hardware ethernet ie in this case 
00:80:9F:2E:3F:5E by what the user entered.

I have this code:
my $newline2=qq{host clin09 {hardware ethernet $_Globals{MAC_ADDRESS};\n
filename /bootp/linux/pre3.1/alize/startup.txt;}\n};

open (VIEUX, $_Globals{DHCPDCONF})
or die je ne peux ouvrir $_Globals{DHCPDCONF} :$!;

 open(NOUVEAU,  $nouveau)
or die je ne peux ouvrir $nouveau : $!;

  while ($line = VIEUX) {
  
  if ($line =~ /^host clin09/) {
  
  print NOUVEAU $newline2 or die je ne peux écrire dans $nouveau : $!;
}


} 
close (VIEUX);
close (NOUVEAU);

   
   But it didn't work could help me please Thanks  


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Regex help

2001-12-07 Thread Jorge Goncalvez

I have this line in a file :
host clin09 {
hardware ethernet 00:80:9F:2E:3F:5E

I have this code:
While .

if ($line =~ /^host clin09/){

system(q{perl -i.orig -pe s/00:80:9F:2E:3F:5E/$_Globals{MAC_ADDRESS}/ 
c:\\cygwin\\etc\\dhcpd\\dhcpd.conf}) or die;

}
It works but now I wanted that 00:80:9F:2E:3F:5E to be  a variable .
I wanted to have this:

if ($line =~ /^host clin09/){

system(q{perl -i.orig -pe s/$MAC_ADR/$_Globals{MAC_ADDRESS}/ 
c:\\cygwin\\etc\\dhcpd\\dhcpd.conf}) or die;

}

How can I check $MAC_ADR which is what there is after hardware ethernet in the 
file with a regex.

MAny Thanks.






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:delete the last 3 lines of a file

2001-12-06 Thread Jorge Goncalvez

Hi, I have a file which I write to it like this
 it ends by:

   
host clin09 {hardware ethernet 00:80:9F:2E:3F:5E;
filename /bootp/linux/pre3.1/alize/startup.txt;}

}

What I wanted to do is to delete this 3 end lines before to write to it, How can 
I do This in Perl?  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:how to patch a file

2001-12-06 Thread Jorge Goncalvez

Hi, I wanted to patch a file and I have this:

system(perl -i.rig -pe 's!/home/ftp!/!g'  c:\cygwin\etc\passwd)

it fails when I put in a script but it succeed if i run it by hand in a bash.
Why? Thanks  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Whats wrong with unlink?

2001-12-04 Thread Jorge Goncalvez

Hi, I wanted to delete all files under a directory but not the directory 
I tried this:
my ($_path) = c:/EventLogs/;
unlink $_path if -r $_path;

But it didn't delete teh files which are under the directory Eventslogs
Why?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:What's wrong with unlink?

2001-12-04 Thread Jorge Goncalvez

I tried :

#!/usr/bin/perl

my ($_path) = c:/EventLogs/;
unlink $_path/* if -r $_path;

But it still not working, I have 2 files under the directory when I run this 
script they are always here?

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:create an NT user with Perl

2001-12-04 Thread Jorge Goncalvez

HI, I wonder if there is a way to create an NT user with Perl?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:how to patch a file in Perl

2001-12-04 Thread Jorge Goncalvez

Thanks for all your previous help.
now I wonder how to patch a file in Perl:
There is my  file:
c:/cygwin/etc/passwd 

contains:
Exemple of /etc/passwd :
Tout le monde:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrateurs:*:544:544:,S-1-5-32-544::
Administrateur::500:513:,S-1-5-21-733626998-791112675-398547282-500:/home/Admini
strateur:/bin/bash
ftp::1001:513:,S-1-5-21-733626998-791112675-398547282-1001:/home/ftp:/bin/false
Invité::501:513:,S-1-5-21-733626998-791112675-398547282-501:/home/Invité:/bin/ba
sh
 I want to patch it by
 
 Exemple of /etc/passwd :
Tout le monde:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrateurs:*:544:544:,S-1-5-32-544::
Administrateur::500:513:,S-1-5-21-733626998-791112675-398547282-500:/home/Admini
strateur:/bin/bash
ftp::1001:513:,S-1-5-21-733626998-791112675-398547282-1001:/:/bin/false
Invité::501:513:,S-1-5-21-733626998-791112675-398547282-501:/home/Invité:/bin/ba
sh

in fact to change /home/ftp by /.

Thanks.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Delete all event in th even tlog

2001-12-03 Thread Jorge Goncalvez

I use the WIn32::EventLog and I wonder how to delete all event logs elements
I have this code:
#!/usr/local/bin/perl -w

use Win32::EventLog;
use File::stat;
use File::Find;
use strict;



my ($Event, @timearray, $filename,
$day, $month, $directory, $logfile, $fileage);

my $retrycount = 0;

#  Where do you want to put the backup files?

$directory = 'c:/Support/EventLogs/';

for ('Application', 'System', 'Security' )   {
 $retrycount = $retrycount + 1;
 if ($retrycount = 30 ) {$retrycount = 0; next};
 $Event = new Win32::EventLog ($_, );
 @timearray=localtime(time);
 $month = sprintf ('%.2d', $timearray[4] +1);
 $day = sprintf ('%.2d', $timearray[3]);
 $filename = $directory . ($timearray[5]+1900) . '_' .
   $month . '_' . $day . '_' . $_ . '.evt';
 print $filename\n;
 unless ($Event-Clear($filename)) {sleep 5; redo};
 $retrycount = 0;
 #`gzip -9 $filename`;
}

But it seems not to work what s wrong?
Thanks
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Regex problem

2001-11-29 Thread Jorge Goncalvez

Hi, I have this code:

$_Globals{IPCONFIG} = C:/ipconfig.txt;

 open (IPCONF, $_Globals{IPCONFIG}) or die je ne peux ouvrir 
$_Globals{IPCONFIG} :$!;
@ten=IPCONF; close IPCONF;
foreach(@ten){
chomp();

if ($_ =~/Adresse IP/) {
$_ =~ s/.+://;

$_ =~ s/\d+$/0/;

print $_;
push @IP, $_;

}
}

In this case $_ semms to memorise the first regex but not the second .Why?  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: a little help in autoincrement IP addresses

2001-11-29 Thread Jorge Goncalvez

I wanted to print this in a file:

subnet  $var1 netmask 255.255.255.0{range dynamic-bootp $var2 $var3;
}

$var1,$var2,$var3 are IP adress.
I do it and It works but now I wanted to do this:

In fact I wanted for exemple:$var2=192.40.54.n and $var3=192.40.54.n+10
How can I do this in Perl 

Thanks  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:2 last number with a regex

2001-11-29 Thread Jorge Goncalvez

How can I check the last 2 number of an IP adress and increment it by 10.
for exemple:
$IP=192.40.54.41

Th elast 2 number is 41 i increment it by 10.

$IP1=192.40.54.51


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:parent window in Perl TK

2001-11-28 Thread Jorge Goncalvez

Hi, I wonder if it is possible to create a new window(children) that could herit 
all variables of a parent window in Perl TK under Windows .
So how can we do?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:How to print and go to the next line

2001-11-27 Thread Jorge Goncalvez

Hi, I have this:
print NOUVEAU $newline2\n or die je ne peux écrire dans $nouveau : $!\n;

But it  prints but didn't go to the next line(\n seems to be ignored)
Why?
Thanks.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:help on Regex

2001-11-27 Thread Jorge Goncalvez

Hi I have this:

my $ip=192.40.54.41;

$ip=~ s/(\d+\.\d+)\.(\d+\.\d+)/$1\.0/;

print $ip;

But It didn't work it displays 192.40.0 and I wanted to display 192.40.54.0.
Why? thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to get rid of the last Ip number with a regex

2001-11-26 Thread Jorge Goncalvez

Hi, I have this:
open (IPCONF, $_Globals{IPCONFIG}) or die je ne peux ouvrir 
$_Globals{IPCONFIG} :$!;
@ten=IPCONF; close IPCONF;
foreach(@ten){
chomp();

if ($_ =~ /Adresse IP/) {

$_ =~ s/.+://;
push @Ip,$_;
  }
  

}

   What I wanted is to get rid of this for exemple $_=192.40.54.41 I would like 
to put $_=192.40.54.00.
   
 In fact to get rid of the last 2 numbers and put 0.0 instead . 
 
 Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:delete a line of a file

2001-11-26 Thread Jorge Goncalvez

Hi, I would like to parse a file and delete the entire line if it begins with 
subnet.
How can I do this in Perl?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:slash issue on a regex

2001-11-22 Thread Jorge Goncalvez

Hi, I have this:

$buf=~(/d:/dhs3mgr/e1401/dhs3linux/fr/cpiofile/)

but it didn't work.How can i do to escape the /.
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:disable a frame

2001-11-20 Thread Jorge Goncalvez

Hi, How can I do to disable a frame which contains some widget in it in Perl TK?
Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Kill a process

2001-11-16 Thread Jorge Goncalvez

Hi, I wonder how can I know if a process for exemple dhcpd is running and if it 
is how can I kill it in Perl.
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Win32::EventLog

2001-11-15 Thread Jorge Goncalvez

HI, I am using a script with Win32::EventLog on NT but I wonder if it is 
possible when I init my application to del all logs that are in the Event Log in 
the directory Application  of the Event Log.

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Perl rename File

2001-11-14 Thread Jorge Goncalvez

Hi,I have a perl tk application that create a file c:/cygwin_syslog.txt.
I have this file c:/cygwin_syslog.txt, How I can do to verify if this file 
exists at the init of my application, if it exists I would rename it in 
c:/cygwin_syslog.bck0, and recreate one with the same name ie cygwin_syslog.txt 
empty and ready to be appended.
I do the same when i restarted my application, if cygwin_syslog.txt already 
exists  I rename it in cygwin_syslog.bck1 and every time I restart my app It 
would be rename till cygwin_syslog.bc9.
How can I do this in perl .
Thanks 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:regex with /

2001-11-14 Thread Jorge Goncalvez

I have this:
if($buf=~ qw(/bootp/linux/alize/tel/dhs3linux/fr/cpiofile/){
$_Globals{PROGRESS_VALUE}=100;
}
but it didn't work? why?
Thanks  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Radio Button Array

2001-11-09 Thread Jorge Goncalvez


Fist of all thanks for your previous help it really helps me.

Hi, How can do this in Perl TK: I have a radio button with 2 choices Intel or 
3Com in a menu.(it is $after[$_];
But this can be variable it depends (others choice with anothers strings could 
be possible).
How can i do this if the user select the first choise in the menu( ie in this 
case Intel for exemple) I put a variable $NIC=eth0 if he selects the second 
$NIC=eth1.

I have this code:
my $cc3 = $menu-cascade(-label = ~NIC);
for (0..$#after){
$cc3- radiobutton (-label=$after[$_],
  -value =$after[$_],
  -variable=\@NIC,
  -command =sub {cbkSetLangage});
  }
Thanks
  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Strings concatenation

2001-11-09 Thread Jorge Goncalvez

Hi, I have this:
my $_cmd = $_Os{$_Globals{OS}}{DHCPD} ;
system($_cmd) or Error(DHCPD);
it works but i would have this
my $_cmd = $_Os{$_Globals{OS}}{DHCPD} .  $eth;

$eth is a variable that could be for exemple $cmd=dhcpd eth0

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:What's wrong in this code

2001-11-08 Thread Jorge Goncalvez

Hello, i have this:

open (IPCONF, $_Globals{IPCONFIG}) or die je ne peux ouvrir 
$_Globals{IPCONFIG} :$!;
my (@_boards);
foreach (IPCONF) {
chomp();
if ($_ =~ /Description/) {
push @_boards, (split(/:\s*/, $_))[1];

foreach (@_boards){ $cc3- radiobutton (-label=$_,
-value =$_,
-variable=\$NIC,
-command =sub {cbkSetLangage});
}  
  
My radiobutton didn't display what there is in the array why?  



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:error return function

2001-10-30 Thread Jorge Goncalvez

Hi, I have this code:

if (/:\s*\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:/) {
my $host = gethostbyaddr (inet_aton ($_Globals{IP_ADDR}), AF_INET) or 
die je ne peux résoudre $_Globals($_Globals{IP_ADDR}) :$!\n; 
($_Globals{CLIENT_NAME})=$host=~ /^(\w+)/;
}

it works but how can i do to specify if the gethostbyaddr didn't work and I have 
died with je ne peux résoudre ...

I would like   ($_Globals{CLIENT_NAME}) = $_Globals{IP_ADDR} =~ /^(\w+)/; in 
case of gethostbyaddress failed.

Thanks. 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:create an empty file

2001-10-30 Thread Jorge Goncalvez

Hi, How do u create an empty file named c:\cygwin_syslog.txt in Perl?
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE:Write to a file

2001-10-30 Thread Jorge Goncalvez




Hi, I would write to a file c:\cygwin\etc\dhcpd\dhcpd.conf which contains this:
vendor-class PXEClient {
filename /bootp/linux/pxe/pxeloader ;
default-lease-time 1800;
max-lease-time 1800;
option host-name CLIN_1 ;
...
I want to put here my string
...

my string is a concatenation of 3 variables:var1, var2, var 3. 

How can I do this in Perl?
Thanks   




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:How to assign an array variable to an Entry Box

2001-10-23 Thread Jorge Goncalvez

Hi, I have this:
$_varRef=@_;
$frm-Entry(-relief = sunken,
   -textvariable = \$_varRef,
   -width = $_Globals{LABEL_LENGTH},
   #-anchor = w,
   -bg = white)
-pack(-anchor = w);


 But it doesn't work I wanted to assign in the -textvaraible option a variable 
which could be an array.   


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Parsing a file with regex

2001-10-22 Thread Jorge Goncalvez

Hi, How can I do to parse a file(c:\cygwin\etc\DHCPD\dhcpd.conf) which is for 
exemple a part which contains:
host col36545c {
hardware ethernet 00:02:A5:31:7D:7C;
option vendor-encapsulated-options install:KLOR_1:%77.90;
filename /bootp/linux/pxe/pxeloader ;
#next-server server21;
} 

 In fact the line important is 
  option vendor-encapsulated-options install:KLOR_1:%77.90:standard=E1302.fr;
  
  How can i do to get what is after % ie in this exemple 77.90
  to get what is between : and = ie standard
  and finally to get E1302.fr.
  
  I wanted to assign this 3 fields in 3 label widget.
  
  How can I do this?
  
  Thanks 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Fill in a file

2001-10-22 Thread Jorge Goncalvez



Hi, I have this code:
@_FieldEntries =qw {VER TI TV};
sub MakeEntries()
{
my $myframe = $_Globals{TOP_WINDOW}-Frame(-label = ,
 -relief = groove,
 -borderwidth = 2)
-pack(-anchor = w,pady = 20);

foreach (@_FieldEntries) {
MakeOneEntry($myframe, $_);
}
}

sub MakeOneEntry($$)
{
my ($frm, $lbl) = @_;

my $_str = $_Strings{$_Globals{LANGAGE}}{$lbl};
my $_varRef = $_Labels{$lbl};

$frm-Label(-textvariable = \$_str)
-pack(-anchor = w);
return $frm-Entry(-relief = sunken,
   -textvariable = $_varRef,
   -width = $_Globals{LABEL_LENGTH},
   #-anchor = w,
   -bg = white)
-pack(-anchor = w);
}

It draw 3 Entries widget what I wanted to do is to get the first field entered 
by the user ie ($_varRef) to fill in a file when there is a line with this:
option vendor-encapsulated-options install:XXX:%version:type of 
installation=tel version.
an exemple would be:
option vendor-encapsulated-options 
install:KLOR_1:%77.90:standard=/tel/E1302.fr;

%77.90 would be the first $_varRef,standard the second and /tel/E1302.fr the 
third.

Thanks 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Dns and gethostbyaddr in Perl

2001-10-18 Thread Jorge Goncalvez

Hi, I parse a log file in Perl Tk and I have for exemple this line:

LOG_INFO : cabs41.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: 
success

I have 2 labels to display the informations:
in one I put  cabs41.col.bsf.alcatel.fr
in another I put only cabs41

My code is 

 open FILE,  $_Globals{SYSLOG} or die $!;
while (FILE) {
if (/([0-9a-z:]+)\s*via eth0/) {
$_Globals{MAC_ADDR} = $1;
} elsif (/read request for/) {
($_Globals{IP_ADDR}, $_Globals{INSTALL_FILE}) = 
m[:\s*(\S+):.+?(/\S+):];
($_Globals{CLIENT_NAME}) = $_Globals{IP_ADDR} =~ /^(\w+)/;
#$nom = gethostbyaddr(inet_aton($_Globals{CLIENT_NAME}),AF_INET)
#or die je ne peux résoudre $_Globals{CLIENT_NAME} :$!\n;
($_Globals{BOOT_FILE}) = $_Globals{INSTALL_FILE} =~ /([\w.]+)$/;
}
}
close FILE;

but sometines I don't have the Dns informations and I can have:
    :192.40.54.42: read request for /bootp/linux/pre2.2/linux.ram: success  
(Cygwin)
   
   so my first label will display 192.40.54.42
   but my second will display only 192 which is a nonsense.
   
   How can i do to retrieve from the ip address the name which corresponds if it 
is neccesary.
   
   with gethostbyaddr for example.
   
   Thanks 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Env command in Perl

2001-10-05 Thread Jorge Goncalvez

HI I wanted to do this:
my _$cmd=env SHELL = /bin/bash d:\dhcp\server\dhcpd.exe eth0;
system(_$cmd) ;

but it doesn't work why?
Thabks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:configure Issue

2001-09-27 Thread Jorge Goncalvez

Hi, I have the following problem I wanted to change the number of blocks of a 
progress bar when it reaches 50.
My code is:

if ($_Globals{PROGRESS_VALUE} = 50) {

$pb-configure(-blocks=100);
$pb-update();
$_Globals{PROGRESS_VALUE} +=1;
$_Globals{PROGRESS_STRING} = FTPD;
}

my $pb  = $_Globals{TOP_WINDOW}-ProgressBar(-bd = 3,
 -relief = sunken,
 -fg = green,
 -width = 30,
 -length = 600,
 -variable = 
\$_Globals{PROGRESS_VALUE},
 -colors = [0, green, 40, 
orange, 50, red]
 
But I have an Tk:Error:  Can't call method configure on an undefined value
Why?

Thanks.   


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Win32::EventLog and Open issue

2001-09-26 Thread Jorge Goncalvez

HI, folks I am under NT and my problem is that my file cygwin_syslog.txt is 
always growing with the same informations that is boring.If I append with 
open(LOGFILE ...) the file is always destroyed and I have only one information 
and I want the whole logs informations I want to use open(LOGFILE ...)






I have this code :
open (READ,$_Globals{TIME})or die Can't open READ: $!\n;
$timewritten = READ;
close (READ) or die Can't close READ: $!\n;

$x = 0;

$handle=Win32::EventLog-new(Application)
or die Can't open Application EventLog\n;
$handle-GetNumber($recs)
or die Can't get number of EventLog records\n;
print No. of records = $recs\n;
$handle-GetOldest($base)
or die Can't get number of oldest EventLog record\n;
print Oldest record is record no. $base\n;


#POur écrire à la suite du fichier les infos de log mais bug fait 
grandir le fichier 

# To append:
open (LOGFILE,C:\\cygwin_syslog.txt) or die Can't open LOGFILE: 
$!\n;

# Or to overwrite (in which case you don't have to create the file).
#mais détruit les infos ultérieures génants.

#open (LOGFILE,$_Globals{SYSLOG}) or die Can't open LOGFILE: $!\n;
my $time;
foreach (0 .. $recs - 1) {
$handle-Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
  $base + $_,
  $hashRef)
or die Can't read EventLog entry #$x\n;

my %deref;
%deref = %$hashRef;

# Next line is new #
next if ($timewritten  $deref{TimeGenerated});

foreach (qw{Cygwin dhcpd ftpd}) {
if ($deref{Source} eq $_) {
print LOGFILE $deref{TimeGenerated}: $deref{Strings} ($_)\n;
}
}

# Next 2 lines are new #
$time = $deref{TimeGenerated} if ($time  $deref{TimeGenerated});


}

close (LOGFILE) or die Can't close LOGFILE: $!\n;

# Next 3 lines are new #
open (WRITE, $_Globals{TIME}) or die Can't open WRITE: $!\n;
print WRITE $time;
close (WRITE) or die Can't close WRITE: $!\n;


1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re:dynamic Progress bar

2001-09-26 Thread Jorge Goncalvez

Hi I would like to make a dynamic Progress bar which could grow up with the 
number of string ftpd received in a log file.Each square means that a ftpd 
arrived on the log file.
How can I do this?

My code is:

open INFILE,  $_Globals{SYSLOG} or die Cannot open $_Globals{SYSLOG} for 
reading: $!;
while (INFILE) {
chomp();


/ftpd/  do {
#i.e  ftpd



$_Globals{PROGRESS_VALUE} += 10;
$_Globals{PROGRESS_STRING} = FTPD;
};

my $pb  = $_Globals{TOP_WINDOW}-ProgressBar(-bd = 3,
 -relief = sunken,
 -fg = green,
 -width = 40,
 -length = 300,
 -variable = 
\$_Globals{PROGRESS_VALUE},
 -colors = [0, green, 40, 
orange, 50, red]
 )
-pack(-side = left,-anchor = w);
$pb-Scale(-from = 0, -to = 150);




Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Delete a line in a file

2001-09-24 Thread Jorge Goncalvez

Hi, I would delete a file if it is already present.
for exemple I have:
1001337334: dhcpd : DHCPDISCOVER from 00:b0:d0:23:80:67 via eth0 
1001337334: dhcpd : Reclaiming abandoned IP address 192.40.54.41. 
1001337334: dhcpd : (DHCPDISCOVER) (ack_lease) CLASS_IDENTIFIER = PXEClient 
1001337334: dhcpd : arp -d 192.40.54.41 
1001337334: dhcpd : DHCPOFFER on 192.40.54.41 to 00:b0:d0:23:80:67 via eth0 
1001337334: dhcpd : DHCPDISCOVER from 00:b0:d0:23:80:67 via eth0 
1001337334: dhcpd : (DHCPDISCOVER) (ack_lease) CLASS_IDENTIFIER = PXEClient 
1001337334: dhcpd : arp -d 192.40.54.41 
1001337334: dhcpd : DHCPOFFER on 192.40.54.41 to 00:b0:d0:23:80:67 via eth0 
1001337334: dhcpd : DHCPREQUEST for 192.40.54.41 from 00:b0:d0:23:80:67 via eth0 
1001337334: dhcpd : (DHCPDISCOVER) (ack_lease) CLASS_IDENTIFIER = PXEClient 
1001337334: dhcpd : arp -d 192.40.54.41 
1001337334: dhcpd : DHCPACK on 192.40.54.41 to 00:b0:d0:23:80:67 via eth0 

I would to delete the first 1001337334: dhcpd : DHCPOFFER on 192.40.54.41 to 
00:b0:d0:23:80:67 via eth0 because it is repeated.

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Regular Expression needed?

2001-09-20 Thread Jorge Goncalvez

Hi, folks

I have 5 labels in a perl tk program.

I have this line in my file:

1000975996: 44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: 
success .

my code is :
open FILE,  $SYSLOG or die $!;
while (FILE) {
if (/([0-9a-z:]+)\s*via eth0/) {
$MAC_addr = $1;
} elsif (/read request for/) {
($IP_addr, $install_file_path) = m[:\s*(\S+):.+?(/\S+):];
$client_name = $IP_addr =~ /^(\w+)/;
$boot_file = $install_file_path =~ /([\w.]+)$/;
}



my fist label works fine ie :$Mac_addr
my second too ie:$IP_addr
my third is wrong I have $client_name wich displays 1 instead of 44CGMB114
my forth is wrong too ie $bootfile displays 1 instead of cygwin.bat
my fith is good it displays /bootp/cygwin.bat.

Could you help me why my 2 labels are wrong.
Thanks a lot


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Set up issue

2001-09-17 Thread Jorge Goncalvez


- Begin Forwarded Message -



Hi, I made a perl tk software which runs under Windows.Its name is frame14.pl.
Now I wanted to create a set up program which could create in the Windows 
desktop a group of progra which contains one icon called Boot server.

By double clicking on this icon, tje yuser starts my frame14.pl.

How can I do this in perl tk?please

Thanks.

___


- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Regular expression needed

2001-09-14 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Fri, 14 Sep 2001 11:46:54 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re: Regular expression needed
To:[EMAIL PROTECTED]
Mime-Version: 1.0
Content-MD5: BW3TUqtgmcGzRIcQHrT+CQ==

Hi, I have this line:

dhcpd : LOG_INFO : DHCPDISCOVER from 
02:41:53:20:d0:34:5b:a6:ef:3c:c1:01:01:00:00:00 via eth0

How can I do to make the test if this line contains the word DHCPDISCOVER?

- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Parse a file

2001-09-13 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Thu, 13 Sep 2001 10:45:03 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re: Parse a file

Mime-Version: 1.0
Content-MD5: DZmPkpqQxHxJV6ZMZxyK0Q==

Hi folks, I wanted to parse a file which is always growing.
If this file contains first the word DHCPDISCOVER, I wanted to display a 
progress bar with 4 square and the first square is checked.
Then if the file contains DHCPOFFER, I wanted to display the second square.
Then if the file contains DHCREQUEST, I wanted to display the third square.
and finally if the file contains DHCPACK, I wanted to display the fourth square.

How can I do this in Perl Tk?

Thanks.  

- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:seek a string

2001-09-13 Thread Jorge Goncalvez

Hi, I would like to open a file and know if a string exists.
How can I do this?
Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:File Array

2001-09-13 Thread Jorge Goncalvez

Hi, How in Perl you can store each line of a file in an array?

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Function Parameters Problem

2001-09-12 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Wed, 12 Sep 2001 16:51:13 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re: Function  Parameters Problem
Mime-Version: 1.0
Content-MD5: /AKUA+PVUkkQyC62C5CZ8A==

Hi, I have this code:

makelabels($language_EA,$ethernet_address);
makelabels($language_IP,$IP_address);
makelabels($language_CN,$client_name);
makelabels($language_BF,$boot_file);
makelabels($language_FP,$install_file_path);

sub makelabels
{   


$myframe-Label(-textvariable=\$x)-pack(-anchor='w');
my $label1=$myframe-Label(-relief='sunken',
  -textvariable=\$y,
  -width=$lw,
  -anchor='w',
  -bg='white')-pack(-anchor='w');

}



I want that \$x and \$y take the different parameter .

How can I do this in Perl Thanks

- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Seek issue

2001-09-11 Thread Jorge Goncalvez

Hi, I have this code:
open FILE,  $SYSLOG or die $!;
seek FILE,10,2;
read FILE,$buf,10;


if($buf =~ /success$/) 

   And there is always nothing in $buf althought the file ends with success.
   
   Why? 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:don't begin

2001-09-10 Thread Jorge Goncalvez

How in Perl you specify a line in a file that don't begin with something for 
exemple I wanted to specify the last line of my file don't begin with 
LOG_INFO,dhcpd or ftpd ?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: File Arguments

2001-09-10 Thread Jorge Goncalvez

Hi, I have this code:
$PROG2 = C:\\cygwin\\usr\\X11R6\\bin\\XWin.exe ;
if (-f $PROG2)
{   
system($PROG2)
}


but I must take some arguments to this:I must execute with theses arguments:

C:\cygwin\usr\X11R6\bin\XWin.exe -screen 0 800x600x16

how i can do this?

Thanks  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:tie handle problem

2001-09-10 Thread Jorge Goncalvez

Hi, I have this code :
tie *FILE,'File::ReadBackwards', 'c:\\cygwin_syslog.txt'
or die Can't read logfile.txt: $!;
$lastline = FILE;
if(defined $lastline and $lastline =~ /^LOG_iNFO/) 
{   
#do something

}
I have the following error:

Can't locate object method TIEHANDLE via package File::ReadBackwards
 althought I have successfully installed File::ReadBackwards.
 
 Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:If always verified

2001-09-10 Thread Jorge Goncalvez

Hi, I have this code:

 tie *FILE,'File::ReadBackwards', 'c:\\cygwin_syslog.txt'
or die Can't read logfile.txt: $!;
$lastline = FILE;
if(defined $lastline and $lastline =~ /$success/) 
{
..
}

The if statement is always verified even the last line don't end with success.

Why?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problem with open

2001-09-10 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Mon, 10 Sep 2001 18:11:06 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re: Problem with open
To: [EMAIL PROTECTED]
Mime-Version: 1.0
Content-MD5: hoCpfVU18Iz7US62lINUDg==

Hi, I made a program which runs good the first time but wrong when I do a repeat 
method:
My code:
sub check_syslog
{.
if( Win32::IsWin95() )
{
open FILE,  $SYSLOG or die $!;
while (FILE)
{
if (/([0-9a-z:]+)\s*via eth0/)
{
 ($ethernet_address) = $1;
}
elsif (/read request for/)
{
($IP_address, $install_file_path) = 
m[:\s*(\S+):.+?(/\S+):];
($client_name) = $IP_address =~ /^(\w+)/;
($boot_file) = $install_file_path =~ 
/([\w.]+$)/;
}
}

#close FILE;
}

elsif( Win32::IsWinNT() )

{
#use Win32::EventLog;
}


open SYSLOG,c:/cygwin_syslog.txt || die can't open: $!;
while (SYSLOG)
 {
chomp;

open FILE,  $SYSLOG or die $!;
tie *FILE,'File::ReadBackwards','c:\\cygwin_syslog.txt'
or die Can't read logfile.txt: $!;
$lastline = FILE;
if(defined $lastline and $lastline =~ /success$/) 
{
use Test;
my $var = 0;
my $pb  = $mw-ProgressBar(-bd = 3,
   -relief = 'raised',
   -fg = 'yellow',
   -variable = \$var,
   -colors = [0, 'yellow'
]
)-pack(-side ='left',-anchor 
='w');


$pb-cget('-from');
$pb-cget('-to');

for my $v (map(10*$_+3,1..10))
{
$var = $v;
$pb-cget('-value');
$mw-update;
sleep 2; # This line added by Sisyphus
#if ($v==100) {
#$pb-destroy();
  #}
}


}   

if(defined $lastline and $lastline =~ /^dhcpd/) 
{   use Test;
my $var = 0;
my $pb  = $mw-ProgressBar(-bd = 3,
   -relief = 'raised',
   -fg = 'yellow',
   -variable = \$var,
   -colors = [0, 'green'
]
)-pack(-side ='left',-anchor 
='w');


$pb-cget('-from');
$pb-cget('-to');

for my $v (map(10*$_+3,1..10))
{
$var = $v;
$pb-cget('-value');
$mw-update;
sleep 2; # This line added by Sisyphus
#if ($v==100) {
#$pb-destroy();
  #}
}


}   

close SYSLOG;

}

 

}


I do a repeat method like this:
$mw-repeat($msdelay,[\check_syslog,$SYSLOG]);


In fact I have this problem when the repeat method is executed:
 readline() on closed filehandle SYSLOG at frame7.pl line 323.
Tk::Error: Can't locate object method OPEN via package File::ReadBackwards (
perhaps you forgot to load File::ReadBackwards?) at frame7.pl line 297.


Thanks.


- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Last line

2001-09-07 Thread Jorge Goncalvez

Hi, how to parse the last line of a file.

I have this code:
$pb-destroy unless($last_line=~/^dhcpd|LOG_INFO|ftpd/);

$last_line=??

The file is already open.

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:chomp issue

2001-09-06 Thread Jorge Goncalvez

Hi, folks I made a file parser to display a progress bar which could tell which 
service is running:dhcpd, tftpd or ftp.Each service has its own color.
My problem is that the progress bar didn't stop and I want only a progress bar 
that could be destroyed after displaying which service was running.
My code:
open SYSLOG,c:/cygwin_syslog.txt || die can't open: $!;
while (SYSLOG)
.


Thanks. 


#!/usr/local/bin/perl -w

use Tk;
use Win32::DriveInfo;
use Tk::ProgressBar;
use Win32::API;
use Win32;


# User Defined Declarations -

my $status_var = 0;
my $lw=40; #width of labels
#my $ethernet_address ='Ceci est un test'; #fixed for now
my $IP_address; #self-explanatory
my $client_name; #as is this
my $boot_file; #another -textvariable to be used
my $install_file_path;
my $SYSLOG='C:/CYGWIN_SYSLOG.TXT'; #your file to be parsed
my $dialog; #declare here, not in the sub
my $msdelay=5000; #5 second delay..until callback
my $mtime=1; #initialize to something other than $thistime
my $thistime=0; #variable to hold current 'stat' check
my $language=ENGLISH;
 

# Main Program ---
my $mw = MainWindow-new( -title = Serveur d'installation 
 );
$mw-geometry('570x500');
setlanguage;
makemenu;
makeButtons;
makeframe;

makelabels;

my $Percent_Done = 100;   # Starting point


makeProgressBar;

$image = $mw-Photo(-file = logo_alcatel.gif);


check_syslog($SYSLOG);
$mw-repeat($msdelay,[\check_syslog,$SYSLOG]);



MainLoop;

# Subroutines 
sub setlanguage
{
#static variables defined in main and changed in this sub

  if ($language eq 'ENGLISH')
 {
$language_EA='Client Ethernet address';
$language_IP='IP Address';
$language_CN='Client Name';
$language_BF='Boot File';
$language_FP='Installation File Path';
  }
  elsif ($language eq 'FRENCH')
 {
$language_EA='Adress Ethernet du Client';
$language_IP='Adresse Ip Du Client';
$language_CN='Nom du Client';
$language_BF='Fichier';
$language_FP='Chemin installation';
  }

}



sub restart_serv
{

if( Win32::IsWin95() )

{

#for (sort keys %ENV) { print $_is $ENV{$_}\n }

$PROG = c:\\cygwin\\usr\\sbin\\inetd.exe;
if (-f $PROG)
{   
system($PROG)
}

else
{

require Tk::Dialog;
$dialog =$mw- Dialog( -title = 'INETD ALERT ',
-text = Impossible de trouver Inetd, 
-font = Arial 14 normal,
-justify = 'center',
-default_button = 'OK',
-bitmap ='error',
-buttons = [qw/OK/] );


$dialog-Show;

}

#or die  je n'ai pas pu redémarrer : $!\n;






}

elsif( Win32::IsWinNT() )

{

system(net stop inetd);
system(net start inetd); 



}

}

sub setdeletefile
{
open(FILE, c:/cygwin_syslog.txt);
close(FILE);
$Status_Text = $count lines read (0 %);
$mw-update;

}

sub makeframe
{
 $myframe=$mw-Frame(-label = ,
   -relief = 'groove',
   -borderwidth = 2)-pack(-anchor='w',pady =40);


}

sub makelabels
{   

#$mw-Label(-text=)-pack(-anchor='w',-side = 'top');
#$mw-Label(-text=)-pack(-anchor='w',-side = 'top');
#$mw-Label(-text=)-pack(-anchor='w',-side = 'top');
$myframe-Label(-textvariable=\$language_EA)-pack(-anchor='w');
my $label1=$myframe-Label(-relief='sunken',
  -textvariable=\$ethernet_address,
  -width=$lw,
  -anchor='w',
  -bg='white')-pack(-anchor='w');

$myframe-Label(-textvariable=\$language_IP)-pack(-anchor='w');
my $label2=$myframe-Label(-relief='sunken',
  -textvariable=\$IP_address,
  -width=$lw,
  -anchor='w',
  -bg='white')-pack(-anchor='w');

$myframe-Label(-textvariable=\$language_CN)-pack(-anchor='w');
my $label3=$myframe-Label(-relief='sunken',
  -textvariable=\$client_name,
  -width=$lw,
  -anchor='w',
  

Re:destroy a widget

2001-09-06 Thread Jorge Goncalvez


- Begin Forwarded Message -

Date: Thu, 6 Sep 2001 17:12:36 +0200 (MEST)
From: Jorge Goncalvez goncal11@cabs40
Subject: Re:destroy a widget
To: [EMAIL PROTECTED]
Mime-Version: 1.0
Content-MD5: StW+EWXtFYgHx7cbJ1AqZA==

Hi, I would like to parse the last line of a file, if it begins with something 
different of dhcpd, LOG_INFO or ftpd I want to destroy a widget.
How can I do this in Perl TK?

Thanks. 

- End Forwarded Message -



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Parse file

2001-09-05 Thread Jorge Goncalvez

Hi, I have a file which looks like :

dhcpd : LOG_INFO : Internet Software Consortium DHCP Server 2.0
dhcpd : LOG_INFO : Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software 
Consortium.
dhcpd : LOG_INFO : All rights reserved.
dhcpd : LOG_INFO : 
dhcpd : LOG_INFO : Please contribute if you find this software useful.
dhcpd : LOG_INFO : For info, please visit http://www.isc.org/dhcp-contrib.html
dhcpd : LOG_INFO : 
dhcpd : LOG_INFO : Listening on Socket/eth0/155.132.0.0
dhcpd : LOG_INFO : Sending on   Socket/eth0/155.132.0.0
dhcpd : LOG_INFO : DHCPDISCOVER from 
52:41:53:20:c0:f6:c8:35:6c:80:c0:01:01:00:00:00 via eth0
dhcpd : LOG_ERR : Booting denied, no alcatel XID and the vendor class is empty
dhcpd : LOG_INFO : DHCPDISCOVER from 
52:41:53:20:b0:c0:d0:69:49:34:c1:01:01:00:00:00 via eth0
dhcpd : LOG_ERR : Booting denied, no alcatel XID and the vendor class is empty
LOG_INFO : cabs41.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: 
success.


How can I extract what is betwwen DHCPDISCOVER from and via eth0?

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re:Parse a file

2001-09-03 Thread Jorge Goncalvez

Hi, folks, I have to parse a file which looks like this:

dhcpd : LOG_INFO : DHCPDISCOVER from 
52:41:53:20:c0:f6:c8:35:6c:80:c0:01:01:00:00:00 via eth0

and I wanted to extract only this 
52:41:53:20:c0:f6:c8:35:6c:80:c0:01:01:00:00:00

How can I do this with R.E.

Thanks.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  1   2   >