[17244] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4666 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 19 18:10:44 2000

Date: Thu, 19 Oct 2000 15:10:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971993423-v9-i4666@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 19 Oct 2000     Volume: 9 Number: 4666

Today's topics:
    Re: manipulating data files <ren.maddox@tivoli.com>
    Re: manipulating data files <lr@hpl.hp.com>
    Re: manipulating data files <harrisr@bignet.net>
        Match text on multiple lines. <rst@bdc.no>
    Re: Match text on multiple lines. <ren.maddox@tivoli.com>
    Re: matching balanced text <tim@ipac.caltech.edu>
    Re: newbie intro <mrobison@c802.crane.navy.mil>
    Re: newbie intro <jeff@vpservices.com>
    Re: Object destructors not working properly? <tim@ipac.caltech.edu>
    Re: Object destructors not working properly? <ddunham@redwood.taos.com>
        open (FOO,"|prog") problem (hymie!)
    Re: open (FOO,"|prog") problem <uri@sysarch.com>
        palm wap sorta a perl question <ultrak@my-deja.com>
        re: Perl & mySql <19wlr@globalnet.co.uk>
        re: Perl & mySql <mrobison@c802.crane.navy.mil>
        Perl <=> C++ ? <anders.floderus@swipnet.se>
    Re: Perl not functioning in practice as it should in th <smerr612@mailandnews.com>
    Re: Regexp as input strings <tim@ipac.caltech.edu>
    Re: Regexp as input strings <tim@ipac.caltech.edu>
    Re: Regexp as input strings <sto41@NwOaSnPaAdMoo.fr>
    Re: running perl program in the background <pbarker@ntlworld.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 19 Oct 2000 12:41:05 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: manipulating data files
Message-Id: <m3n1g0hgpa.fsf@dhcp11-177.support.tivoli.com>

triggerfish2001@hotmail.com writes:

> source file will be as follows:
> 
> John Smith           745-678-089011-10-1955
> Robert IhaveAlongName345-567-453219-04-1967
> 
> Here the first 22 char is fixed length for name
> Starting from 23rd char next 12 char is for SSN
> Starting from 35th char next 10 char is for DOB.
> 
> Now this needs to be changed to
> John Smith|745-678-0890|11-10-1955|
> Robert IhaveAlongName|345-567-4532|19-04-1967|

The most common way to handle this is probably to split the data into
fields using substr or unpack, and then combine them back together
with the delimiter.

However, an alternative method is so simply insert the delimiter into
the existing string at the correct positions.

perl -pe 'foreach $field (21, 34, 45) { substr $_, $field, 0, "|" }'

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 19 Oct 2000 13:46:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: manipulating data files
Message-Id: <MPG.1458fd8691e2e69f98ae4b@nntp.hpl.hp.com>

In article <m3n1g0hgpa.fsf@dhcp11-177.support.tivoli.com> on 19 Oct 2000 

12:41:05 -0500, Ren Maddox <ren.maddox@tivoli.com> says...
+ triggerfish2001@hotmail.com writes:
+ 
+ > source file will be as follows:
+ > 
+ > John Smith           745-678-089011-10-1955
+ > Robert IhaveAlongName345-567-453219-04-1967
+ > 
+ > Here the first 22 char is fixed length for name
+ > Starting from 23rd char next 12 char is for SSN
+ > Starting from 35th char next 10 char is for DOB.
+ > 
+ > Now this needs to be changed to
+ > John Smith|745-678-0890|11-10-1955|
+ > Robert IhaveAlongName|345-567-4532|19-04-1967|
+ 
+ The most common way to handle this is probably to split the data into
+ fields using substr or unpack, and then combine them back together
+ with the delimiter.
+ 
+ However, an alternative method is so simply insert the delimiter into
+ the existing string at the correct positions.
+ 
+ perl -pe 'foreach $field (21, 34, 45) { substr $_, $field, 0, "|" }'

1.  That doesn't handle the first example, which requires stripping the 
trailing spaces from the first field.

2.  To avoid brain warp, it might be better to do those substitutions 
right-to-left, so columns can be counted from the original, not the 
successive copies:

                           (43, 33, 21)

