RE: Convert .bat files to .com

2004-06-11 Thread Stacy Doss
This is your offending line.
  system ('BAT2EXEC.COM $file') # $file contains the batch file(s) name.

You might want to try this if you can't figure out what is wrong with that
line.

if($file =~ /(.*).bat/) {
  system('RENAME', "$file", "$1.exe");
}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Friday, June 11, 2004 12:12 PM
To: Mike Jackson; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Convert .bat files to .com


I don't completely understand why we need to convert all
these. I have a solution though "I think". My below snippet
goes into a directory where all the .bat files and the
bat2exe.com utility is. How can I as I loop through all the
files automatically, and the utility to execute them ..
Something like..


sub process_find {
my $file = $File::Find::name;
chomp($file);

$file =~ s/c:\/batch test\///;

if($file =~ /.bat/) {

# Here is where I'm stuck. How can
# I execute the BAT2EXEC.COM file
# with the .bat argument. The below works
# at the command prompt, but I need to 
# automate this..

# c:\>BAT2EXEC.COM test.bat
# c:\>BAT2EXEC.COM test2.bat
# etc...

system ('BAT2EXEC.COM $file') # $file contains the batch
file(s) name.
}

}

Allan


On Sat, 12 Jun 2004 02:40:44 +1000
 Mike Jackson <[EMAIL PROTECTED]> wrote:
> .com files are fundamentally different to .bat files: a
> .bat file holds a list of commands to be executed by the
> shell/command interpreter. a .com file is a compiled,
> native machine code binary program. To convert one into
> the other, you would have to write a program that creates
> a .com file that merely feeds all the commands in the
> .bat to your command interpreter - exactly the same as
> what happens if you just run the .bat, but with an extra
> step!
> 
> if you seriously need .com files, re-write the files in
> C.
> 
> On Thu, 10 Jun 2004 16:56:07 -0400, <[EMAIL PROTECTED]>
> wrote:
> 
> >I have a folder with about 1400 .bat files that I need
> to
> >convert to .com files. Is there a Perl way to traverse
> this
> >directory and do this? I assume that each .bat file will
> >need to be compiled into a .com file. Any ways, has
> anyone
> >done this?
> >
> >Thank you
> >Allan
> >___
> >Perl-Win32-Users mailing list
> >[EMAIL PROTECTED]
> >To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> >
> 
> 

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


RE: regular expression question

2004-04-01 Thread Stacy Doss
$a = "this is a (test)";
$a =~ s/\W+/_/g;

HTH

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, April 01, 2004 11:28 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: regular expression question


Thanks for the replying.

I have another question, if I have a string like 
$a = "this is a (test)";

How can I change it to 
$a = "this_is_a_test";

How can I remove ()?

Thanks

Lixin


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
$Bill Luebkert
Sent: Wednesday, March 31, 2004 8:27 PM
To: [EMAIL PROTECTED]
Subject: Re: regular expression question

Wagner, David --- Senior Programmer Analyst --- WGO wrote:

Hey guys - what's with the HTML ?

> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, March 31, 2004 16:49
> To: [EMAIL PROTECTED]
> Subject: regular expression question
> 
> I have a $a which
> 
>  
> 
> $a = "this is a test";
> 
>  
> 
> How can I change $a like:
> 
>  
> 
> $a = "this_is_a_test";
> 
>  
> 
> No problem using $a, but if I were you, I would not.  In the Perl
> sort $a, $b are the default variables to use and I would stay away if I
> were you.
> 
>  
> 
> That said,
> 
> $a =~ s/ /_/g;

You could also use tr (slightly faster) :

$a =~ tr/ /_/;

-- 
  ,-/-  __  _  _ $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
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: what is this expr doing exactly?

2002-10-22 Thread Stacy Doss
Actually not a typo-

Subs a path prefix in $curren with $self->{'Dir'}
Thus

$currn = '/usr/local/bin/perl';
$self->{'Dir'} = '/home/joe';
$currn =~ s+.*/([^/]*)+$self->{'Dir'}/$1+ if defined($self->{'Dir'});
# results in 
$currn == /home/joe/perl

Here's what's happening;
$currn =~ # I'll assume you know what this does
s # Substitution
+ # Start substitution delimiter (A very bad one, but one
non-the-less)
.*/([^/]*)# Match portion of delimeter, 
  # greedly matches lots o'characters 
  #   followed by a / 
  #   followed by anything thats not a / and remembering it
($1)
  #   til-end-o-string
+ # Substitution delimiter (A very bad one, but one
non-the-less)
  # Above match *should* match all of string (or none of it
if it dosen't contain a /)
$self->{'Dir'}/$1 # Substitues value of $self->{'Dir'} plus literal / plus
saved portion of match ($1)
  # This should replace the entire string
+ # End substitution delimiter (A very bad one, but one
non-the-less)

if defined($self->{'Dir'});  # Only do the above if $self->{'Dir'} is
defined.


Perhaps a better and straight forward way would be...

if (defined($self->{'Dir'})) {
   $currn =~ s:(.*/):$self->{'Dir'}:;
}

or

if (defined($self->{'Dir'})) {
   $currn =~ s/(.*\/)/$self->{'Dir'}/;
}

