RE: Regex Help Needed

2003-09-02 Thread Schneider, Kenneth (EKT)



how 
about sorting the letters first:
 
$var="meqgvn";
 
$sortedvar=join("", sort(split("", 
$var)));
 
if 
($sortedvar eq "egmnqv") {  print 
"yes!\n";}
--ken

  -Original Message-From: Dax T. Games 
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 
  12:26 PMTo: Perl UsersSubject: Regex Help 
  Needed
  I have a list of characters.  I need to get 
  a list of all possble sequences of these characters for example.  
  
   
  I have a string that consists of '-mevqgn' I need 
  to pattern match any combination of 'mevqgn' with a preceding - or 
  --.
   
  Right now this is what I am doing but it is very 
  ugly and difficult to come up with the combinations and it makes my brain 
  hurt!:
   
   if ($LS_Val =~ 
  /-{1,2}(mevqgn|   
  emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|   
  veqgnm|vqegnm|vqgenm|vqgnem|vagnme|   
  qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|   
  gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|   
  mgnevq|mngevq|mnegvq|mnevgq|mnevqg|   
  nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|   
  envqgm|evnqgm|evqngm|evqgnm|evqgmn|   
  )/i) 
  {    #Do Something;
  }
      
   
  A subroutine that takes the string of 
  characters as an argument and then returns 1 on success and undef on fail 
  would be ideal for my purpose.
   
   
  Any help is appreciated.
   
  Dax


Re: Illegal octal digit '9' problem??

2003-09-02 Thread Carl Jolley
On Tue, 2 Sep 2003, Keith C. Ivey wrote:

> steve silvers <[EMAIL PROTECTED]> wrote:
>
> > use strict;
> > my @numbers = (4,09,15);  # 09 will error, 9 won't error
> > my @numbers2 = (2,4,11);
> > my (%hash_lookup,%hash_lookup2);
> > @[EMAIL PROTECTED] = ('Y') x @numbers;
>
> If you had 07 it wouldn't give an error, but it still wouldn't
> work unless '7' (not '07') is one of your hash keys, because
> 07 would be converted to 7.  Hash keys are strings, and if you
> convert a number to a string it has no leading 0s.
>
> Numbers that start with 0 in Perl are interpreted as octal.
> Try this:
>
>print 010;
>
> It prints '8'.  That's why 09 is an illegal number, since 9 is
> not an octal digit.
>
> If you want to use something as a string (as a hash key), then
> it's better to set it to be a string rather than a number in
> the first place, so no unexpected conversions happen.  You can
> do this:
>
> my @numbers = ('4', '09', '15');
>
> or, equivalently,
>
> my @numbers = qw( 4 09 15 );
>
>

Of course then '19' lt '9' so the numeric sort wouldn't work very well.
The best bet it to not use leading zeros or quoted strings but use sprintf
on the decimal values to generate the string value (with leading zeros)
for use as the hash keys and, of course on any value used to index a
hash key/value.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

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


Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
$Bill Luebkert wrote:

> Dax T. Games wrote:
> 
> 
>>I have a list of characters.  I need to get a list of all possble
>>sequences of these characters for example. 
>> 
>>I have a string that consists of '-mevqgn' I need to pattern match any
>>combination of 'mevqgn' with a preceding - or --.
>> 
>>Right now this is what I am doing but it is very ugly and difficult to
>>come up with the combinations and it makes my brain hurt!:
>> 
>> if ($LS_Val =~ /-{1,2}(mevqgn|
>>   emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
>>   veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
>>   qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
>>   gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
>>   mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
>>   nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
>>   envqgm|evnqgm|evqngm|evqgnm|evqgmn|
>>   )/i)
>>{
>>#Do Something;
>>}
>>   
>> 
>>A subroutine that takes the string of characters as an argument and then
>>returns 1 on success and undef on fail would be ideal for my purpose.
> 
> 
> The above doesn't test all cases of the string - am I missing something
> in the description ?
> 
> Assuming each of the letters has to be present and there is only one
> occurrence of each letter (that may be a stretch) and the order can be
> any order:
> 
> # first check that we have the right letters
> 
> if ($LS_Val =~ /-{1,2}([mevqgn]{6})/i) {
> 
>   # then make sure we only have one of each
> 
>   if (check ($1)) {
>   print "found it\n";
>   }
> }
> 
> sub check {
> my %letters = map { $_ => 0 } split '', $LS_Val;

The above $LS_Val should be another var that has the letters in it or
just 'mevqgn' instead.

> map { return 0 if not exists $letters{$_} or $letters{$_}++ } split '', $_[0];
> return 1;
> }
> 
> 


-- 
  ,-/-  __  _  _ $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: Where am I going wrong with OLE and MS Word?

2003-09-02 Thread Krummel, James C - PGGC-6

Brad,

You where almost there.  Try inserting a section break instead of a page break, then 
select the range following the section break for the margin change.  This is like 
choosing 'From this point forward' in the 'Apply To' combo box in Page Setup.

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';

my($outputFile) = "c:\\check_this_file.doc";

my($WordApp) = Win32::OLE -> new('Word.Application', 'Quit');
$WordApp-> {Visible} = 1;
$WordApp -> Documents -> Add;

$PageSetup=$WordApp->ActiveDocument->PageSetup;
$PageSetup -> {LeftMargin}  = $WordApp -> InchesToPoints(0);
$PageSetup -> {RightMargin} = $WordApp -> InchesToPoints(0);
$PageSetup -> {TopMargin}   = $WordApp -> InchesToPoints(0);
$PageSetup -> {BottomMargin}= $WordApp -> InchesToPoints(0);

$coverart="c:/find-out_directory_cover.jpg";
$InsertCover=$WordApp->Selection->InlineShapes->AddPicture({FileName=>$coverart});