This is a common pattern for, for example, editing a file at specific 
line numbers -- work back to front.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Thu, 19 Oct 2000 18:02:00 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: manipulating data files
Message-Id: <suurpkaa3daia9@corp.supernews.com>


Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:39EE8B93.6D3FDFC6@stomp.stomp.tokyo...
> Randy Harris wrote:
>
> > Godzilla! wrote clean efficient code:
> > > triggerfish2001 aka Rick Delaney aka Randy Harris wrote:
>
>
> > > foreach $line (@Array)
> > >  {
> > >   $birth = substr ($line, -10, 10, "¦${\substr ($line, -10,
10)}");
> > >   $ssn = substr ($line, -23, 12, "¦${\substr ($line, -23, 12)}");
> > >   print "$line\n";
> > >  }
>
> > Why assign the variables if you are not going to use them?
>
> Why does perl core have pre-assigned variables we
> rarely use? Well? In compliance with your illogic,
> those pre-assigned variables within perl core should
> be removed. Is this not true per your thinking?
>
> My reason for using this method is seriously simple.
> I am a programmer, not a Perl 5 Cargo Cultist. I write
> programs for speed and efficiency. You boys write little
> code snippets with high hopes of winning a weenie wagging
> contest, at least once. You boys sit around thumping your
> chests and struting your insufficient stuff, proclaiming
> yourself the biggest baddest winner weener and king of
> mule manure mountain. I only see little boys playing
> with poo-poo.
>
> I am a programmer. You boys are not. Naturally my methods
> unsettle you. None of you are programmers and, inherently,
> don't have a clue what it means to actually be a programmer.
>
>
> > My hunch is that substr would probably be more efficient, given the
> > fixed format of the input data, but it sure isn't as pretty as the
> > split/join method used in the earlier post.
>
> Oh, you mean this earlier post made by you under
> another of your myriad fake names in response to
> the originating article of this thread, also posted
> by you under yet another fake name.
>
> Quite humorous, at times, reading you posting articles,
> answering yourself, complimenting yourself, arguing
> with yourself, humorous at times, yes. Quite annoying
> though an equal amount of times. Sometimes I wonder, if
> you shouldn't get a life, a real life. This cyber-life
> which has absorbed you and your very being, this fantasy
> you live, is rather unhealthy.
>
>
> Godzilla!

OK.  I admit I'm a bit slow.  It has taken me a while to realize, you
really are a nut.  It has become apparent that attempting to communicate
with you is a waste of time and newsgroup message space.  A foolish
mistake which I won't repeat.

Randy Harris





------------------------------

Date: Thu, 19 Oct 2000 20:57:42 +0200
From: Robert Strand <rst@bdc.no>
Subject: Match text on multiple lines.
Message-Id: <MPG.145962926d423584989680@news.eunet.no>

[This followup was posted to comp.lang.perl.misc and a copy was sent to the cited author.]

I have just started programming Perl, I am hooked.
I have worked with this problem for a couple of weeks, I think I have 
located the problem but I cant seem to find the solution.

What I want to do is to search trough a large INI like file, in this 
file there are a section called [Macro] in this section there are 
reference to a disk. In this case the drive letter is P:, I want to put 
this into a variable.

Everything works fine if I feed one by one line. But then there are 
multiple instances in the file that matches. Like I said the problem 
seems to bee that I try to match the text in an array. But I am not 
sure. Can anyone please help me, if noting else it would be nice to get 
some pointers to what I am doing wrong.

Samples of the files

The script:

