[11769] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5369 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 13 07:08:02 1999

Date: Tue, 13 Apr 99 04:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 13 Apr 1999     Volume: 8 Number: 5369

Today's topics:
        Calling Oracle Stored Procedures from Perl <ohenlich@conduitgroup.com>
    Re: Can Perl implement a state machine? (Bart Lateur)
        comparing arrays? <mathias@singapura.singnet.com.sg>
    Re: comparing arrays? (Larry Rosler)
        Delete Line Feed/Carriage Return markaw2091@my-dejanews.com
    Re: Delete Line Feed/Carriage Return (Larry Rosler)
    Re: Examples of slow regexes? (was: Re: Perl regexps co (Bart Lateur)
    Re: Getting long filename from 8.3 filename? (David Cantrell)
    Re: Getting long filename from 8.3 filename? (Jonathan Stowe)
    Re: How to get yesterday date <rra@stanford.edu>
    Re: Language Netiquette (Was: Re: Counter Digits) (Leo Schalkwyk)
    Re: ODBC DSN written in perl? toffie@my-dejanews.com
        PERL Employment Offered (M.Serve)
    Re: Perl regexps compared to Python regexps <rra@stanford.edu>
        Putting a pause or a delay within a perl program <thuratin@home.com>
    Re: Putting a pause or a delay within a perl program (Sam Holden)
    Re: Putting a pause or a delay within a perl program (Larry Rosler)
        Q: IMAP module? <jingang@cyberway.com.sg>
    Re: Q: IMAP module? (Jonathan Stowe)
    Re: Seeking Exchange tools (Jonathan Stowe)
        SQL using the ODBC module chatswood@my-dejanews.com
    Re: stripping spaces out & LF/CR markaw2091@my-dejanews.com
    Re: stripping spaces out & LF/CR (Sam Holden)
    Re: stripping spaces out & LF/CR (Larry Rosler)
    Re: Where we can get perl code snippets? (Jonathan Stowe)
    Re: Y2K (yes, again - sorry!) <matthew.sergeant@eml.ericsson.se>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 13 Apr 1999 09:12:09 +0100
From: "Oliver Henlich" <ohenlich@conduitgroup.com>
Subject: Calling Oracle Stored Procedures from Perl
Message-Id: <3712fc3a.0@nnrp1.news.uk.psi.net>

Hi!

Has anyone ever managed to call oracle stored procedures from perl?

We've been using oraperl (oraDBI)

Any Yes or No's would be appreciated.
Even more helpful would be a bit of example code or some URL which could
help.

Cheers Guys




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

Date: Tue, 13 Apr 1999 10:26:01 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Can Perl implement a state machine?
Message-Id: <37131488.4058902@news.skynet.be>

Jeffrey Davey wrote:

>I was wondering if anyone knows how adept Perl is at implementing a
>state machine.  

Sure it can. For basic state machines, hashes are all you need.

I'll give a simple example to get you started. Imagine you try matching
/^a*b(c|d)*$/ using a state machine alone. The transitions are: (display
using a fixed pitch font to see it as it's intended):
	 
	 ---   a   --- _
	| 0 | --> | 1 |_) a
 	 ---       ---
	  | b     b | 
	  |   ===   |
	   -># 2 #<-
	      ===
	       | c|d
	       V 
	      === _
	     # 3 #_) c|d
	      ===

In words: go from 0 to 1 on an "a", go from 1 to 2 on a "b", but stay in
1 on an "a". Go from 0 straight to 2 on a "b". Go from 2 to 3 on a "c"
or a "d". Stick in 3 if a "c" or a "d". Every other input is an error.
Starting state is 0, and acceptable end states are 2 and 3.

This Perl code does the implementation; current state is in a hash
reference. 

  #! perl -w
  $_ = 'aaaaaaabcdccccdc';

  #matches /^a*b(c|d)*$/
  %goto0 = ( a => \%goto1, b => \%goto2 );
  %goto1 = ( a => \%goto1, b => \%goto2 );
  %goto2 = ( c => \%goto3, d => \%goto3, ACCEPT => 1 );
  %goto3 = ( c => \%goto3, d => \%goto3, ACCEPT => 1 );

  $state = \%goto0; #start state
  foreach $char (split //) {
    $state = $state->{$char} or die "Failed on '$char'";
  }
  die "Not in acceptable end state" unless $state->{ACCEPT};
  print STDERR "Pattern matched succesfully\n";

Note that I mixed input and success indication in the hash, but that is
acceptable if the input cannot be confused with the special hash keys.
"ACCEPT" is more than one character, so it will not ever be confused
with an input character.

>The type we'd like to use is one that is table-driven,
>in that functions called within a state are referenced from within an
>array.  Haven't seen yet that Perl can do this.

Code references are your answer: Use a code reference as the hash's
value, and execute it. You can easily go far beyond ordinary state
machines, even do recursive parsing, if the code calls the state machine
engine. Other people have already given some details on how to do that,
so I won't repeat it.

	Bart.


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

Date: 13 Apr 1999 08:57:20 GMT
From: Mathias Koerber <mathias@singapura.singnet.com.sg>
Subject: comparing arrays?
Message-Id: <7ev0tg$128$3@mawar.singnet.com.sg>

Hi there,

I have several arrays containing strings. Is there an easy/fast
way to compare these. The basic requirement here is to find out whether
all arrays/contents agree, or if some contain less/more/other strings than
others.

I know this is doable in a dual loop, comparing each element of each
array with each element of another, (after sorting each array) and
comparing the numebr of elements in each array ($#arrayname)..

I wonder whether there is a shorter way to achieve the same.


regards

-- 
Mathias Koerber	  | Tel: +65 / 471 9820    |   mathias@staff.singnet.com.sg
SingNet NOC	  | Fax: +65 / 475 3273    |            mathias@koerber.org
Q'town Tel. Exch. | PGP: Keyid: 768/25E082BD  finger mathias@singnet.com.sg
2 Stirling Rd     |      1A 8B FC D4 93 F1 9A FC BD 98 A3 1A 0E 73 01 65
S'pore 148943     | Disclaimer: I speak only for myself
Bills travel through the mail at twice the speed of checks


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

Date: Tue, 13 Apr 1999 03:03:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: comparing arrays?
Message-Id: <MPG.117cb62f62c109899898a1@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7ev0tg$128$3@mawar.singnet.com.sg> on 13 Apr 1999 08:57:20 
GMT, Mathias Koerber <mathias@singapura.singnet.com.sg >says...
> I have several arrays containing strings. Is there an easy/fast
> way to compare these. The basic requirement here is to find out whether
> all arrays/contents agree, or if some contain less/more/other strings than
> others.
> 
> I know this is doable in a dual loop, comparing each element of each
> array with each element of another, (after sorting each array) and
> comparing the numebr of elements in each array ($#arrayname)..
> 
> I wonder whether there is a shorter way to achieve the same.

This was discussed previously, and you might find it by searching 
DejaNews.

The following is very short, but not necessarily the fastest.  It relies 
on converting the two arrays to strings, joining them using a character 
that isn't in the original data.  I chose the $SUBSCRIPT_SEPARATOR, but 
a null byte "\0" might do as well.  If each array element is a 'line', 
then a join with a null string "" would so also.

$same = @a1 == @a2 && join($;, @a1) eq join($;, @a2);

Using this approach, the arrays must match in the same order.  Your 
interjection about sorting makes me wonder if that is required.  If so, 
one could sort the arrays before "stringifying" them.

$same = @a1 == @a2 && join($;, sort @a1) eq join($;, sort @a2);

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


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

Date: Tue, 13 Apr 1999 09:42:56 GMT
From: markaw2091@my-dejanews.com
Subject: Delete Line Feed/Carriage Return
Message-Id: <7ev3iv$iov$1@nnrp1.dejanews.com>

Hi There,

I have a Perl script (at foot of this message) which I am trying to use to
remove all of the "complete comment line(s)" from a.n. other text file/perl
script. That is to say that I want it to remove all lines which begin with a #
and then go on to remove all blank lines (those which are made up of a line
feed carriage return).

I was under the impression that I could do this by making use of the s/^#.*//g
and s/^$//mg. However, this does not seem to work. At least, the second part
does not work. Any help would be greatly appreciated at
mawilliams@walsh-international.com . FYI, here is the Perl script as it
currently stands:

print "Please enter the name of the file you wish to modify:\n";
$modify = <STDIN>;
$new =  "./test.txt";

open("fle", "$modify");
open("new", "> $new");

while (<fle>) {
	s/^#.*//g;
	s/^$//mg;
	print new "$_";
	}

close "fle";
close "new";



Regards,


-MAW-

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 13 Apr 1999 03:39:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Delete Line Feed/Carriage Return
Message-Id: <MPG.117cbeb0be4ee1329898a3@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7ev3iv$iov$1@nnrp1.dejanews.com> on Tue, 13 Apr 1999 
09:42:56 GMT, markaw2091@my-dejanews.com <markaw2091@my-dejanews.com> 
says...
> I have a Perl script (at foot of this message) which I am trying to use to
> remove all of the "complete comment line(s)" from a.n. other text file/perl
> script. That is to say that I want it to remove all lines which begin with a #
> and then go on to remove all blank lines (those which are made up of a line
> feed carriage return).
> 
> I was under the impression that I could do this by making use of the s/^#.*//g
> and s/^$//mg. However, this does not seem to work. At least, the second part
> does not work.

I thought I dealt with this in response to your previous post.  Oh, 
well...

> print "Please enter the name of the file you wish to modify:\n";
> $modify = <STDIN>;
> $new =  "./test.txt";
> 
> open("fle", "$modify");

Strings are not filehandles, which are by convention written in upper-
case anyway.

The quotes around $modify are bogus.

Does the name of the file you want to read end in a newline?

What happens if the 'open' fails?

  chomp $modify;
  open FLE, $modify or die "Couldn't read '$modify'.  $!\n";

> open("new", "> $new");

  open NEW, ">$new" or die "Couldn't write '$new'.  $!\n";

> while (<fle>) {
> 	s/^#.*//g;
> 	s/^$//mg;
> 	print new "$_";
> 	}

  while (<FLE>) {
  	next if /^#/;
  	next unless /./;  # Or,  next if /^$/;
  	print NEW;
  	}

As a one-liner:

  /^#/ or /^$/ or print NEW while <FLE>;

> close "fle";
> close "new";

  close FLE;
  close NEW;

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


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

Date: Tue, 13 Apr 1999 09:08:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Examples of slow regexes? (was: Re: Perl regexps compared to Python regexps)
Message-Id: <37140971.1219499@news.skynet.be>

Abigail wrote:

>Can anybody please give an
>^^ example of such a beast, point out the reason for it's slowness, and
>^^ possibly even recipes on what to avoid?
>
>"aaaaaaaaaaaaaaaaaaaaaab"  =~  /a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a.c/;

That IS slow. While I'm writing this, I'm still waiting for the match to
terminate.

BTW I was just reading in my copy of the april '99 issue of DDJ (bought
it just yesterday), there's an article on a simple implementation of
grep, and and I quote:

	"Pathological expressions can cause exponential behaviour, such
	 as "a*a*a*a*a*b" when given the input "aaaaaaaaac", but the
	 exponential behaviour exists in many applications, too."

So this is the same example. I guess it's the same (exponential?)
behaviour.

But what strikes me is that it is /obvious/, to me anyway, that /a*a*b/
is equivalent to /a*b/, since because of the greedy nature of the regex,
IF it matches, the first subpattern will have grabbed everything, and
the second subpattern will be empty. Always. The same goes for
/[ab]*b*/, which is equivalent to /[ab]*/, and /[ab]*b+/ is equivalent
to /[ab]*b/: the first subpattern will grab everything but the final
"b".

What is a bit strange is that Perl's regex compiler doesn't even warn
for the inefficiency, let alone optimize it. So: is it indeed *easy* for
a regex compiler, to spot the possibility for simplification? How come
this jumps into my face?

And are there examples of (very) inefficient regexes than CANNOT be
simplified/optimized in this manner? 

Slightly more complicated examples, such as /[ab]*[ac]*[ab]*[ac]*/ come
to mind. /[ab]*[ac]*/ must be equivalent to /[ab]*(?:c[ac]*)?/, which
*looks* like it should be more efficient, but it isn't. In fact, it's a
bit slower.

BTW the test script still hasn't finished.

	Bart.


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

Date: Tue, 13 Apr 1999 09:28:12 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Getting long filename from 8.3 filename?
Message-Id: <37130bbb.317898493@news.insnet.net>

On Mon, 12 Apr 1999 17:14:04 GMT, hgelman@ntia.doc.gov asked:

>I have a short perl script that will run under Windows, and I've made it into
>an executable through perl2exe.  Ideally, I'd like to drag a file onto the
>executable, and then process that file in the perl script.  Unfortunately,
>the Windows Explorer is stupidly passing the 8.3 filename (e.g.,
>"this is a long file.txt" becomes "thisis~1.txt").  That's useless to me,
>since I actually need to extract info from the filename.

$results=`cmd /c "dir BASH_H~1"`

where BASH_H~1 should be replaced with whatever 8.3 filename you want
to correct.  In my system, BASH_H~1 corresponds to .bash_history and
 .bash_history is indeed mentioned in $results

Extracting just the filename from the rubbish in $results is left as
an exercise for the reader ;-)

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Tue, 13 Apr 1999 10:00:25 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Getting long filename from 8.3 filename?
Message-Id: <3713155a.7642621@news.dircon.co.uk>

On Tue, 13 Apr 1999 09:28:12 GMT, NukeEmUp@ThePentagon.com (David
Cantrell) wrote:

>On Mon, 12 Apr 1999 17:14:04 GMT, hgelman@ntia.doc.gov asked:
>
>>                                                            Unfortunately,
>>the Windows Explorer is stupidly passing the 8.3 filename (e.g.,
>>"this is a long file.txt" becomes "thisis~1.txt").  That's useless to me,
>>since I actually need to extract info from the filename.
>
>$results=`cmd /c "dir BASH_H~1"`
>
<snip>
>
>Extracting just the filename from the rubbish in $results is left as
>an exercise for the reader ;-)
>