# // Start of Mods //
$InsertCover=$WordApp->Selection->InsertBreak({Type=>wdSectionBreakNextPage});
$PageSetup2=$WordApp->ActiveDocument->Range({Start=>$WordApp->Selection->Start, 
End=>$WordApp->ActiveDocument->Content->End})->PageSetup;
# // End of Mods //

$PageSetup2 -> {LeftMargin}  = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {RightMargin} = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {TopMargin}   = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {BottomMargin}= $WordApp -> InchesToPoints(0.75);

$WordApp->Selection->Font->{Size} = '12';
$WordApp->Selection->TypeText( "Let's try some text in here to see what happens." );
$WordApp->ActiveDocument->SaveAs({FileName=>$outputFile, 
FileFormat=>wdFormatDocument});
$WordApp->ActiveDocument->Close();
$WordApp->Quit();


James Krummel

>From: "Brad Smith" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Date: Tue, 02 Sep 2003 13:54:19 -0400
>Subject: Where am I going wrong with OLE and MS Word?
>
>I have written a little app, where I would like to dynamically create a 
>directory of resource providers, using Perl OLE and Word10.  I would 
>like the directory to contain:
>1.  A full page color graphic
>2.  Table of Contents
>3.  Contents:  each resource provider listed on a page, separated by a 
>page break.
>
>Each of these aspects I have successfully performed, individually.  
>Where I am having my problems is in setting ranges for different 
>formatting.  For instance, the first page, the cover art should bleed to 
>the edges.  Then, a page break, then the Table of Contents, with 1" 
>borders all the way around, page break, followed by the resource 
>provider listings, each separated by a page break and formatted w/ 1" 
>borders.
>
>I begin by using 'PageSetup' to set all margins to 0" (for full bleed).  
>Then, I add the InlineShape to the first page.  Everything works to that 
>point.  Now, I would like to reset the page borders to 1" all around and 
>begin adding the Table of Contents and other text.  Unfortunately, every 
>time I adjust the PageSetup parameters, ALL the margins are reset, 
>negating the 0" margins I had established for the cover art.
>
>I have read every archived email re: OLE and Word, combed my Office 
>Developer's Guide book (VBA), searched Google for anything available, 
>but the examples I have found do not address multiple page margins 
>within a single document.
>
>Below is the code I have written so far.  Is there anyone out there who 
>has fond experiences with OLE automation of Word who can help me 
>through this?  Thanks in advance.
>
>use Win32::OLE;
>use Win32::OLE::Const 'Microsoft Word';
>
>my($outputFile) = "c:/check_this_file.doc";
>
>my($WordApp) = Win32::OLE -> new('Word.Application', 'Quit');
>$WordApp-> {Visible} = 1;
>$WordApp -> Documents -> Add;
>
>$PageSetup=$WordApp->ActiveDocument->PageSetup;
>$PageSetup -> {LeftMargin}  = $WordApp -> InchesToPoints(0);
>$PageSetup -> {RightMargin} = $WordApp -> InchesToPoints(0);
>$PageSetup -> {TopMargin}   = $WordApp -> InchesToPoints(0);
>$PageSetup -> {BottomMargin}= $WordApp -> InchesToPoints(0);
>
>$coverart="c:/find-out_directory_cover.jpg";
>$InsertCover=$WordApp->Selection->InlineShapes-
>>AddPicture({FileName=>$coverart});
>$InsertCover=$WordApp->Selection-
>>InsertBreak({Type=>wdPageBreak});
>
>$PageSetup2=$WordApp->ActiveDocument->PageSetup;
>$PageSetup2 -> {LeftMargin}  = $WordApp -> InchesToPoints(0.75);
>$PageSetup2 -> {RightMargin} = $WordApp -> InchesToPoints(0.75);
>$PageSetup2 -> {TopMargin}   = $WordApp -> InchesToPoints(0.75);
>$PageSetup2 -> {BottomMargin}= $WordApp -> InchesToPoints(0.75);
>
>$WordApp->Selection->Font->{Size} = '12';
>$WordApp->Selection->TypeText( "Let's try some text in here to see 
>what happens." );
>$WordApp->ActiveDocument->SaveAs({FileName=>$outputFile,
>  FileFormat=>wdFormatDocument});
>$WordApp->ActiveDocument->Close();
>$WordApp->Quit();
>
>Brad Smith
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/m

RE: win32::SerialPort problems

2003-09-02 Thread Scott Campbell
To download/install PPM's with Floppy or other media:

Assumption: "a:\" is your local directory with the modules.  This can be any
directory you'd like.

1. Download .ppd file and .tgz file for modules (from ActiveState and other
repositories).  Save to a:\.
2. Modify the CODEBASE tag in the .ppd file to point to the correct location
of the .tgz file.
3. Type "ppm rep add a:\".  This creates a "local" repository pointing to
the a:\ directory.
4. Type "ppm install MODULE-NAME".  This installs the module.

http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Zips is a good
link for PPM Zip Archives. 

Scott Campbell
Senior Software Developer
Somix Technologies
http://www.somix.com


-Original Message-
From: Ecker Sandor [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 02, 2003 4:23 PM
To: Scott Campbell; perlwin32list
Subject: Re: win32::SerialPort problems


Hi!

Thenks for everybody who helped me! It works! :) One question more: How can
I download a perl module (whit ppm) to save it to a floppy, and install it
on a machine, where isn't internet connection?

(I don't understand why isn't it installed when win32::SerialPort is in the
base, and it uses the win32::Api "perl moulde", and so SerialPort can't
work... I think win32::API should be installed per default...)

Sandor

Scott Campbell wrote:
> 
> Win32::API is a "perl module".  To install perl modules, you use the 
> "ppm" program, which comes installed with ActivePerl. To install this 
> module, type "ppm install Win32-API".  You can type "ppm -?" for more 
> ppm examples.
> 
> Scott Campbell
> Senior Software Developer
> Somix Technologies
> http://www.somix.com





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


Re: win32::SerialPort problems

2003-09-02 Thread Ecker Sandor
Hi!

Thenks for everybody who helped me! It works! :) One question more:
How can I download a perl module (whit ppm) to save it to a floppy, and install
it on a machine, where isn't internet connection?