#!/usr/local/bin/perl
# A utility to replace substrings in all ZEN prodused axt files
# copyright 200, Robert Strand
#
# Usage: replacer.pl file
#
if (($ARGV[0] eq "") | | ($ARGV[0] eq "?")) {
print "A utility to making dynamic axt files\n";
end;
} else {
$file = $ARGV[0];

open (FILE, $file);
@thisfile = <FILE>;
close (FILE);


@thisfile =~ m/\[Macro.*Value=(.):.*$/ism;
$source_disk = $1;

The file:
Lots of more text…………………..
[Application Name]
Value=TESTSW

[Macro]
Name=SOURCE_PATH
Value=P:\TESTFOLDER1\ TESTFOLDER2\

[Application Caption]
Value=TESTNAME

[Registry Value Create]
Type=String
Flag=Write Always
Key=HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common
\LanguageResources
Name=1044
Value=On
Lots of more text…………………..


------------------
Best Regards
Robert Strand, rst@bdc.no

-- 
Best Regards Robert Strand
mail; rst@bdc.no


------------------------------

Date: 19 Oct 2000 15:08:58 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Match text on multiple lines.
Message-Id: <m34s28h9ut.fsf@dhcp11-177.support.tivoli.com>

Robert Strand <rst@bdc.no> writes:



> #!/usr/local/bin/perl

You should really have a -w there and a:

  use strict;

there....  It will really help you.

As it is, there are two syntax errors in this script that will keep it
from even compiling.  This indicates that you retyped it to post it,
which is bad, or possibly that you had some problem with
copy-and-paste.

After fixing the two syntax errors, and adding -w to enable warnings,
four warnings are produced:

Unquoted string "end" may clash with future reserved word at - line 9.
Applying pattern match (m//) to @array will act on scalar(@array) at - line 18.
Useless use of a constant in void context at - line 9.
Name "main::source_disk" used only once: possible typo at - line 19.


> # A utility to replace substrings in all ZEN prodused axt files
> # copyright 200, Robert Strand
> #
> # Usage: replacer.pl file
> #
> if (($ARGV[0] eq "") | | ($ARGV[0] eq "?")) {

This is the first syntax error.  "| |" should be "||".  But you knew
that already.

> print "A utility to making dynamic axt files\n";
> end;

Here is the first warning.  I think you mean "exit;".  It is also the
cause of the third warning.

> } else {
> $file = $ARGV[0];
> 
> open (FILE, $file);
> @thisfile = <FILE>;
> close (FILE);
> 
> 
> @thisfile =~ m/\[Macro.*Value=(.):.*$/ism;

This is the second warning, and probably your real problem.  You
cannot simply apply a match to an array.  In this case, it looks like
you want to treat the entire file as a string.  To do that, you need
to load it all into a single scalar.  There are several ways to do
this.  The two most useful for you are probably:

  $thisfile = join "", @thisfile;

Or, simply load it into the scalar directly when read (earlier) with:

  $thisfile = join "", <FILE>;

Other ways include unsetting $/ to turn off line-based reading.

In any event, once you have the entire file in a scalar, your regex
still has another problem.  ".*" is greedy, which means it will match
as much as possible while still allowing the entire expression to
match.  In your case, that means that the ".*" will eat up all of the
string from "[Macro" to the *last* occurrence of "Value".  This is not
what you want.  The lazy fix is to change ".*" to ".*?", which
reverses the behavior.  Then it will match the shortest string
possible.  Often, it is better to be more specific, though that can be
difficult.

Given your input data, a better solution is available.  See below.

> $source_disk = $1;

Here is the second syntax error.  There is a missing "}".

The fourth warning also applies here, but is simply warning you that
this variable is not used anywhere else.  In your real code you likely
use it again, so that would not be an issue.


So, that will probably get you running, but because of the nature of
your data, there is a slightly better solution available.  How much
better really depends on the size of the file.

The main point here is that the data file is formatted into
paragraphs, and we only care about a specific paragraph.  Perl allows
us to read the file a paragraph at a time, and that makes everything
else much easier.  I also made it a little more flexible about the
data.  For example, it assumes that the [Macro] paragraph could
potentially have other attributes, so it explicitly matches
SOURCE_PATH.  You may or may not want to change that.  I considered
making other changes, such as requiring a colon after the drive
letter, but decided to leave those out.  This version avoids loading
the entire file into memory and, perhaps even more important, quits
reading the file as soon as it finds the information.  (Of course, it
actually reads the DATA block, so it will need to be modified slightly
to read an actual file.)

#!/usr/local/bin/perl -w
use strict;
my $source_disk;
$/ = "\n\n";                     # paragraph mode
while (<DATA>) {
  next unless /^\[Macro]/i;
  ($source_disk) = /Name=SOURCE_PATH\s+Value=(.)/ and last;
}
print "Source disk: $source_disk\n";
__DATA__
Lots of more text…………………..
[Application Name]
Value=TESTSW

[Macro]
Name=SOURCE_PATH
Value=P:\TESTFOLDER1\ TESTFOLDER2\

[Application Caption]
Value=TESTNAME

[Registry Value Create]
Type=String
Flag=Write Always
Key=HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common
\LanguageResources
Name=1044
Value=On
Lots of more text…………………..
__END__

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: Thu, 19 Oct 2000 12:07:48 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: matching balanced text
Message-Id: <39EF4684.AFE5C96D@ipac.caltech.edu>

"Robert C. Helling" wrote:
> I remember seeing some annoncements that perl5.6 has regex features
> that support matching balanced expressions but I cannot find
> any description of those in the documentation. Could somebody
> please point me to the file (not the old version of prelfaq6).

There's an example in the write-up on the '(?>' assertion, but it's very
limited. Probably you can do cool stuff with the (?{code}) and
(?(condition)yes-pattern|no-pattern) assertions too, but in the end you're
better off just getting the Text::Balanced module from CPAN, unless what you
want is to play around with cutting edge REs.

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


------------------------------

Date: Thu, 19 Oct 2000 20:00:18 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: Re: newbie intro
Message-Id: <8snjsd$i1n$1@nnrp1.deja.com>

hi larry,

thanks for the guidelines... i'd rather hear them up
front than get my butt chewed for it later on.  ;-)
and i hit your web site and surfed around.  you
definitely duh man!  very impressive background and
list of accomplishments.

miker



In article <MPG.1458c80c930f915298ae49@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <8sn0oh$1kb$1@nnrp1.deja.com> on Thu, 19 Oct 2000 14:33:53
> GMT, Miker <mrobison@c802.crane.navy.mil> says...
> > hello,
>
> Hello back at ya'.
>
> > my name is michael robison and i've been programming
> > for a long time but i'm new to perl.  i just posted
> > my first question, about a win98 activestate install,
> > and i thought it would be nice to also say hello and
> > introduce myself.  i live in southern indiana.  i've
> > been tasked to come up to speed on perl and slowly
> > start building an intranet at the workplace.  i've
> > got a linux box up and running on the net and i've
> > got some html and minor scripts running.
> >
> > this looks like a good group... i notice a decent
> > amount of posts and not too many unanswered ones.  i
> > hope that i can come up to speed so that i can
> > contribute answers to the group instead of just
> > questions.
>
> Thanks for the kind words and good intentions.  I would suggest you
try
> answering questions yourself offline, and then compare them with the
> answers provided, until you feel comfortable about your hit rate.
>
> When you do get around to posting responses, please:
>
>     Don't post conjectures.
>
>     Don't post untested code unless clearly labeled as such.
>
>     Post code that compiles with 'use strict;' and runs quietly with
>     warnings enabled.
>
> Until then, in the words of The Larry, "Have the appropriate amount
of
> fun!"
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 19 Oct 2000 13:17:45 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie intro
Message-Id: <39EF56E9.ADF5FDF7@vpservices.com>

Miker wrote:
> 
> thanks for the guidelines... i'd rather hear them up
> front than get my butt chewed for it later on.  ;-)
> and i hit your web site and surfed around.  you
> definitely duh man!  very impressive background and
> list of accomplishments.

Yep, he's duh man. (or rather, one of a select group of "duh men" and
"duh women" we are blessed to have in this group).

> In article <MPG.1458c80c930f915298ae49@nntp.hpl.hp.com>,
>   Larry Rosler <lr@hpl.hp.com> wrote:
>
> [snip of out of order posting]

I'll add my welcome to Larry's with a further tip for you: please post
your responses *after* a suitably trimmed version of what you are
responding to.  That is the style that best encourages conversations
rather than random postings, and is the style practiced by most regulars
in the newsgroup.

-- 
Jeff


------------------------------

Date: Thu, 19 Oct 2000 11:55:05 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Object destructors not working properly?
Message-Id: <39EF4389.776259F1@ipac.caltech.edu>

lesley withall wrote:
> 
> Has anyone had problems with object destructors? According to the excellent
> 'Programming Perl' - 'When the last reference to an object goes away, the
> object is automatically destroyed. '
> 
> My experience is that the object is destroyed when the first reference is
> deleted. I don't know how to debug this.. any ideas?

Can you post a minimal script that shows the problem?

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


------------------------------

Date: Thu, 19 Oct 2000 18:58:25 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Object destructors not working properly?
Message-Id: <lvHH5.683$YR.41630@news.pacbell.net>

lesley withall <lesley@natric.demon.co.uk> wrote:
> Has anyone had problems with object destructors? According to the excellent
> 'Programming Perl' - 'When the last reference to an object goes away, the
> object is automatically destroyed. '

> My experience is that the object is destroyed when the first reference is
> deleted. I don't know how to debug this.. any ideas?

We don't know what you're doing.  Perhaps a short example that
demonstrates what you're having trouble with would help.  Could you post
one?

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


------------------------------

Date: 19 Oct 2000 21:36:49 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: open (FOO,"|prog") problem
Message-Id: <8snphh$9co$1@news.smart.net>

Greetings.

I just tracked down a weird problem, and I'm hoping somebody can point
me in the right direction.

This is perl, version 5.004_01

I started out with this in a program:

  open (MAIL,qq[ | mailx -s "no report today" hymie\@lactose.smart.net ] ) ;
  print MAIL "File $FILENAME does not exist\n";
  close (MAIL);

and it never worked.

Although this worked:

  open (MAIL,"| mailx -s \"no report today\" hymie\@lactose.smart.net");
  print MAIL "File $FILENAME does not exist\n";
  close (MAIL);

I tried a whole bunch of different qq delimeters with no success...

until I took out the leading space:

  open (MAIL,qq[| mailx -s "no report today" hymie\@lactose.smart.net ] ) ;
  print MAIL "File $FILENAME does not exist\n";
  close (MAIL);

then it worked fine.

Now, my camel-v-2 book says (on p 191)

"After the filehandle is determined, the filename string is processed.
First, any leading and trailing whitespace is removed from the string.
Then the string is examined on both ends for characters specifying how
the file is to be opened."  It goes on to describe > and >> and < and | .
According to the book, my original statement was valid and should have
worked.

perldoc -f open tells me...

If the filename begins with C<'|'>, the filename is interpreted as a
command to which output is to be piped

and later says

The filename passed to open will have leading and trailing
whitespace deleted, and the normal redirection characters
honored.

which (to me) is ambiguous but tends to favor the behavior I experienced.

I've rambled long enough.  Has the behavior changed?  Is the book
mistaken?

Thanks in advance.

hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================
sorry, this .sig is not a winner.  remember to check the .sig every time
you read a hymie! brand post or letter.  please try again.  good luck!
===============================================================================


------------------------------

Date: Thu, 19 Oct 2000 19:23:43 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: open (FOO,"|prog") problem
Message-Id: <x7lmvkr5xd.fsf@home.sysarch.com>

>>>>> "h" == hymie!  <hymie@lactose.smart.net> writes:

  h> This is perl, version 5.004_01

update. that is VERY old and buggy. get at least 5.005_03. 


  h>   open (MAIL,qq[ | mailx -s "no report today" hymie\@lactose.smart.net ] ) ;

you don't check for success/failure. always do it on open and most other
system calls. print $! on failure.  and you can use single quotes if you
want.

  h>   print MAIL "File $FILENAME does not exist\n";
  h>   close (MAIL);

with piped opens, check the close call as well and again print $! on failure.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Thu, 19 Oct 2000 19:20:10 GMT
From: Kermit Lowry, III <ultrak@my-deja.com>
Subject: palm wap sorta a perl question
Message-Id: <8snhgu$fsn$1@nnrp1.deja.com>

I am reverting to this forum because I have been spurned during 5 days
of research where I have joined every WAP development list ever
produced.

I have been given the job of writing some cgi (in Perl) that will
direct the client/browser to palm vii specific code (wml?) if the
client is a palm.

The exact request is such

> If the user logs on with a PALM VII Program Query
> Application (PQA)the user
> is to be directed to a page in their SUBDIRECTORY
> titled palm.htm. If the
> user logs on with any other browser then the user is
> to be directed to a
> page in their SUBDIRECTORY titled default.htm
>
> We have developed our own PQA in house, and at this
> time we are not certain
> that the PQA will submit the CGI Environment
> Variable.

I am expecting to use m/.wml\b/ or something similar on the http_accept
 environment variable and/or using http_user_agent on a list of wap
browser types.

Does anyone have experience and perhaps a code snippet for doing such?
I've seen that there is a CGI::WAP but I think that that is for
formating pages.  Is this correct?

-- Kermit Lowry
----------------
"Only you can prevent forest fires!" -Smoky


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 19 Oct 2000 20:42:55 +0100
From: "John Plaxton" <19wlr@globalnet.co.uk>
Subject: re: Perl & mySql
Message-Id: <8snit2$pcb$1@gxsn.com>

Hi there,

Anyone got any good tutorials, books, recommendation etc. for using Perl
with Mysql

Thanks in avance


John




------------------------------

Date: Thu, 19 Oct 2000 21:44:15 GMT
From: Miker <mrobison@c802.crane.navy.mil>
Subject: re: Perl & mySql
Message-Id: <8snpve$nn9$1@nnrp1.deja.com>



> Anyone got any good tutorials, books, recommendation etc. for using
Perl
> with Mysql

i do NOT recommend the o'reilly "mysql and msql" book
for learning.  maybe a reference.  it took me a lot
of extra time trying to begin with that book.  maybe
dubois' mysql or the sams club teach yourself mysql in
21 days.

good luck, miker


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 19 Oct 2000 20:26:34 +0200
From: "ANDERS FLODERUS" <anders.floderus@swipnet.se>
Subject: Perl <=> C++ ?
Message-Id: <SOGH5.2586$Z75.7387@nntpserver.swip.net>

I have a C++ class whos behaviour is directed
throu a Command method,
int myClass::Command( char* pCommamd );
I would like to use Perl to construct Command strings
and, depending on the return value, send a new command.

Is this possible ?

Either to build a task that somehow includes both Perl
and myClass.
Or to build a task that somehow communictes with a
Perl script.

I am working with Visual C++ on Windows NT.

Thanks for any answer
Anders.





------------------------------

Date: Thu, 19 Oct 2000 20:51:04 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Perl not functioning in practice as it should in theory. - test.pl (0/1)
Message-Id: <8snmrl$l1b$1@nnrp1.deja.com>

In article <39EDFCB0.DCABBC04@vpservices.com>,
  Jeff Zucker <jeff@vpservices.com> wrote:
>
> Well this is totally unhelpful to your problem but your subject line
> gives me an excuse to post one of my favorite quotes, anyone know its
> source?
>
>   In theory practice and theory are the same, but in practice they
> aren't.

The first time I saw it was as a .sig on Slashdot. It wasn't attributed.
It sounds like a Yogi Berra quote as someone else mentioned.  The
particular version I saw was

"The difference between theory and practice is that in theory there is
no difference, but in practice there is."

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow
"The PROPER way to handle HTML postings is to cancel the article, then
hire a hitman to kill the poster, his wife and kids, fuck  his dog and
smash his computer into little bits. Anything more is just extremism."
-Paul Tomblin in alt.sysadmin.recovery


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 19 Oct 2000 11:41:40 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Regexp as input strings
Message-Id: <39EF4064.AAE4BB3D@ipac.caltech.edu>

Stephane Barizien wrote:
> I wanna match one string against as set of regexp patterns which are
> themselves stored in strings.
> 
> The following works:
> 
> @patternlist = ("kernel", "bar", "windows[\s\n]*nt");

You'll probably want to use single quotes on your strings. E.g. in
"windows[\s\n]*nt" Perl sees the \s as simply an s, not as the whitespace class
meta-character. Or else double your backwhacks.

> $str = "kernel steve Windows\nnt";
> 
> @compiled = map { qr/$_/im } @patternlist;

[snip]

> but the pattern matching options are hardcoded in the qr// operator,
> whereas I would like to have them in the pattern strings:
> 

See the description of (?imsx-imsx) in the perlre doc. E.g.

'(?mi)windows[\s\n]*nt'

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


------------------------------

Date: Thu, 19 Oct 2000 12:01:19 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Regexp as input strings
Message-Id: <39EF44FF.C2A06549@ipac.caltech.edu>

Tim Conrow wrote:
> 
> Stephane Barizien wrote:
> > I wanna match one string against as set of regexp patterns which are
> > themselves stored in strings.
> >
> > The following works:
> >
> > @patternlist = ("kernel", "bar", "windows[\s\n]*nt");
> 
> You'll probably want to use single quotes on your strings. E.g. in
> "windows[\s\n]*nt" Perl sees the \s as simply an s, not as the whitespace class
> meta-character. Or else double your backwhacks.
> 
> > $str = "kernel steve Windows\nnt";
> >
> > @compiled = map { qr/$_/im } @patternlist;
> 
> [snip]
> 
> > but the pattern matching options are hardcoded in the qr// operator,
> > whereas I would like to have them in the pattern strings:
> >
> 
> See the description of (?imsx-imsx) in the perlre doc. E.g.
> 
> '(?mi)windows[\s\n]*nt'

Oops, sorry, I was too rushed. That's

'(?mi:windows[\s\n]*nt)'

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


------------------------------

Date: Thu, 19 Oct 2000 21:52:52 +0200
From: "Stephane Barizien" <sto41@NwOaSnPaAdMoo.fr>
Subject: Re: Regexp as input strings
Message-Id: <8snjf1$eab$1@wanadoo.fr>

"Tim Conrow" <tim@ipac.caltech.edu> a ιcrit dans le message news:
39EF44FF.C2A06549@ipac.caltech.edu...
> Tim Conrow wrote:
> >
> > Stephane Barizien wrote:
> > > I wanna match one string against as set of regexp patterns which are
> > > themselves stored in strings.
> > >
> > > The following works:
> > >
> > > @patternlist = ("kernel", "bar", "windows[\s\n]*nt");
> >
> > You'll probably want to use single quotes on your strings. E.g. in
> > "windows[\s\n]*nt" Perl sees the \s as simply an s, not as the
whitespace class
> > meta-character. Or else double your backwhacks.
> >
> > > $str = "kernel steve Windows\nnt";
> > >
> > > @compiled = map { qr/$_/im } @patternlist;
> >
> > [snip]
> >
> > > but the pattern matching options are hardcoded in the qr// operator,
> > > whereas I would like to have them in the pattern strings:
> > >
> >
> > See the description of (?imsx-imsx) in the perlre doc. E.g.
> >
> > '(?mi)windows[\s\n]*nt'
>
> Oops, sorry, I was too rushed. That's
>
> '(?mi:windows[\s\n]*nt)'

Actually I'll be reading my patterns from a file so no quoting there.

Thanks to both, I'll give that (? construct a try.


--


-------------------
Stephane Barizien

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NOTICE: my personal email address now is sto41@NwOaSnPaAdMoo.fr
Remove 'NOSPAM' to get it right (I hate spammers).
Please update your address book.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

WARNING! This message was sent from my home account!
Business correspondents please cc: barizien@NoOcSePgArM.fr
on replies; Thanks in advance.






------------------------------

Date: Thu, 19 Oct 2000 20:19:35 +0100
From: "Paul Barker" <pbarker@ntlworld.com>
Subject: Re: running perl program in the background
Message-Id: <mNHH5.14647$NQ4.339610@news2-win.server.ntlworld.com>

If the program does no output to STDOUT you could make a GUI perl (or hide
the console) as suggested on
Jenda's page at http://jenda.mccann.cz/perl/GUIscripts.html

Hope it helps

PaulB

<rameshdorai@my-deja.com> wrote in message
news:8sn7j6$6to$1@nnrp1.deja.com...
> Hi
>
> I am trying to write a perl program which schedules a job periodically.
> In between jobs, the program sleeps. So, if I run the program, I can see
> the dos window sitting on my desktop.
>
> Is there a way to run my program in the background in dos without me
> seeing a dos window, like what UNIX is capable of.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4666
**************************************


home help back first fref pref prev next nref lref last post