/b ?

/J\


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

Date: 13 Apr 1999 01:14:02 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: How to get yesterday date
Message-Id: <yl90bxey45.fsf@windlord.stanford.edu>

Philip Newton <Philip.Newton@datenrevision.de> writes:
> Russ Allbery wrote:

>> # will subtract 0.  If $tdst is 1 and $ndst is 0, subtract an hour more
>> # from yesterday's time since we gained an extra hour while going off
>> # daylight savings time.  If $tdst is 0 and $ndst is 1, subtract a
>> # negative hour (add an hour) to yesterday's time since we lost an hour.

> Are there any weird places that add/subtract something other than one
> hour in DST? Like 0.5 or 1.5 hours?

I'm fairly sure not.  I don't see any indication in Solaris that it's
prepared to cope with such an event, at least.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 13 Apr 1999 10:32:14 GMT
From: schalkwy@minnie.RZ-Berlin.MPG.DE (Leo Schalkwyk)
Subject: Re: Language Netiquette (Was: Re: Counter Digits)
Message-Id: <7ev6fe$7ab$1@fu-berlin.de>

Given that lr routinely posts high value help I think it's a bit 
rich to tell him off for crossposting to a German language group 
in English.  The .de reader can either benefit from the posting 
or press "n". 

Leo "kann kaum Deutsch" Schalkwyk