-Original Message-
From: $Bill Luebkert [mailto:dbe@;wgn.net]
Sent: Wednesday, October 23, 2002 12:24 AM
To: Reddy Kankanala
Cc: [EMAIL PROTECTED]
Subject: Re: what is this expr doing exactly?


Reddy Kankanala wrote:
> can some one tell me what is this doing? i found this in Logfile::Rotate
> 
> $currn=~ s+.*/([^/]*)+$self->{'Dir'}/$1+if
defined($self->{'Dir'});
Looks like a typo to me.  Take another look and use cut-n-paste and
double check it before posting.

-- 
   ,-/-  __  _  _ $Bill Luebkert   ICQ=162126130
  (_/   /  )// //   DBE Collectibles   Mailto:dbe@;todbe.com
   / ) /--<  o // //  http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_http://www.todbe.com/

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



RE: How can I figure out whether it is binary file or ASCII file under one directory?

2002-10-10 Thread Stacy Doss

Given a filename, use the -B or -T operators.
See perldoc ferlfunc

HTH

Stacy

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 1:34 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: How can I figure out whether it is binary file or ASCII
file under one directory?


Like .bin, .exe files, The format of the file is binary instead of ASCII.

Thanks

Lixin

-Original Message-
From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: RE: How can I figure out whether it is binary file or ASCII
file under one directory?


Can you be any more specific than "various binary files"?  

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 10, 2002 12:54 PM
To: [EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: How can I figure out whether it is binary file or ASCII file
under one directory?


Dear all,

A question, How can I figure out whether it is binary file or ASCII file
under one directory using perl? Does perl have a function for that? I
have a project to pick up various binary files from some directories.

Thanks in advance!
Have a nice day!

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



RE: Deep recursion on subroutine "Net::SNMP::_send_pdu" at C:/Perl/si te/lib/Net/SNMP

2002-07-26 Thread Stacy Doss

Fernando

The is a 100 count limit on recursion within perl (to avoid possible
infinite loops)

To filter out just that warning (but let other problems through)

perl < 5.6

local $SIG{__WARN__} = sub { $_[0] =~ /^Deep recursion/ or warn
$_[0] };

perl >= 5.6:

no warnings 'recursion';


-Original Message-
From: Fernando Madruga [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 3:50 AM
To: [EMAIL PROTECTED]
Subject: Deep recursion on subroutine "Net::SNMP::_send_pdu" at
C:/Perl/si te/lib/Net/SNMP



When using Net::SNMP in the script indicated below, I get these errors:

Deep recursion on subroutine "Net::SNMP::_send_pdu" at
C:/Perl/site/lib/Net/SNMP.pm line 2189.
Deep recursion on subroutine "Net::SNMP::snmp_dispatcher" at
C:/Perl/site/lib/Net/SNMP.pm line 1731.
Deep recursion on subroutine "Net::SNMP::Dispatcher::activate" at
C:/Perl/site/lib/Net/SNMP.pm line 576.
Deep recursion on subroutine "Net::SNMP::Dispatcher::_event_handle" at
C:/Perl/site/lib/Net/SNMP/Dispatcher.pm line 79.
Deep recursion on subroutine "Net::SNMP::Dispatcher::_callback_execute" at
C:/Perl/site/lib/Net/SNMP/Dispatcher.pm line 520.
Deep recursion on subroutine
"Net::SNMP::Dispatcher::_transport_response_received" at
C:/Perl/site/lib/Net/SNMP/Dispatcher.pm line 578.
Deep recursion on subroutine "Net::SNMP::Message::callback_execute" at
C:/Perl/site/lib/Net/SNMP/Dispatcher.pm line 346.
Deep recursion on subroutine "Net::SNMP::_get_table_cb" at
C:/Perl/site/lib/Net/SNMP.pm line 2165.

This script fetches all events (100 for Motorola V320 routers, 512 for
Motorola V65x0) and displays them. It *apears* to work ok, but I don't like
errors showing up, and if they do show up, then something is not 100% good.
How can I remove these errors? Increasing the stack space? How?

Thanks for any answer,
  Fernando Madruga

P.S.: I *do* know that removing the -w will stop displaying the errors, but
that's not what I'm looking for. I'm looking for a way to eliminate the
errors and *not* a way to hide them from view...

--- start cut 

#! C:\Perl\bin\perl.exe -w

use Net::SNMP;
use warnings;
use strict;

my ($session, $error) = Net::SNMP->session(
  -hostname  => shift || '172.31.20.25',
  -community => shift || 'public' );

  if ( !defined( $session ) ) {
printf( "ERROR: %s.\n", $error );
exit 1;
  }

my $EventsOID = '1.3.6.1.4.1.449.2.1.1.3.1.1.2';
my $result = $session->get_table( -baseoid => $EventsOID );

  if (!defined($result)) {
printf("ERROR: %s.\n", $session->error);
$session->close;
exit 1;
  }

my %sorted;
my ( $k, $v );

while ( ( $k, $v ) = each %$result ) {
  chomp $v;
  $k =~ s/$EventsOID\.//;
  $sorted{$k} = $v;
}

for ( $k = 1; $k <= 512; $k++ ) {
  if ( defined $sorted{$k} ) {
print "$k\t" . $sorted{$k} . "\n";
  };
};

$session->close;

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