(I don't understand why isn't it installed when win32::SerialPort is in the
base, and it uses the win32::Api "perl moulde", and so SerialPort can't work...
I think win32::API should be installed per default...)

Sandor

Scott Campbell wrote:
> 
> Win32::API is a "perl module".  To install perl modules, you use the "ppm"
> program, which comes installed with ActivePerl.
> To install this module, type "ppm install Win32-API".  You can type "ppm -?"
> for more ppm examples.
> 
> Scott Campbell
> Senior Software Developer
> Somix Technologies
> http://www.somix.com

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


Re: Regex Help Needed

2003-09-02 Thread John Deighan


At 01:26 PM 9/2/2003, Dax T. Games wrote:
I have a
list of characters.  I need to get a list of all possble sequences
of these characters for example.  
 
I have a string that consists of '-mevqgn' I
need to pattern match any combination of 'mevqgn' with a preceding - or
--.
 
Right now this is what I am doing but it is
very ugly and difficult to come up with the combinations and it makes my
brain hurt!:
 
 if ($LS_Val =~ /-{1,2}(mevqgn|
  
emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
  
veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
  
qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
  
gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
  
mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
  
nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
  
envqgm|evnqgm|evqngm|evqgnm|evqgmn|
   )/i)

{
    #Do Something;
}
    
 
A subroutine that takes the string of
characters as an argument and then returns 1 on success and undef on fail
would be ideal for my purpose.
if ($val =~ /^--?[mevqgn]{6}$/) almost works, but allows, e.g. -me,
i.e. repetitions.
I would just do:
if (($val =~ /^--?([a-z]+)$/) && (length($1)==6) &&
check($1, qw(m e v q g n))) {
...
sub check { my($str, @chars) = @_;
foreach my
$ch (@chars) {
return
undef if (index($str, $ch)==-1);
}

Full test program:  -
use strict;
MAIN: {
test('');
test('-');
test('--');
test('-mev');
test('-mevqgn');
test('--mevqgn');
test('--qvgnme');
test('-qgvnme');
test('--qgnvme');
test('--qgnmve');
test('-qgnmev');
}
# --
sub test { my($str) = @_;
if (($str =~ /^--?([a-z]+)$/)
&&
(length($1)==6)
&&
check($1, qw(m e v q g n))) {
print("OK
'$str'\n");
}
else {
print("no
'$str'\n");
}
} # test
# --
sub check { my($str, @chars) = @_;
foreach my $ch (@chars) {
return
undef if (index($str, $ch)==-1);
}
return 1;
} # check


John Deighan
Public Consulting Group
1700 Kraft Dr.
Suite 2250
Blacksburg, VA  24060
[EMAIL PROTECTED]
540-953-2330  x12
FAX: 540-953-2335




RE: Where am I going wrong with OLE and MS Word?

2003-09-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Brad Smith wrote:
> I have written a little app, where I would like to dynamically create
> a directory of resource providers, using Perl OLE and Word10.  I would
> like the directory to contain:
> 1.  A full page color graphic
> 2.  Table of Contents
> 3.  Contents:  each resource provider listed on a page, separated by a
> page break.
> 
> Each of these aspects I have successfully performed, individually.
> Where I am having my problems is in setting ranges for different
> formatting.  For instance, the first page, the cover art should bleed
> to the edges.  Then, a page break, then the Table of Contents, with 1"
> borders all the way around, page break, followed by the resource
> provider listings, each separated by a page break and formatted w/ 1"
> borders.
> 
> I begin by using 'PageSetup' to set all margins to 0" (for full
> bleed). Then, I add the InlineShape to the first page.  Everything
> works to that point.  Now, I would like to reset the page borders to
> 1" all around and begin adding the Table of Contents and other text. 
> Unfortunately, every time I adjust the PageSetup parameters, ALL the
> margins are reset, negating the 0" margins I had established for the
> cover art. 
> 
> I have read every archived email re: OLE and Word, combed my Office
> Developer's Guide book (VBA), searched Google for anything available,
> but the examples I have found do not address multiple page margins
> within a single document.
I do not have Word 10, but in Word 9 when you are on the setup page, there is 
an entire document or from this point forward as regards the margins.  I assume you 
are getting the whole document and what you need after the first Pagesetup is to use 
from thie point forward for any others which follow.

Not much help, but at least a little input.

Wags ;)
> 
> Below is the code I have written so far.  Is there anyone out there
> who has fond experiences with OLE automation of Word who can help me
> through this?  Thanks in advance.
> 
> use Win32::OLE;
> use Win32::OLE::Const 'Microsoft Word';
> 
> my($outputFile) = "c:/check_this_file.doc";
> 
> my($WordApp) = Win32::OLE -> new('Word.Application', 'Quit');
> $WordApp-> {Visible} = 1;
> $WordApp -> Documents -> Add;
> 
> $PageSetup=$WordApp->ActiveDocument->PageSetup;
> $PageSetup -> {LeftMargin}  = $WordApp -> InchesToPoints(0);
> $PageSetup -> {RightMargin} = $WordApp -> InchesToPoints(0);
> $PageSetup -> {TopMargin}   = $WordApp -> InchesToPoints(0);
> $PageSetup -> {BottomMargin}= $WordApp -> InchesToPoints(0);
> 
> $coverart="c:/find-out_directory_cover.jpg";
> $InsertCover=$WordApp->Selection->InlineShapes-
>> AddPicture({FileName=>$coverart});
> $InsertCover=$WordApp->Selection-
>> InsertBreak({Type=>wdPageBreak});
> 
> $PageSetup2=$WordApp->ActiveDocument->PageSetup;
> $PageSetup2 -> {LeftMargin}  = $WordApp -> InchesToPoints(0.75);
> $PageSetup2 -> {RightMargin} = $WordApp -> InchesToPoints(0.75);
> $PageSetup2 -> {TopMargin}   = $WordApp -> InchesToPoints(0.75);
> $PageSetup2 -> {BottomMargin}= $WordApp -> InchesToPoints(0.75);
> 
> $WordApp->Selection->Font->{Size} = '12';
> $WordApp->Selection->TypeText( "Let's try some text in here to see
> what happens." );
> $WordApp->ActiveDocument->SaveAs({FileName=>$outputFile,
>   FileFormat=>wdFormatDocument});
> $WordApp->ActiveDocument->Close();
> $WordApp->Quit();
> 
> Brad Smith
> 
> ___
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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


RE: Regex Help Needed

2003-09-02 Thread Messenger, Mark



Equally dirty, but possibly more flexible:
 
$_='aSdFgHjk';    # Letters to look 
for.
$alpha1=lc(join('',sort(split(//;
 
$LS_Val=shift;
$LS_Val=~s/^-//g;   # Drop preceding dashes
 
$alpha2=lc(join('',sort(split(//,$LS_Val;
 
if 
($alpha1 eq $alpha2) {print "Pattern found!\n";}
 
 
 

  -Original Message-From: Dax T. Games 
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 
  11:26 AMTo: Perl UsersSubject: Regex Help 
  Needed
  I have a list of characters.  I need to get 
  a list of all possble sequences of these characters for example.  
  
   
  I have a string that consists of '-mevqgn' I need 
  to pattern match any combination of 'mevqgn' with a preceding - or 
  --.
   
  Right now this is what I am doing but it is very 
  ugly and difficult to come up with the combinations and it makes my brain 
  hurt!:
   
   if ($LS_Val =~ 
  /-{1,2}(mevqgn|   
  emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|   
  veqgnm|vqegnm|vqgenm|vqgnem|vagnme|   
  qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|   
  gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|   
  mgnevq|mngevq|mnegvq|mnevgq|mnevqg|   
  nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|   
  envqgm|evnqgm|evqngm|evqgnm|evqgmn|   
  )/i) 
  {    #Do Something;
  }
      
   
  A subroutine that takes the string of 
  characters as an argument and then returns 1 on success and undef on fail 
  would be ideal for my purpose.
   
   
  Any help is appreciated.
   
  Dax


RE: Regex Help Needed

2003-09-02 Thread Arms, Mike
It looks like you may be doing standard command line option
parsing (or almost standard as the '--' prefix is reserved
for long option names). If this is so, look at GetOpt::Std .

For a subroutine that does what you specified (tested):

  sub is_DTG_Option ($)
  {
my $opt = shift;
return 0 if $opt =! /^--?([mevqgn]+)$/;
my @c = split //, $1;
my %h = ();
for ( @c )
{
  return 0 if $h{$_}++;
}
return 1;
  }
  
  # Test various combinations (both legal and illegal)
  my @test = qw( --mevqgn -mevqgn ---mevqgn mevqgn -mv --qm -neq -ef );
  
  for ( @test )
  {
print "$_ " . is_DTG_Option( $_ ) . "\n";
  }

--
Mike Arms


-Original Message-
From: Dax T. Games [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2003 11:26 AM
To: Perl Users
Subject: Regex Help Needed


I have a list of characters.  I need to get a list of all possble sequences
of these characters for example.  

I have a string that consists of '-mevqgn' I need to pattern match any
combination of 'mevqgn' with a preceding - or --.

Right now this is what I am doing but it is very ugly and difficult to come
up with the combinations and it makes my brain hurt!:

 if ($LS_Val =~ /-{1,2}(mevqgn|
   emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
   veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
   qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
   gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
   mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
   nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
   envqgm|evnqgm|evqngm|evqgnm|evqgmn|
   )/i) 
{
#Do Something;
}


A subroutine that takes the string of characters as an argument and then
returns 1 on success and undef on fail would be ideal for my purpose.


Any help is appreciated.

Dax

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


RE: Octetstr to hex conversion

2003-09-02 Thread Jim Lancaster
Well, upon further review, the answer requires less work than I thought.
Here is the detail for the two Linux NICs:

NIC =eth0
MAC =000102EAEC0F
OctetStr = 0x000102eaec0f 

NIC =eth1
MAC =00B0D0254A27
OctetStr = 0x00b0d0254a27 

I was looking at the OctetStr for one, and matching it with the MAC
address of the other. .  I thought some sort of conversion
needed to take place, but as you can see the only thing I need to deal
with is the leading "Ox".  Except for those 2 characters, the octetstr
IS the mac address.

Whoa boy.  Monday fell on a Tuesday this week.

Jim



-Original Message-
From: Peter Eisengrein [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 29, 2003 9:06 AM
To: Jim Lancaster; [EMAIL PROTECTED]
Subject: RE: Octetstr to hex conversion


Is this what you mean? 
my $hex = unpack("h*",pack("b*",$octetstr)); 


-Original Message- 
From: Jim Lancaster [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 28, 2003 11:30 AM 
To: [EMAIL PROTECTED] 
Subject: Octetstr to hex conversion 


I'm polling a Linux server with Net-SNMP and getting back an octetstr 
value for the mac address of the nic.  I saw a reference to using unpack

to convert it in an old posting, but no specifics.  How is this done? 
What kind of mask do I use? 


Jim Lancaster 
MBD Network Services, LLC 
___ 
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: parse search string?

2003-09-02 Thread $Bill Luebkert
Burak Gürsoy wrote:

> I've searched cpan but only found some APIs to several search engines...

And what do you need that's different from what they provide ?

> I want to parse search string and split parameters. like user can put a plus
> sign for wanted words and minus for not-wanted or put single or double
> quotes or some other weird thing etc... if such a module exists I'd like to
> know :)

There is no standard that I know of for search string args.

All CGI args are split at each '&' and starting at the '?'.
EG: ?arg1=val1&arg2=val2

-- 
  ,-/-  __  _  _ $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: parse search string?

2003-09-02 Thread Hanson, Rob
I don't know of any module that does all of that automatically, but there
are good ways to do it if you feel like learning something new.

Parse::RecDescent is a parser builder.  You supply a grammer (rules), and it
builds a parser that can parse that grammer.

http://www.perl.com/pub/a/2001/06/13/recdecent.html

It guess it all depends on how much time you are willing to invest.  If you
only ever write a parser this one time, Parse::RecDescent is a bad
investment.  If you think you might use it again, it is worth the trouble.

If you want a simpler solution, you might want to look at Lex.  Lex (a
lexer) is the part of a parser(1) that cuts up the input into "tokens".  In
your case a token would be a plus, a minus, and a string.  You would then
loop over each token, deciding what to do.

http://search.cpan.org/author/YVESP/llg-1.07/Lex.en.pod

For a bare bones solution you will want to use some regexes, maybe like
this...

while ($input =~ /([+-])(\w+)/) {
  my $sign = $1;
  my $word = $2;

  # do stuff here
}

Rob

(1) I say "parser", but I mean compiler.  I just didn't want to over
complicate things.

-Original Message-
From: Burak Gürsoy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2003 2:18 PM
To: Perl-Win32-Users
Subject: parse search string?


I've searched cpan but only found some APIs to several search engines...

I want to parse search string and split parameters. like user can put a plus
sign for wanted words and minus for not-wanted or put single or double
quotes or some other weird thing etc... if such a module exists I'd like to
know :)

___
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: Regex Help Needed

2003-09-02 Thread Charlie Schloemer
Wow... looks like some good replies to this one.  Here's a less
elegant, recursive approach (until I learn map :-)

#!perl -w
# print all 720 permutations using letters:  e m v q g n

use strict;

sub mutate {
  my ($in) = @_;
  if (length($in) == 6) {
print "$in\n";
$in = '';
  } else {
foreach (qw/e m v q g n/) {
  if ($in =~ /$_/) {
#do nothing;
  } else {
print mutate($in . $_);
  }
}
  }
}

print mutate('');
#THE END

If you're going the other way (trying to see if a known string is
valid), something like this ought to work:

if (length($a) == 6 and
$a =~ /e/ and
$a =~ /m/ and
$a =~ /v/ [... et al ...]
)
{
#it's valid
}

It figures TMTOWTDI.  Hope this helps :-)

Charlie


- Original Message - 
From: "Dax T. Games" <[EMAIL PROTECTED]>
To: "Perl Users" <[EMAIL PROTECTED]>
Sent: Tuesday, September 02, 2003 12:26 PM
Subject: Regex Help Needed


I have a list of characters.  I need to get a list of all possble
sequences of these characters for example.

I have a string that consists of '-mevqgn' I need to pattern match any
combination of 'mevqgn' with a preceding - or --.

Right now this is what I am doing but it is very ugly and difficult to
come up with the combinations and it makes my brain hurt!:

 if ($LS_Val =~ /-{1,2}(mevqgn|
   emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
   veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
   qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
   gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
   mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
   nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
   envqgm|evnqgm|evqngm|evqgnm|evqgmn|
   )/i)
{
#Do Something;
}


A subroutine that takes the string of characters as an argument and
then returns 1 on success and undef on fail would be ideal for my
purpose.


Any help is appreciated.

Dax

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


Re: Regex Help Needed

2003-09-02 Thread Carl Jolley
On Tue, 2 Sep 2003, Dax T. Games wrote:

> I have a list of characters.  I need to get a list of all possble sequences of these 
> characters for example.
>
> I have a string that consists of '-mevqgn' I need to pattern match any combination 
> of 'mevqgn' with a preceding - or --.
>
> Right now this is what I am doing but it is very ugly and difficult to come up with 
> the combinations and it makes my brain hurt!:
>
>  if ($LS_Val =~ /-{1,2}(mevqgn|
>emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
>veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
>qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
>gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
>mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
>nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
>envqgm|evnqgm|evqngm|evqgnm|evqgmn|
>)/i)
> {
> #Do Something;
> }
>
>
> A subroutine that takes the string of characters as an argument and then returns 1 
> on success and undef on fail would be ideal for my purpose.

How about /^-{1,2}[mevgn]{6}/ i.e. turn all the characters you wish to
match into a character class. This assumes that the alphabetic string
you want to match will be 6 characters long. If it could be of any
arbitratry length but only consisting of the characters mevgn then
the patters might be: /^-{1,2}[mevgn]*/. This also assumes that
you are matching the beginning of a string.

The regex used in a match would of course produce a result of 0 or
1 so it you really wanted it to be in a subroutine then you could
do something like:

sub matched{
  return $mystring=~/^-{1,2}[mevgn]*/;
}

I, personally would think that just using the match directly in an if
statement would be cleaner, e.g.

if($mystring=~/^-{1,2}[mevgn]*/) { .

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 

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


parse search string?

2003-09-02 Thread Burak Gürsoy
I've searched cpan but only found some APIs to several search engines...

I want to parse search string and split parameters. like user can put a plus
sign for wanted words and minus for not-wanted or put single or double
quotes or some other weird thing etc... if such a module exists I'd like to
know :)

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


Re: Illegal octal digit '9' problem??

2003-09-02 Thread Carl Jolley
On Tue, 2 Sep 2003, steve silvers wrote:

> With the below snippet, the numbers "8" and "9" work great, but "08" and
> "09" give the error Illegal octal digit '9' or '8'. I read that these are
> two numbers that will have this problem! How do I get around this problem?
>

Ohh, don't use leading zeros on decimal numbers. Or read them (or force
then) to be strings. You can easily strip leading 0's from a string.
Lots of numbers may have this 'problem'. A leading 0 on a number indicates
that it is an octal number. All valid digits of an octal number range from
0..7. Just be glad you didn't try to use 010 as a decimal number. You
would have probably gotten really frustrated when you suddenly found the
value 8 amoung your data.

 [EMAIL PROTECTED] 
 All opinions are my own and not necessarily those of my employer 


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


RE: Regex Help Needed

2003-09-02 Thread Hanson, Rob



Here 
is another variation...
 
#!/usr/bin/perl
 
check('-mevqgn');check('-memqgn');check('-ngmevq');check('--meqvgn');
 
sub check{    my $LS_Val = shift;
 
    if ($LS_Val =~ /-{1,2}([mevqgn]{6})/ and 
unique_chars($1)) {    print "Ding 
Ding! $LS_Val is good!\n";    }    else 
{    print "Flopped: 
$LS_Val\n";    }}
 
sub unique_chars{    my $chars = 
shift;    my %chars;
 
    for (split(//, $chars)) 
{    
$chars{$_}++;    }
 
    for (keys %chars) 
{    if ($chars{$_} > 1) 
{    return 
0;    }    }
 
    return 1;}

  -Original Message-From: Dax T. Games 
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 1:26 
  PMTo: Perl UsersSubject: Regex Help 
  Needed
  I have a list of characters.  I need to get 
  a list of all possble sequences of these characters for example.  
  
   
  I have a string that consists of '-mevqgn' I need 
  to pattern match any combination of 'mevqgn' with a preceding - or 
  --.
   
  Right now this is what I am doing but it is very 
  ugly and difficult to come up with the combinations and it makes my brain 
  hurt!:
   
   if ($LS_Val =~ 
  /-{1,2}(mevqgn|   
  emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|   
  veqgnm|vqegnm|vqgenm|vqgnem|vagnme|   
  qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|   
  gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|   
  mgnevq|mngevq|mnegvq|mnevgq|mnevqg|   
  nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|   
  envqgm|evnqgm|evqngm|evqgnm|evqgmn|   
  )/i) 
  {    #Do Something;
  }
      
   
  A subroutine that takes the string of 
  characters as an argument and then returns 1 on success and undef on fail 
  would be ideal for my purpose.
   
   
  Any help is appreciated.
   
  Dax


Re: Regex Help Needed

2003-09-02 Thread Will of Thornhenge
Have you tried playing around with character sets? Something like

$target = 'mevqgn';
$length_target = length $target;
if ( $LS_Val =~ /-{1,2}[$target]{$length_target}/ ) {
   #do something
}
Whether the above would work for you would depend on whether the code 
can ignore positive matches on $LS_Val = '--mmmqqq' and so forth. It 
might be worthwhile to look more closely at the data and see whether 
there are "don't care" cases that you can ignore.

If there are not, then there is a loop approach:

$t = 'mevqgn'; # just to save keystrokes
$x = $LS_Val;
if ( $x =~ /(-{1,2})/ ) {
   $goodSoFar = $1;
   while (length $t and $x =~ /($goodSoFar([$t]))/ ) {
   $goodSoFar = $1;
   $t =~ s/$2//;
   }
   do_Something unless length $t;
}
That's undoubtedly slower than your original approach, but would be more 
versatile and possibly easier to maintain.

(Neither snippet above has been tested)

Dax T. Games wrote:
I have a list of characters.  I need to get a list of all possble 
sequences of these characters for example. 
 
I have a string that consists of '-mevqgn' I need to pattern match any 
combination of 'mevqgn' with a preceding - or --.
 
Right now this is what I am doing but it is very ugly and difficult to 
come up with the combinations and it makes my brain hurt!:
 
 if ($LS_Val =~ /-{1,2}(mevqgn|
   emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
   veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
   qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
   gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
   mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
   nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
   envqgm|evnqgm|evqngm|evqgnm|evqgmn|
   )/i)
{
#Do Something;
}
   
 
A subroutine that takes the string of characters as an argument and then 
returns 1 on success and undef on fail would be ideal for my purpose.
 
 
Any help is appreciated.
 
Dax


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


RE: Regex Help Needed

2003-09-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO



    I wanted to use tr but was uanble to accomplish the 
task that way. So I used regex like the following:
 
use strict;
 
my %MCTWW = qw(m -1 e -1 v -1 q -1 g -1 n -1);my $MyCharsToWorkWith = 
\%MCTWW;
 
$_ = '--mepqgn ';
 
if ( ! /-{1,2}(\S+)/ ) {    printf "Expecting a hyphen 
or two floowed by non space, but did not get a hit.\n";    
printf "Data: <%-s>\n", $_;    printf "Correct and rerun.\n";    exit(1); }my $MyData = 
lc($1);my $MyMiss = 0;my $MyOrigData = $MyData;
 
foreach my $MyChar (keys %{$MyCharsToWorkWith}) {    
$MyCharsToWorkWith->{$MyChar} = ( $MyData =~ s/$MyChar//g 
);    $MyMiss++ if ( ! $MyCharsToWorkWith->{$MyChar} ); }
 
if ( $MyMiss ) {    printf "Not all characters were 
present in passed data. I had $MyMiss misses.\n";    printf 
"Data was %-s and invalid data was %-s\n", $MyOrigData, $MyData; }else 
{    printf "All necessary characters were 
present.\n"; }
 
From your description they should only appear once, doesn't matter sequence. I believe it could be a starting place.
 
Wags ;)

  -Original Message-From: Dax T. Games 
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003   10:26To: Perl UsersSubject: Regex Help 
  Needed
  I have a list of characters.  I need to get 
  a list of all possble sequences of these characters for example.  
  
   
  I have a string that consists of '-mevqgn' I need 
  to pattern match any combination of 'mevqgn' with a preceding - or 
  --.
   
  Right now this is what I am doing but it is very 
  ugly and difficult to come up with the combinations and it makes my brain 
  hurt!:
   
   if ($LS_Val =~ 
  /-{1,2}(mevqgn|   
  emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|   
  veqgnm|vqegnm|vqgenm|vqgnem|vagnme|   
  qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|   
  gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|   
  mgnevq|mngevq|mnegvq|mnevgq|mnevqg|   
  nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|   
  envqgm|evnqgm|evqngm|evqgnm|evqgmn|   
  )/i) 
  {    #Do Something;
  }
      
   
  A subroutine that takes the string of 
  characters as an argument and then returns 1 on success and undef on fail   would be ideal for my purpose.
   
   
  Any help is appreciated.
   
  Dax

**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.





Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
Dax T. Games wrote:

> I have a list of characters.  I need to get a list of all possble
> sequences of these characters for example. 
>  
> I have a string that consists of '-mevqgn' I need to pattern match any
> combination of 'mevqgn' with a preceding - or --.
>  
> Right now this is what I am doing but it is very ugly and difficult to
> come up with the combinations and it makes my brain hurt!:
>  
>  if ($LS_Val =~ /-{1,2}(mevqgn|
>emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|
>veqgnm|vqegnm|vqgenm|vqgnem|vagnme|
>qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|
>gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|
>mgnevq|mngevq|mnegvq|mnevgq|mnevqg|
>nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|
>envqgm|evnqgm|evqngm|evqgnm|evqgmn|
>)/i)
> {
> #Do Something;
> }
>
>  
> A subroutine that takes the string of characters as an argument and then
> returns 1 on success and undef on fail would be ideal for my purpose.

The above doesn't test all cases of the string - am I missing something
in the description ?

Assuming each of the letters has to be present and there is only one
occurrence of each letter (that may be a stretch) and the order can be
any order:

# first check that we have the right letters

if ($LS_Val =~ /-{1,2}([mevqgn]{6})/i) {

# then make sure we only have one of each

if (check ($1)) {
print "found it\n";
}
}

sub check {
my %letters = map { $_ => 0 } split '', $LS_Val;
map { return 0 if not exists $letters{$_} or $letters{$_}++ } split '', $_[0];
return 1;
}


-- 
  ,-/-  __  _  _ $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


help with cursors

2003-09-02 Thread Adam Peterson
hello,

 i'm attempting to execute the following
query against a MS SQL 2000 db. only the first instance of the results are
being returned. i'm not sure if i'm using the correct method and hope that
someone can point me in the right direction... this is my first time
trying to use cursors with dbi. oh, and i tried posting this to dbi-users@
a week ago and got no responses...

thanks,
-adam

part of code:

my $cust = 'ACD';
my $tradingpartner = 'IDX';

my $sql = "
declare [EMAIL PROTECTED] as varchar(10)
declare [EMAIL PROTECTED] as varchar(10)
declare [EMAIL PROTECTED] as varchar(75)

DECLARE CustomerCursor CURSOR STATIC READ_ONLY FOR
select distinct  customer,multistateid,p.payorname from customer c join
customerpayor cp on c.custid = cp.custid 
join payor p on p.payid = cp.payid 
where  cp.type = 'CLAIMCNT'  and customer = ?   and tradingpartner = ?
group by customer,multistateid,p.payorname

OPEN CustomerCursor
FETCH NEXT FROM CustomerCursor
INTO [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]
WHILE [EMAIL PROTECTED]@FETCH_STATUS = 0
BEGIN
select distinct p.multistateid,[EMAIL PROTECTED] as
PayorName,m.Type,pt.status,Description,testdate,productiondate,Completiondate,contingencydate
from Mandate M join Payor p on p.payid=m.payid 
 join payortxn pt on pt.payid= p.payid
where multistateid = [EMAIL PROTECTED] AND pt.type = 'ANSII' and ((m.type =
'AnsiClaims' and pt.txn = '837') or (m.type = 'AnsiRemits' and pt.txn =
'835'))

FETCH NEXT FROM CustomerCursor
INTO [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]
END
CLOSE CustomerCursor
DEALLOCATE CustomerCursor
";

$sth = $dbh->prepare($sql);
$sth->execute($cust, $tradingpartner);

while( my @data = $sth->fetchrow_array)
{
print "@data\n";
}

results:

US01  AnsiClaims 4=Format Delivered ANSI X-12 Mandate (Enrollment Comm
Report Cl
aim Format)  Enrollment= B Migration=B Testing=B  Remit=A 2003-06-02
00:00:00.00
0 2003-08-15 00:00:00.000 2003-10-16 00:00:00.000

US01  AnsiRemits 7=Hold ANSI X-12 Mandate (Enrollment Comm Report Claim
Format)
 Enrollment= B Migration=B Testing=B  Remit=A 2003-04-01 00:00:00.000
2003-09-15
 00:00:00.000 2003-10-16 00:00:00.000

should be: 
US01NULLAnsiClaims  4=Format Delivered  ANSI X-12 Mandate (Enrollment 
Comm
Report Claim Format)  Enrollment= B Migration=B Testing=B  Remit=A
2003-06-02 00:00:00.000 2003-08-15 00:00:00.000 2003-10-16 00:00:00.000
NULL

US01NULLAnsiRemits  7=Hold  ANSI X-12 Mandate (Enrollment Comm Report
Claim Format)  Enrollment= B Migration=B Testing=B  Remit=A 2003-04-01
00:00:00.0002003-09-15 00:00:00.000 2003-10-16 00:00:00.000 NULL

US07Nationwide Mutual Insurance Company AnsiClaims  6=ProductionANSI 
X-12
Mandate (Enrollment/Reports/Claims / Enrollment Type = A  Migration Type =
B/Testing Type = D Remit Type = C   2002-04-16 00:00:00.000 2002-10-15
00:00:00.0002003-10-16 00:00:00.000 NULL

US07Nationwide Mutual Insurance Company AnsiRemits  6=ProductionANSI 
X-12
Mandate (Enrollment/Reports/Claims / Enrollment Type = A  Migration Type =
B/Testing Type = D Remit Type = C   1900-01-01 00:00:00.000 2002-08-06
00:00:00.0001900-01-01 00:00:00.000 NULL






__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Where am I going wrong with OLE and MS Word?

2003-09-02 Thread Brad Smith
I have written a little app, where I would like to dynamically create a 
directory of resource providers, using Perl OLE and Word10.  I would 
like the directory to contain:
1.  A full page color graphic
2.  Table of Contents
3.  Contents:  each resource provider listed on a page, separated by a 
page break.

Each of these aspects I have successfully performed, individually.  
Where I am having my problems is in setting ranges for different 
formatting.  For instance, the first page, the cover art should bleed to 
the edges.  Then, a page break, then the Table of Contents, with 1" 
borders all the way around, page break, followed by the resource 
provider listings, each separated by a page break and formatted w/ 1" 
borders.

I begin by using 'PageSetup' to set all margins to 0" (for full bleed).  
Then, I add the InlineShape to the first page.  Everything works to that 
point.  Now, I would like to reset the page borders to 1" all around and 
begin adding the Table of Contents and other text.  Unfortunately, every 
time I adjust the PageSetup parameters, ALL the margins are reset, 
negating the 0" margins I had established for the cover art.

I have read every archived email re: OLE and Word, combed my Office 
Developer's Guide book (VBA), searched Google for anything available, 
but the examples I have found do not address multiple page margins 
within a single document.

Below is the code I have written so far.  Is there anyone out there who 
has fond experiences with OLE automation of Word who can help me 
through this?  Thanks in advance.

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';

my($outputFile) = "c:/check_this_file.doc";

my($WordApp) = Win32::OLE -> new('Word.Application', 'Quit');
$WordApp-> {Visible} = 1;
$WordApp -> Documents -> Add;

$PageSetup=$WordApp->ActiveDocument->PageSetup;
$PageSetup -> {LeftMargin}  = $WordApp -> InchesToPoints(0);
$PageSetup -> {RightMargin} = $WordApp -> InchesToPoints(0);
$PageSetup -> {TopMargin}   = $WordApp -> InchesToPoints(0);
$PageSetup -> {BottomMargin}= $WordApp -> InchesToPoints(0);

$coverart="c:/find-out_directory_cover.jpg";
$InsertCover=$WordApp->Selection->InlineShapes-
>AddPicture({FileName=>$coverart});
$InsertCover=$WordApp->Selection-
>InsertBreak({Type=>wdPageBreak});

$PageSetup2=$WordApp->ActiveDocument->PageSetup;
$PageSetup2 -> {LeftMargin}  = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {RightMargin} = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {TopMargin}   = $WordApp -> InchesToPoints(0.75);
$PageSetup2 -> {BottomMargin}= $WordApp -> InchesToPoints(0.75);

$WordApp->Selection->Font->{Size} = '12';
$WordApp->Selection->TypeText( "Let's try some text in here to see 
what happens." );
$WordApp->ActiveDocument->SaveAs({FileName=>$outputFile,
  FileFormat=>wdFormatDocument});
$WordApp->ActiveDocument->Close();
$WordApp->Quit();

Brad Smith

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


Regex Help Needed

2003-09-02 Thread Dax T. Games



I have a list of characters.  I need to get a 
list of all possble sequences of these characters for example.  

 
I have a string that consists of '-mevqgn' I need 
to pattern match any combination of 'mevqgn' with a preceding - or 
--.
 
Right now this is what I am doing but it is very 
ugly and difficult to come up with the combinations and it makes my brain 
hurt!:
 
 if ($LS_Val =~ 
/-{1,2}(mevqgn|   
emvqgn|evmqgn|evqmgn|evqgmn|evqgnm|   
veqgnm|vqegnm|vqgenm|vqgnem|vagnme|   
qvgnme|qgvnme|qgnvme|qgnmve|qgnmev|   
gqmnev|gmqnev|gmnqev|gmneqv|gmnevq|   
mgnevq|mngevq|mnegvq|mnevgq|mnevqg|   
nmevqg|nemvqg|nevmqg|nevqmg|nevqgm|   
envqgm|evnqgm|evqngm|evqgnm|evqgmn|   
)/i) 
{    #Do Something;
}
    
 
A subroutine that takes the string of 
characters as an argument and then returns 1 on success and undef on fail would 
be ideal for my purpose.
 
 
Any help is appreciated.
 
Dax