Larry Rosler (lr@hpl.hp.com) wrote:
: [Posted and a courtesy copy sent to Joerg Plate.]

: Last Friday, I posted a response in English to a response in English to 
: a post in English that had been cross-posted to several newsgroups 
: (including some wrong ones) but also including the two groups I am 
: posting to now:  comp.lang.perl.misc and de.comp.lang.perl.  Below are 
: just the starts of the three posts.

<snip>
: War das wahrlich mein Fehler?

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

--


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

Date: Tue, 13 Apr 1999 08:54:38 GMT
From: toffie@my-dejanews.com
Subject: Re: ODBC DSN written in perl?
Message-Id: <7ev0oc$ggo$1@nnrp1.dejanews.com>

This would be possible but certainly not an easy task and it would be
worthwhile to look at the options (use a transaction server on unix, use full
middleware solutions like openlink or sequelink,..) before attempting
something like this. If you would use an dll which exported all the ODBC
functions.. (you can find a template in the ODBC SDK which is downloadable
from the microsoft site) and make this dll call certain perl functions this
just could work but I for one would at least pull out two weeks to make build
something like this.. mind you .. this would be a very simple driver with not
a lot of functionality...

Toffie.


In article <7etd7h$3v4$1@nnrp1.dejanews.com>,
  eric_lenio@my-dejanews.com wrote:
> Hi -
>
> Is it possible to write an ODBC driver in perl, so that it shows up in the
> Control Panel as an ODBC DSN?  The driver doesn't actually have to be written
> in perl, but it needs to at least be a link (via perl's API) to a perl
> process. That way, I can feed all sorts of perl data into my Windoze
> applications.
>
> In particular, I have an Ingres database running on a unix server which I
> want to access from Windows.  I don't want to use the Ingres ODBC driver
> because that requires purchasing Ingres for Windows.  Instead, I'd rather do
> something like below:
>
> Windows <--> perl ODBC DSN <--> DBI perl on unix <--> Ingres on unix
>
> Note that installing DBD::Ingres directly on Windows can't do this since it
> needs to link to the Ingres libraries, which in my case live in unix (no PC
> Ingres).
> Thanks,
> Eric.
> elenio@mct.rochester.edu
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 13 Apr 1999 11:26:21 GMT
From: stardust@starblazer.win-uk.net (M.Serve)
Subject: PERL Employment Offered
Message-Id: <652@starblazer.win-uk.net>

A competent PERL writer is sought by a UK-based publisher to prepare
a session control and mail form script.

We need a slimmed-down shopping cart environment which enables
readers to request further information about products featured in our
pages.

Unlike normal cart scripts which are designed to handle prices and
quantities prior to checkout, we simply want to be able to send email
messages to advertisers. When a user checks a box marked "Request
more info", the script should collect the advertiser's email
address and a product identifier (from the page) and place these
items in the shopping cart. 

On checkout, the script will collect the user's contact details
and email them to the appropriate advertisers whose email addresses
and product IDs have accumulated in the cart. The user should receive
a confirmation by email and all reponses should be emailed to the
publisher and web master. A log might also be useful or the ability
to call an existing logger.  After checkout, the script should return
the user to a specified new page.

That's all there is to it! 

An example of the problem to be solved can be seen at the URL:

http://www.emc-journal.co.uk/snippets/

If you are interested in solving this problem for us, please reply
with some ball park figures of your fee and some examples of scripts
you have written. Alternative solutions utilising JAVA will be
considered, although personally I have greater faith in PERL. 

Robert Fellowes

Editor - Hereford Web Pages
http://www.ibmpcug.co.uk/~mserve/hereford.html

-------------------------------------------------------------------
Media Services - Hereford - UK | Research & Photography    
http://www.starblazer.co.uk/   | Documentation & Reportage      
Tel: +44 (0)1432 273630        | Web Site Design & Management
___________________________________________________________________  
 



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

Date: 13 Apr 1999 01:29:54 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl regexps compared to Python regexps
Message-Id: <yl6770gby5.fsf@windlord.stanford.edu>

matthew freake <matthew.freake@smlawpub.co.uk> writes:

> Without wishing to start a Perl vs Python discussion, I was wondering
> does anyone out there know if there are any major differences between
> the the two languages implementations of regular expressions.

The overall answer is that unless you're doing fairly odd and special
things and deeply grok and appreciate the stuff that Ilya's put into the
latest and greatest Perl regex engines, you'll never notice the difference
except for syntax.

Perl's engine is arguably more powerful, but the added power is all in
fairly obscure areas.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 13 Apr 1999 09:58:43 GMT
From: Thu Ra Tin <thuratin@home.com>
Subject: Putting a pause or a delay within a perl program
Message-Id: <37131527.3D558CC1@home.com>

Hello there,

What would be the best way to put a delay in a program?  For example, I
want the program to pause for about 30 seconds to 2 minutes before
continuing.


I used the following for-next loop:
for ($j = 1; $J < 500000; $j = $j + 1){}

On my NT, my CPU usage goes up to full and everything slows down to a
crawl.  Any help in putting a pause in a program will be appreciated.

Thank you for you help.
thuratin@home.com


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

Date: 13 Apr 1999 10:07:20 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Putting a pause or a delay within a perl program
Message-Id: <slrn7h65qo.d1o.sholden@pgrad.cs.usyd.edu.au>

On Tue, 13 Apr 1999 09:58:43 GMT, Thu Ra Tin <thuratin@home.com> wrote:
>Hello there,
>
>What would be the best way to put a delay in a program?  For example, I
>want the program to pause for about 30 seconds to 2 minutes before
>continuing.

perldoc -f sleep


-- 
Sam

Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work."  --Larry Wall


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

Date: Tue, 13 Apr 1999 03:13:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Putting a pause or a delay within a perl program
Message-Id: <MPG.117cb897678e746e9898a2@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37131527.3D558CC1@home.com> on Tue, 13 Apr 1999 09:58:43 
GMT, Thu Ra Tin <thuratin@home.com >says...
> What would be the best way to put a delay in a program?  For example, I
> want the program to pause for about 30 seconds to 2 minutes before
> continuing.

perldoc -f sleep

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


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

Date: Tue, 13 Apr 1999 08:52:51 +0000
From: "Jin.G" <jingang@cyberway.com.sg>
Subject: Q: IMAP module?
Message-Id: <371305E3.87660D1D@cyberway.com.sg>

Hi,

where can I find a relatively robust IMAP module that implements most
features of IMAP protocal?

pls reply by email

thanks,
_J_




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

Date: Tue, 13 Apr 1999 10:07:38 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Q: IMAP module?
Message-Id: <37131668.7912403@news.dircon.co.uk>

On Tue, 13 Apr 1999 08:52:51 +0000, "Jin.G" <jingang@cyberway.com.sg>
wrote:

>Hi,
>
>where can I find a relatively robust IMAP module that implements most
>features of IMAP protocal?

http://www.perl.com/CPAN/authors/id/MICB/AuthenIMAP.pm.gz

http://www.perl.com/CPAN/authors/id/U/UG/UGEN/IMAPGet-0.1.tar.gz

http://www.perl.com/CPAN/authors/id/E/EE/EESTABROO/IMAP-Admin-0.8.2.tar.gz

As a cursory look at CPAN indicated - if you are looking for *any*
module then the general principle is (has been ? might be ? I cant
remember the outcome of that discussion a while back :) that if it
isnt on CPAN then it doesnt exist.

/J\


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

Date: Tue, 13 Apr 1999 09:26:11 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Seeking Exchange tools
Message-Id: <37130c06.5254234@news.dircon.co.uk>

On Tue, 13 Apr 1999 14:03:11 +0800, Terry Gliedt <tpg@cls.uob.com.sg>
wrote:

>I'm trying to write some tools to allow me to send Email to an Exchange
>server (SMTP protocol has been artifically blocked in this case) and I
>hope someone has used Perl to solve this. Specifically I'm looking for:
>
> (1) Perl (or other) code to submit Email to an Exchange user. It cannot
>use the SMTP protocol as Internet addresses (e.g. terry@mycompany.com)
>are not allowed. It must use the Exchange address format.
>
>(2) Perl (or other) code to allow one to programmatically get the
>address of an Exchange user from the Exchange global address list.
>
>Any leads would be greatly appreciated  TIA!
>

If you have the latest ActivePerl Installed see :

   C:\Perl\html\Perl-Win32\perlwin32faq9.html

Specifcally the section entitled:
    
  Is there a way to access MAPI from my Perl script?

Alternatively you could use Win32::OLE to control Outlooks objects
this also documenented in the HTML docs that come with ActivePerl.

For more Win32 specific help you might want to join one of the mailing
lists at:

   <http://www.activestate.com/support/mailing_lists.htm>

/J\


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

Date: Tue, 13 Apr 1999 09:17:32 GMT
From: chatswood@my-dejanews.com
Subject: SQL using the ODBC module
Message-Id: <7ev238$hgk$1@nnrp1.dejanews.com>

I've been experimenting with the ODBC module for a web-based project, and have
been reasonably successful using an sql command to get information out of an
Access97 database.

However, my current objective is to use an "insert into" statement to append a
new record to the database. The SQL query itself works from inside Access but
doesn't seem to operate via the ODBC connection.

Any help appreciated?

Maurice Kelly

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 13 Apr 1999 08:12:57 GMT
From: markaw2091@my-dejanews.com
Subject: Re: stripping spaces out & LF/CR
Message-Id: <7euua3$em2$1@nnrp1.dejanews.com>

In article <3711F20B.9F79548E@unlinfo.unl.edu>,
  qcoldiron@yahoo.com wrote:
> I read the perl FAQ, and found a reg exp to strip spaces, but it only
> strips spaces off the beginning and end of a string.  I want to strip
> ALL the spaces out of a string.  Does anybody have a reg exp that will
> do this?
>
> Quinn
>
>

As an extension to this question I would like to ask you how you strip out all
Blank Lines in a file. (That is to say all the lines which are line
feed/Carriage Returns). FYI, i am using Perl on win32 (NT/98). I believed it
would be something like s/^$//gm, but this does not appear to work. Can anyone
help me please?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Apr 1999 08:55:22 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: stripping spaces out & LF/CR
Message-Id: <slrn7h61jq.8vd.sholden@pgrad.cs.usyd.edu.au>

On Tue, 13 Apr 1999 08:12:57 GMT, markaw2091@my-dejanews.com wrote:
>In article <3711F20B.9F79548E@unlinfo.unl.edu>,
>  qcoldiron@yahoo.com wrote:
>> I read the perl FAQ, and found a reg exp to strip spaces, but it only
>> strips spaces off the beginning and end of a string.  I want to strip
>> ALL the spaces out of a string.  Does anybody have a reg exp that will
>> do this?

tr/ //d; unless by spaces you mean whitespace when something like 
tr/ \t\n//d; might be better...

>>
>> Quinn
>>
>>
>
>As an extension to this question I would like to ask you how you strip out all
>Blank Lines in a file. (That is to say all the lines which are line
>feed/Carriage Returns). FYI, i am using Perl on win32 (NT/98). I believed it
>would be something like s/^$//gm, but this does not appear to work. Can anyone
>help me please?

s/^\n//gm will work if the whole file is in $_.

As a command though :

perl -ni -e 'print unless /^$/' #drop the i if don't want to update the file...


-- 
Sam

Even if you aren't in doubt, consider the mental welfare of the person
who has to maintain the code after you, and who will probably put parens
in the wrong place.	--Larry Wall


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

Date: Tue, 13 Apr 1999 02:25:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: stripping spaces out & LF/CR
Message-Id: <MPG.117cad5c3d9a1dde9898a0@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7euua3$em2$1@nnrp1.dejanews.com> on Tue, 13 Apr 1999 
08:12:57 GMT, markaw2091@my-dejanews.com <markaw2091@my-dejanews.com 
>says...
 ... 
> As an extension to this question I would like to ask you how you strip out all
> Blank Lines in a file. (That is to say all the lines which are line
> feed/Carriage Returns). FYI, i am using Perl on win32 (NT/98). I believed it
> would be something like s/^$//gm, but this does not appear to work. Can anyone
> help me please?

Don't forget that /$/ doesn't match "\n" -- it matches ahead of "\n"
if there is one.

If the contents of the file are in a string, then the regex would be:

    s/^\n//gm

If the contents of the file are lines in an array, your regex works 
also:

    @stripped = grep !/^$/, @file;

That could be written easier, though:

    @stripped = grep /./, @file;

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


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

Date: Tue, 13 Apr 1999 08:25:08 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Where we can get perl code snippets?
Message-Id: <3712fd7f.1534380@news.dircon.co.uk>

On Tue, 13 Apr 1999 16:17:53 +0900,
=?euc-kr?B?udrBvrq5IChQYXJrLCBKb25nLVBvcmsp?= <okclub@communitech.net>
wrote:

>Where is perl code snippets??
>

Hang around here long enough and you'll see hundreds - ranging from
small fragments to almost complete programs.

>Do you know?

Also if you go to <http://reference.perl.com/>  You will find
referenced there a variety of scripts, Modules, utilities etc in a
range of categories.


/J\


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

Date: Tue, 13 Apr 1999 09:10:05 +0100
From: Matt Sergeant <matthew.sergeant@eml.ericsson.se>
Subject: Re: Y2K (yes, again - sorry!)
Message-Id: <3712FBDD.1B579FDF@eml.ericsson.se>

"Matthew O. Persico" wrote:
> 
> Matt Sergeant wrote:
> >
> > Someone mailed me directly the other day (like I'm some kind of
> > authority on the subject!) asking me for a statement as to whether perl
> > was y2k compliant. I gave the standard answer, and the URL on
> > www.perl.com.
> 
> Who is this someone? Is it a supplier of yours? A customer of yours? Anyone at all who you have any dealings with at all on a business or personal basis?

The ridiculous thing is I didn't even know the company. It's some
eastern (I think Japanese) company - probably some big bank or
something. FWIW I'm ignoring the request completely - I'll be damned if
Fastnet are going to be liable for someone's Y2K issues.

-- 
<Matt email="msergeant@ndirect.co.uk" />

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5369
**************************************

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