[22051] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4273 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 17 00:06:08 2002

Date: Mon, 16 Dec 2002 21:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 16 Dec 2002     Volume: 10 Number: 4273

Today's topics:
        GOT IT! Re: simple, simple regex Q <penny1482@attbi.com>
    Re: Hebrew to web from Access 2000 <goldbb2@earthlink.net>
    Re: Hebrew to web from Access 2000 <flavell@mail.cern.ch>
    Re: Help on $CHILD_ERROR <goldbb2@earthlink.net>
    Re: Help with Assignment of Split Value from STDIN to H <GPatnude@adelphia.net>
    Re: Hiya <bibleboy_101@shaw.ca>
    Re: How to reference multiple keys from a hashref? <tassilo.parseval@post.rwth-aachen.de>
        Improving file record terminator code (Kevin Newman)
    Re: Improving file record terminator code <goldbb2@earthlink.net>
    Re: Invoke a browser every 2 hours ...how? <goldbb2@earthlink.net>
    Re: Invoke a browser every 2 hours ...how? <jurgenex@hotmail.com>
        Mail::POP3Client faliure,...? <cmustard_!SPAM@nyc.rr.com>
    Re: PErl and CSS (ToxicFungi)
    Re: PErl and CSS (ToxicFungi)
    Re: PErl and CSS <mgjv@tradingpost.com.au>
    Re: PErl and CSS <bart.lateur@pandora.be>
        Perl preinstalled. bad @INC <t18_pilot@hotmail.spam.com>
    Re: Perl variables Which part of Memory <goldbb2@earthlink.net>
        problems compiling 5.8.0 on UnixWare 7.1.1 (wild98)
    Re: problems compiling 5.8.0 on UnixWare 7.1.1 <goldbb2@earthlink.net>
    Re: simple, simple regex Q (Tad McClellan)
    Re: STDIN/stream/filehandle<?> question <goldbb2@earthlink.net>
        tk & ole? <rf_wu@163.com>
    Re: unix2dos newbie question <goldbb2@earthlink.net>
        word lenght (R.Noory)
    Re: word lenght (Tad McClellan)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 17 Dec 2002 00:38:33 GMT
From: "Dick Penny" <penny1482@attbi.com>
Subject: GOT IT! Re: simple, simple regex Q
Message-Id: <dmuL9.372570$%m4.119470@rwcrnsc52.ops.asp.att.net>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnavsn59.g55.tadmc@magna.augustmail.com...
> Dick Penny <penny1482@attbi.com> wrote:
>
> > I thought I had conquered simple regexs. I guess I'm simple cause I
can't
> > figure out why the following snippet matches on data line 1.
> > -------- regex
> > /\d+\D*(\d+)/
>
>
> Describe that pattern in English:
>
>    digit chars with zero or more non-digits in between.
>
>
> > ---------data line 1
> >>>SPH nb 83
>
>
> That has digit chars with zero non-digits in between, matches!
>
> Beware of matching the empty string...
>
>
> --
>     Tad McClellan                          SGML consulting
THANKS. Maybe original fat fingers, don't recal, the D* sb D+. But after
more reflections, I think the D* sb s+.
Dick




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

Date: Mon, 16 Dec 2002 21:09:04 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Hebrew to web from Access 2000
Message-Id: <3DFE8740.BE1E9203@earthlink.net>

bpaluch wrote:
> 
> I am using Perl to display data from an Access 2000 database on the
> web.  I would like to enter Hebrew into the database, and then display
> that on the web, as well.  However, since Access stores in Unicode, it
> seems to be causing trouble and cannot show on the web.  All I get is
> ?????.

You have a number of seperate problems.

1/ You want a user to enter Hebrew in an html form, and submit it to a
CGI program.  The Hebrew will be in some encoding -- you need to either
convince the web browser submitting the form to use the encoding you
desire (by putting something special in the html of the form that the
user is filling out), or else you need to find out what encoding was
used by the browser, so you can convert it into your preferred form.

This is not a perl problem, no matter what you use to produce the html
form that the user is filling out.

2/ You need to convert the data you've gotten from the user through the
CGI protocol, from whatever encoding it is in, into some canonical
encoding.

Assuming of course that you're writing your CGI program in perl, then
this part is a perl problem.  You want Text::IConv, or Encode.pm to do
this.  Well, unless you've coerced the web browser to send in the
encoding that you desire, in the first place.

3/ You need to store that canonicalized data into Access, in such a way
that it is not corrupted.

This is more an Access problem than a perl problem.

I'll assume that at step 2/, you converted your data into some form that
Access likes.  Does Access recognize that you've done this, or do you
have to do something else to tell it?

Then, at a later time...

4/ You need to retrieve that canonicalized data from Access.

This, hopefully, you don't need to be told how to do.

5/ You need to convert it into some encoding that you will send to the
user.

Again, use Text::IConv or Encode.pm or Unicode::String.

6/ You need to put the appropriate CGI headers and/or HTML markup so
that the browser will know what encoding the text was in, and
appropriate CGI headers and/or HTML markup so that the browser will know
what set of characters to use to display that text.

This isn't really a Perl problem, it's a CGI/HTML problem.

> What charset should I specify, if any?

Specify the character set that best represents the data.

> Do I need to use Unicode::String to help me with this?

Either that, or Encode.pm, or Text::IConv, or ...

> I think in ASP this can be done with a codepage.

What, just like magic?

There are many steps involved -- getting the html-form to the browser,
the filling out of the form by the user, the sending of the form data
from the browser to the server, the sending of the form data from the
server to the CGI program, the encoding and storage of the form data
into the database, then, later, the extraction and encoding of the data
from the database, the sending of the data back to the user.

Which step does "using a codepage" effect?

> Is there something comparable in Perl?

Perl has lots of magic, but not that much magic.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 17 Dec 2002 03:31:53 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Hebrew to web from Access 2000
Message-Id: <Pine.LNX.4.40.0212170320340.29166-100000@lxplus064.cern.ch>

On Dec 16, Benjamin Goldberg inscribed on the eternal scroll:

> 1/ You want a user to enter Hebrew in an html form, and submit it to a
> CGI program.  The Hebrew will be in some encoding -- you need to either
> convince the web browser submitting the form to use the encoding you
> desire (by putting something special in the html of the form that the
> user is filling out), or else you need to find out what encoding was
> used by the browser, so you can convert it into your preferred form.

I'd recommend c.i.w.a.cgi as the more appropriate place for
Perl-unrelated parts of the discussion, but as we're here, could I
mention http://ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html

I haven't tried rtl languages specifically, though.

> This is not a perl problem, no matter what you use to produce the html
> form that the user is filling out.

Quite.

[other important steps omitted, 'cause I can't offer any specific
help]

> > What charset should I specify, if any?
>
> Specify the character set that best represents the data.

Digression:
 What the MIME 'charset' parameter specifies is the character coding,
 in present-day terminology.  The 'document character set' in HTML4
 etc. is defined to be iso-10646 (effectively Unicode)...  Might seem
 like a nit, but misunderstanding of this important principle causes
 much confusion (even sometimes amongst browser implementers).

Your criterion is obviously one aspect, but you'd also want to make
sure that your choice is compatible with the somewhat buggy forms
submission support in available browsers.  My page is far from
complete, but gives some flavour of that part of the problem, I hope.
It can also be worth taking a look at the custom character-coding
support provided in various search engines (at least the visible part
of that support - you don't expect them to explain what the back end
looks like for commercial reasons, I suppose).



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

Date: Mon, 16 Dec 2002 19:55:57 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Help on $CHILD_ERROR
Message-Id: <3DFE761D.7BED4F8E@earthlink.net>

Sunil wrote:
> 
> -------------------------------------
>     my $command = "sqlplus -s scott\/tiger\@iasdb.local \@t.sql";
> 
>     open(ERRLOG, ">error.log") or die "Can't open error log! $!";
>     $OUTPUT_AUTOFLUSH = 1; # make unbuffered
>     open(OUTPUT, ">>output.log") or die "Can't open output log! $!";
>     $OUTPUT_AUTOFLUSH = 1; # make unbuffered

First, turning on autoflush is not the same as making a handle
unbuffered.  It merely makes it so that any print() or printf() operator
on that handle results in the buffer being flushed.

Further, Neither of these assignments to $OUTPUT_AUTOFLUSH has any
effect on the ERRLOG or OUTPUT handles, since neither of them are the
current default handle (as controled by the select() operator) at the
time that that magic variable is assigned to.

Not that it matters, since you apparently don't ever actually print() to
either of these handles in this process.

(Having autoflush on, or not, in this process, has NO EFFECT WHATSOEVER
on the behavior of child processes).

>     my $pid;
>     eval
>     {
>         my $pid = open3("<&STDIN", ">&OUTPUT", ">&ERRLOG", $command) or die
> "$!";
> print "Sunil 1 > " . ($CHILD_ERROR >> 8) . ' : ' . ($CHILD_ERROR & 8) .
> "\n";

The $CHILD_ERROR variable is only valid *after* you call waitpid(), or
wait(), or something which does that internally (system(), for example,
or close() on a filehandle which was opened by open(FH, "|...") or
opened by open(FH, "...|").).

>     };
>     die $@ if $@;

If you're going to die on error, why bother with the eval {} ?

>     waitpid ($pid, 0); # wait for it to die
> print "Sunil 2 > " . ($CHILD_ERROR >> 8) . ' : ' . ($CHILD_ERROR & 8) .
> "\n";

Ok, this is the only line for printing out $CHILD_ERROR that's in the
correct spot.  Not that it's written correctly -- you should have '&255'
where instead you have '&8', for some wierd reason.


>     close(ERRLOG) or die "Can't close filehandle! $!";
>     close(OUTPUT) or die "Can't close filehandle! $!";
> print "Sunil 3 > " . ($CHILD_ERROR >> 8) . ' : ' . ($CHILD_ERROR & 8) .
> "\n";

Neither of these closes were on special handles which perform waitpid
internally, so there's no need/reason to print out $CHILD_ERROR
afterwards.

> -----------------------
> 
> The above program gives the following output :-
> 
>     Sunil 1 > 6  :  0

This is an unimportant number -- for some reason, $? had some value in
it beforehand.  This is not relevant to your problem.

>     Sunil 2 > 16777215  :  8

The first number here is 0xFFFFFF, which indicates that $CHILD_ERROR had
the value -1 in it.  This means that waitpid() failed.  The only reason
I can think for this to happen is if errno==ESRCH, but since you never
test whether waitpid($pid, 0) succeeds, (and don't print out $! when it
fails), I don't know.  Assuming it is due to ESRCH, *that* in turn means
that your pid was reaped by something else, probably $SIG{CHLD}.  You
should not have a signal handler set if you plan on reaping your child
processes yourself.

When, where, and why are you setting $SIG{CHLD}?

>     Sunil 3 > 16777215  :  8
> 
> I am worried that in all three cases the status is not 0 (which I was
> expecting).
> Is my anxiety misplaced or do I have reason to worry.

Your anxiety is correctly placed.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 17 Dec 2002 02:21:30 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: Re: Help with Assignment of Split Value from STDIN to Hash Values (As Arrays)
Message-Id: <KSvL9.31732$VA5.3320457@news1.news.adelphia.net>


<Joe Blow> wrote in message
news:3icovuc92n8jqaeb90929uuaoai2l4or3k@4ax.com...
> Hello,
> First off, I hope I named the subject  correctly, feel free to beat me
> senseless if not.
>
> I seem to be close to solving this one. But My split value is getting
> assigned to the wrong variable. Any Help would Be Appreciated.
>
> I have an external Program that STDOUT's a list of configuration items
> /home/rod/>getconfig -c
> ITEM1 123456
> ITEM2 654321
> ITEM3 162534
>
> I am calling this with Backticks
>
> I have a clean array subroutine, that chomps lines, and removes
> whitespace (This Seems to Work As Expected)
>
> I am attempting this .
> Take the stdout of getconfig application
> while reading in the lines, chomp all newline characters,
> remove all whitespace except for space between
> ITEM1 and 123456, split that value and
> assign to $config->{items}->names (as Array element)  and
> $config->{items}->{values} (as Array element).
>
> When I run this now, all values after being split are being assigned
> to $config->{items}->{values}.  They are cleaned as requested, I am
> just confused as why this doesn't assign the first split scalar to
> $config->{items}->{names}.
>
> Complete Sample Snippet Below:
>
> Thank You,
> Rod
>
> #!/usr/local/perl/bin/perl -w
> #Snippet for Perl Gods to Help
> use strict;
> use Data::Dumper;
>
> my $seperator="--------------------------------------------------\n";
>
> #Sample Data with Variable whitespace to Simulate getconfig -c output
> (Single Item Only Real World is multiline)
> my $SampleData="DEPOTS 148130767.1.580           \n";
>
> #Show Unclean Data
> print Dumper($SampleData);
>
> #Verify clean_array works
> my @CleanData=clean_array($SampleData);
>
> #Show Cleaned Data
> print $seperator;
> print Dumper(@CleanData);
>
> my $config=undef;
> $config->{loadtime}=time;
> ###BEGIN PROBLEM CODE
> clean_array(@{$config->{items}->{names}},
> @{$config->{items}->{values}} = split("
> ",$SampleData));
> ###END PROBLEM CODE
> $config->{endtime}=time;
>
>
> print $seperator;
> print Dumper($config);
>
> sub clean_array{
> chomp(@_);
> foreach (@_){
> #Remove WhiteSpace At Beginning of Line
>          s/^\s+//;
> #Remove WhiteSpace At End of Line
> s/\s+$//;
> #Replace Multiple Spaces with Single Space
> s/\s+/ /;
> };
> return @_;
> };
>
>
>
> OUTPUT of snip.pl
>
> >perl -w snip.pl
> $VAR1 = 'DEPOTS 148130767.1.580
> ';
> --------------------------------------------------
> $VAR1 = 'DEPOTS 148130767.1.580';
> --------------------------------------------------
> $VAR1 = {
>           'items' => {
>                        'values' => [
>                                      'DEPOTS',
>                                      '148130767.1.580'
>                                    ],
>                        'names' => []
>                      },
>           'endtime' => 1039942214,
>           'loadtime' => 1039942214
>         };
> >Exit code: 0
>
You might consider taking a look at this methodology I developed... Sounds
like it may be a solution to your problem....

http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/167537




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

Date: Mon, 16 Dec 2002 23:49:37 GMT
From: "Anadriel" <bibleboy_101@shaw.ca>
Subject: Re: Hiya
Message-Id: <lEtL9.236026$ka.5619705@news1.calgary.shaw.ca>


"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:qdenvu4ba3uuch5qfha3p2n63tf3rkdt1d@4ax.com...
> Rod wrote:
>
> >> Hey all. I'm a newbie here, and to Perl. Basically, all I really want
is a
> >> page that will give me a thourough intro to perl, step-by-stpe, and
what
> >> excactly I need to use Perl. TY a bunch,
> >> --
> >
> >Try
> >perl.com
> >perl.org
> >cpan.org
>
> More specifically, don't forget about
>
> <http://learn.perl.org/>
>
>

Ty both... I tried that and it looks helpfull. :)

--
Andy
--------------------------------------------------------------
"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!"

> Bart.




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

Date: 16 Dec 2002 23:37:27 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: How to reference multiple keys from a hashref?
Message-Id: <atlo3n$2oq$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Uri Guttman:

>>>>>> "g" == godzilla  <barryk2@SPAM-KILLER.mts.net> writes:

>  >> I'd like to reference multiple keys simultaneously from a hashref, but I
>  >> haven't found anything about this in the docs.
>  >> 
>  >> If it weren't a ref, I'd use a hash slice..
>  >> 
> 
>  g> @items = map { $$hashref{$_} } ("alpha" , "charlie");
> 
> you can slice with a ref just fine. map is overkill.
> 
> 	@{$hash_ref}{ 'alpha', 'charlie' }

Another inconvenience with the map-approach is the fact that it's not
lvaluable which would render it at least half as useful as a real slice.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: 16 Dec 2002 15:10:11 -0800
From: knewman00@yahoo.com (Kevin Newman)
Subject: Improving file record terminator code
Message-Id: <8ed70cf8.0212161510.35dfaab2@posting.google.com>

Hi All,

I work with files that have the following format:
LINELENGTHBEGIN TEXT TEXT TEXT RECORD_SEPARATOR
LINELENGTH TEXT TEXT TEXT RECORD_SEPARATOR
LINELENGTH TEXT TEXT TEXT RECORD_SEPARATOR
LINELENGTHEND TEXT TEXT TEXT RECORD_SEPARATOR

Where:	RECORD_SEPARATOR can be (\LF|\CR|\CR\LF|\w|\0|)
	LINELENGTH will always be 4 digits (9999).

For example:
0123BEGIN This is the beginning of a data block
0123 Text is on this line
0123END This is the end of a data block
or
0123BEGIN This is the beginning of a data block0123 Text is on this
line0123END This is the end of a data block

What I would like to do is accurately terminate the records (lines) of
a file with \LF no matter what RECORD_SEPARATOR (or lack of a
RECORD_SEPARATOR) is used.   The tricky part is that the TEXT section
can be alphanumeric data, so the text value can be the same as the
LINELENGTH.  In general, the rules are:
1. If the data has a (\LF|\CR|\CR\LF|\0), ignore the LINELENGTH and
use the RECORD_SEPARATOR
2.	If the data has \w then use the LINELENGTH.

With that explanation out of the way, I have a few simple questions:
1.  What's the best way to determine the type of RECORD_SEPARATOR for
a particular file?
2.  Should I set $/ for each file?
3.  Is there a simpler way to write the RegEx? (i.e. eliminate the
variable substitution)

Here's a simple driver (see below) of what I have so far.  This code
works, but I know it can be simpler.  Please keep in mind that the
hard coded values (i.e. $LRecL = "0526") is just for testing.


Thanks in advance,

K. Newman

use strict;
my ($record,$LRecL,$recNo,$delim);

#$delim = "NONE";
	if ($delim eq "NONE")
	{
		$record = '{'. ($LRecL - 4) . '}';
		$LRecL = "0526";
	}
	else
	{
		$record = '*';
		$LRecL = "3364";
	}

	print "Reading file " . $ARGV[0]. " \n************************\n\n";
	
	while (<>){
	    while (/($LRecL.$record)/g){
	    	$recNo = sprintf ("%03d",$recNo += 1); #For Debugging
	      print  "$recNo: " . $1, "\n" ;
	    }
	}
	
	print "Logical Record = $LRecL \nRecord = $record\n";


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

Date: Mon, 16 Dec 2002 22:12:55 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Improving file record terminator code
Message-Id: <3DFE9637.A6D8E5CC@earthlink.net>

Kevin Newman wrote:
> 
> Hi All,
> 
> I work with files that have the following format:
> LINELENGTHBEGIN TEXT TEXT TEXT RECORD_SEPARATOR
> LINELENGTH TEXT TEXT TEXT RECORD_SEPARATOR
> LINELENGTH TEXT TEXT TEXT RECORD_SEPARATOR
> LINELENGTHEND TEXT TEXT TEXT RECORD_SEPARATOR
> 
> Where:  RECORD_SEPARATOR can be (\LF|\CR|\CR\LF|\w|\0|)
>         LINELENGTH will always be 4 digits (9999).

How about:

   while( 1 ) {
      local $/ = \4;
      defined(my $length = <>) or last;
      $/ = \$length;
      defined(my $data   = <>) or die;
      my $lrec = $. / 2; # logical record number.
      $data =~ s/\015\012\z|[\015\012\000]\z//;
      print "Record [$lrec] contains data [$data]\n";
   }

This completely ignores RECORD_SEPERATOR, except for the purpose of
removing it.  It assumes that LINELENGTH is always correct, regardless
of whether or not RECORD_SEPERATOR is present.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Mon, 16 Dec 2002 19:29:01 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Invoke a browser every 2 hours ...how?
Message-Id: <3DFE6FCD.5B778DBC@earthlink.net>

Kalyan C wrote:
> 
> Group,
> 
> I've a question...
> 
> I am to simulate a web-user who periodically tries to visit some
> web-sites, I could go for wget, but, I'm more interested in the
> browser based statistics like latencies associated with rendering the
> html etc. I would like to use the standard browsers viz., Netscape and
> Internet Explorer for my purposes.
> 
> To summarize:
> I would like to visit some web-sites periodically, say every 2 hours,
> without my actually being in front of the system. That is, invoke the
> browser (whatever that happens to be, Netscape or IE) every 2 hours
> with a specific URL.
> 
> Is there some way, I can do this ?

while( 1 ) {
   system("something");
   sleep( 2 * 60 * 60 );
}


-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 17 Dec 2002 01:13:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Invoke a browser every 2 hours ...how?
Message-Id: <QSuL9.17621$3t6.11533@nwrddc03.gnilink.net>

Kalyan C wrote:
> I would like to visit some web-sites periodically, say every 2 hours,
> without my actually being in front of the system. That is, invoke the
> browser (whatever that happens to be, Netscape or IE) every 2 hours
> with a specific URL.
>
> Is there some way, I can do this ?

To execute scheduled tasks the best way is to use the task scheduler that
came with your OS.
While it can be done in Perl alone, all those approaches are awkward at
best.
Depending on your needs a trivial "sleep 60*60*2;" may be sufficient. But
what happens if this process is being killed for whatever reason? Also, with
this very simplistic approach your next task will be started with a tiny
delay. Do you need to compensate for that?

It's way(!) easier to simply use what came with your OS.

jue




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

Date: Tue, 17 Dec 2002 04:47:22 GMT
From: mUs <cmustard_!SPAM@nyc.rr.com>
Subject: Mail::POP3Client faliure,...?
Message-Id: <slrnavtb74.1c3.cmustard_!SPAM@nyc.rr.com>


Ok, this is very frustrating, 2 days and many hours worth! I have used this 
module/lib (libwww) before with ease (on other distro's). I just installed
this module on my Debian Woody 3.0 box and it's not working. 
It seems like an encryption error (?). 

The following is the exact script i am trying to run, (except with my 
personal info removed) and below is the Debugging info i'm getting.

All my supplied data is correct, (i.e. username and password, i use the exact
same info for ~/.fetchmailrc and i retrieve mail fine. I am including a
Microsoft pop-server and a 'unknown' although probably some form of
*NIX server. 

I was also reciveing some MD5.pm error's although they seem be gone. 
I would appreciate any info, guidance or help anyone could provide.
thank you.

-mUs.

<script>
#!/usr/bin/perl -w

use Mail::POP3Client;
use strict;
use warnings;

my($pop,$usr,$passwd,$host,$i);
$usr = 'me@me.com';
$passwd = 'clear_text';
$host = 'pop.me.com';   


$pop = new Mail::POP3Client( USER  => "$usr",
                             PASSWORD => "$passwd",
                             DEBUG     => 1,
                             HOST     => "$host");

for ($i = 1; $i <= $pop->Count(); $i++) {
   foreach ( $pop->Head( $i ) ) {
        (/^(From|Subject):\s+/i) && print $_, "\n";
   }
  print "\n";
}
$pop->Close();

</script>

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

<debug output>

POP3 <- +OK
 at ./J_mail_client line 15
POP3 -> USER me@me.com
 at ./J_mail_client line 15
POP3 <- +OK
 at ./J_mail_client line 15
POP3 -> PASS clear_text
 at ./J_mail_client line 15
POP3 <- -ERR
 at ./J_mail_client line 15
POP3 -> QUIT
 at ./J_mail_client line 26
Use of uninitialized value in join or string at /usr/share/perl/5.6.1/Carp/Heavy.pm line 145, <GEN0> line 3.
POP3 <-  at ./J_mail_client line 26
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 828, <GEN0> line 3.
Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Mail/POP3Client.pm line 313.

</debug output>

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

<debug output on msserver>

POP3 <- +OK Microsoft POP3 Server Version: 5.5.1877.747.74 ready <23423423.34454545me.me.com>
 at ./N_mail_client line 15
POP3 -> APOP me@me.com erierj24353245ksdfj4534k4j5k45j
 at ./N_mail_client line 15
POP3 <- -ERR APOP not supported.
 at ./N_mail_client line 15
POP3 -> USER me@me.com
 at ./N_mail_client line 15
POP3 <- +OK Waiting for password
 at ./N_mail_client line 15
POP3 -> PASS clear_text
 at ./N_mail_client line 15
POP3 <- -ERR Permission denied
 at ./N_mail_client line 15
POP3 -> QUIT
 at ./N_mail_client line 27
POP3 <- +OK
 at ./N_mail_client line 27

 </debug msserver>

-- 
spam dinner: mailto: root@localhost
to reply axe: _!SPAM_

-mUs


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

Date: 16 Dec 2002 15:19:29 -0800
From: toxicfungi@yahoo.com (ToxicFungi)
Subject: Re: PErl and CSS
Message-Id: <a34dbdd.0212161519.4e4daf23@posting.google.com>

hi bart

tnx for the reply.

where in the script would i enter this piece of code? you provided me?

wwwboard.pl is the file. got it at scriptarchive.com (Matt's wwwboard)
(I know should use nms....but same principle applies)

ta!

Bart Lateur <bart.lateur@pandora.be> wrote in message news:<43vrvuco73meeln532u9erqgjojjb2ie04@4ax.com>...
> ToxicFungi wrote:
> 
> >How can I modify the perl script to format any html code it spits out
> >to use CSS?
> 
> Create a .css page on your website, and make perl include a 
> 
> 	<link rel="stylesheet" href="stylesheet.css" type="text/css">
> 
> tag in the HTML it spits out, somewhere in the head section.


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

Date: 16 Dec 2002 18:59:54 -0800
From: toxicfungi@yahoo.com (ToxicFungi)
Subject: Re: PErl and CSS
Message-Id: <a34dbdd.0212161859.75988a4f@posting.google.com>

Martien,

jip. i know about that message board. thats the one i am trying to
edit now. Where in that perl script do I add the CSS statement ? so
that when it cretes html, it impliments the css, so that it matches
the rest of my webpage.

tnx

Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnavsj5j.865.mgjv@verbruggen.comdyn.com.au>...
> On 16 Dec 2002 07:40:18 -0800,
> 	ToxicFungi <toxicfungi@yahoo.com> wrote:
> > Hi group,
> > 
> > I am trying to setup a message board for a website. This uses a perl
> > script. It is basically Matt's WWWBoard.
> 
> Have a look at http://nms-cgi.sourceforge.net/ for a much better
> alternative (Matt says so himself).
> 
> > How can I modify the perl script to format any html code it spits out
> > to use CSS?
> 
> Include the stylesheet somewhere at the top of the HTML.
> 
> What's your Perl question?
> 
> Martien


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

Date: Tue, 17 Dec 2002 04:32:50 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: PErl and CSS
Message-Id: <slrnavtab8.865.mgjv@verbruggen.comdyn.com.au>

[Please, in the future, put your reply _after_ the suitably trimmed
text you reply to. it is the convention on this newsgroup and Usenet
in general.]


On 16 Dec 2002 18:59:54 -0800,
	ToxicFungi <toxicfungi@yahoo.com> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnavsj5j.865.mgjv@verbruggen.comdyn.com.au>...
>> On 16 Dec 2002 07:40:18 -0800,
>> 	ToxicFungi <toxicfungi@yahoo.com> wrote:

>> > I am trying to setup a message board for a website. This uses a perl
>> > script. It is basically Matt's WWWBoard.

>> > How can I modify the perl script to format any html code it spits out
>> > to use CSS?
>> 
>> Include the stylesheet somewhere at the top of the HTML.
>> 
>> What's your Perl question?
> 
> jip. i know about that message board. thats the one i am trying to
> edit now. Where in that perl script do I add the CSS statement ? so
> that when it cretes html, it impliments the css, so that it matches
> the rest of my webpage.

You asked that question the first time around. It still is not a
question about Perl. It is a question about modifying some piece of
software. That is a task that should be done by programmers. if you
are a programmer, you should ask a more specific question. You should
at least be able to make a modification as trivial as this. if you are
not a programmer, then you should become one, or hire one.

Martien
-- 
                        | 
Martien Verbruggen      | Make it idiot proof and someone will make a
Trading Post Australia  | better idiot.
                        | 


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

Date: Tue, 17 Dec 2002 05:02:48 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: PErl and CSS
Message-Id: <ijbtvu482rbau6v4it8oal846uhs88h8lj@4ax.com>

ToxicFungi wrote:

[about wwwboard.pl from http://sourceforge.net/projects/nms-cgi/]

>thats the one i am trying to
>edit now. Where in that perl script do I add the CSS statement ?

OK I'll have a look... Aha. It has already been provided. There's a
variable called "$style". Just set it to an appropriate value. In a
virgin download, the value is '/css/nms.css', set on line 55.

-- 
	Bart.


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

Date: Tue, 17 Dec 2002 03:53:36 GMT
From: "William Hymen" <t18_pilot@hotmail.spam.com>
Subject: Perl preinstalled. bad @INC
Message-Id: <4dxL9.944$1a1.92119@newsread2.prod.itd.earthlink.net>

Our machines at work have ActiveState perl
preinstalled under c:\apps_pub\p0503\ <rest of the tree>

The @INC will not see the libraries.
How do I "manually" force perl to see the
perl modules I need. For example, I need
cwd.

Thanks in advance-

Bill




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

Date: Mon, 16 Dec 2002 19:42:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl variables Which part of Memory
Message-Id: <3DFE72E3.358DE5C8@earthlink.net>

Markmm wrote:
> 
> I know that temp variables are held on the stack, but are all other
> variables held on the heap or just certain ones?.

All variables are allocated from the C heap, regardless of whether
they're lexical or not.  Perl's garbage collection uses refcounting to
know when to free SVs.  Pointers to the SVs of lexicals are stored on
perl's stack (which is also allocated from the C heap), so that perl
will know when to decrease their refcounts.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: 16 Dec 2002 18:34:02 -0800
From: linux@wild98.com (wild98)
Subject: problems compiling 5.8.0 on UnixWare 7.1.1
Message-Id: <27bbf948.0212161834.69b0c869@posting.google.com>

Downloaded the latest 'stable.tar.gz' today and having a heck of a
time getting it to compile on my box. (Intel architecture)

I installed the skunkworks 'gcc' compiler, but I don't think that's
the issue.

After the configuration process is finished and I run 'make' I see a
lot of warnings about 'end of loop code not reached' and ultimately,
it cannot build the main perl library:

Perl_croak_nocontext     libperl.so.800
pthread_mutex_lock       libperl.so.800
pthread_getspecific      libperl.so.800
pthread_mutex_unlock     libperl.so.800
PL_malloc_mutex          libperl.so.800
PL_thr_key               libperl.so.800
UK:ld: ERROR: miniperl: fatal error: Symbol referencing errors. No
output written to miniperl
collect2: ld returned 1 exit status

P-III 500, 256MB of RAM, fresh install of UnixWare 7.1.0 with 7.1.1
patch installed; fresh install of Skunkworks 'gcc'.

Any assistance would be appreciated... spent all day trying different
things to get this to work.

-id


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

Date: Mon, 16 Dec 2002 22:00:00 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: problems compiling 5.8.0 on UnixWare 7.1.1
Message-Id: <3DFE9330.E8E6DCD8@earthlink.net>

wild98 wrote:
[snip]
> After the configuration process is finished and I run 'make' I see a
> lot of warnings about 'end of loop code not reached' and ultimately,
> it cannot build the main perl library:

If you have trouble building perl, send email to perlbug@perl.org.

Include as much information as you can.

Something like:

   $ make > make.out 2>&1

And attach the files to the email.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Mon, 16 Dec 2002 17:07:21 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: simple, simple regex Q
Message-Id: <slrnavsn59.g55.tadmc@magna.augustmail.com>

Dick Penny <penny1482@attbi.com> wrote:

> I thought I had conquered simple regexs. I guess I'm simple cause I can't
> figure out why the following snippet matches on data line 1.
> -------- regex
> /\d+\D*(\d+)/


Describe that pattern in English:

   digit chars with zero or more non-digits in between.


> ---------data line 1
>>>SPH nb 83


That has digit chars with zero non-digits in between, matches!

Beware of matching the empty string...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 16 Dec 2002 21:55:44 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: STDIN/stream/filehandle<?> question
Message-Id: <3DFE9230.39BE153B@earthlink.net>

Jonathan Dugan wrote:
> 
> This has been a problem for me in the past, and now I am writing
> something that really makes me want to solve it.
> 
> I want to have a perl script that accepts data from STDIN, but then
> also accepts non-blocking user-input characters at cetain times while
> it's ruunning.

To seperately read data from STDIN and commands from the user, you need
to open a seperate handle to the console that the user is typing on.

On unix, you open the special file "/dev/tty", on windows, you open the
psuedo file "con".

> I want to write script2 so that I can do
> 
> script1.pl  |  script2.pl  |  script3.pl
> or
> cat datafile |   script2.pl  |  script3.pl

Useless use of cat.  Consider:

   script2.pl < datafile | script3.pl

> and while running, have script2 present an interface to the user and
> the the user can input characters, have term::readline input, etc.,
> then the user selects "go" and have it save or spit out data, or
> whatever.
> 
> THE PROBLEM:
> I can't seem to get anything to read correctly from STDIN once I have
> the script reading from STDIN already.

That's 'cause STDIN isn't the console.

> I've tried 3 different ways:
> 
> 1 POSIX::getchar()

That only gets a char from stdin, and stdin is not the console.

> 2 TermReadKey (see
> http://search.cpan.org/author/JSTOWE/TermReadKey-2.21/ReadKey.pm)

I would think that this would be clever enough to realize that STDIN is
not the place to be reading from (by doing a -t test on it), and open a
console filehandle.

> 3 and this little snippet from the web that I've used before:
> 
> sub GetKey {
> 
>     system "stty", '-icanon';
>     system "stty", '-echo';
>     system "stty", 'eol', "\001";
>     my $inkey = getc(STDIN);

Too bad that STDIN is the data, not the user's console.

>     system "stty", 'echo';
>     system "stty", 'icanon';
>     system "stty", 'eol', '^@'; # ascii null

[PS: Your stty commands could be combined, if you want, into:

    my $restore = qx(stty -g);
    system qw(stty -icanon -echo eol), "\001";
    my $inkey = getc(CONSOLE);
    system qw(stty -g), $restore;
    
>     if ($inkey eq "[") {GetMsg();return;} #handles arrow key junk

Ahh, actually, arrow keys "\c[[A", "\c[[B", "\c[[C", "\c[[D";

You don't want to discard based on seeing "[", you want to discard based
on seeing "\c[".

    my $restore = qx(stty -g);
    system qw(stty -icanon -echo eol), "\001";
    my $inkey = getc(CONSOLE);
    while( $inkey eq "\c[" ) {
       1 until getc(CONSOLE) =~ /[a-zA-Z]/;
       $inkey = getc(CONSOLE);
    }
    system qw(stty -g), $restore;

>     return $inkey;
> 
> }
> 
> in all three cases, they work correctly within scripts that do not
> read from STDIN -- I can put characters into the script interactively
> and it works.

Right -- in these cases, STDIN *is* the same as the console.

[snip]
> I'm missing something fundamental about STDIN / streams, etc.  Not
> sure where to read more on this.

Stdin is only the console when it's not redirected from a pipe or from a
file.  And you can only do your stty type stuff when it's a console.

if( -t STDIN ) {
   *CONSOLE = *STDIN;
} else {
   open( CONSOLE, "<", "/dev/tty" ) or
   open( CONSOLE, "<", "con" ) or
      die "Don't know how to open a console";
}

PS: I would suggest you use IO::Stty from CPAN instead of the stty
program.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 17 Dec 2002 09:39:23 +0800
From: "ken" <rf_wu@163.com>
Subject: tk & ole?
Message-Id: <atlvcv$2v7j$1@mail.cn99.com>

how use perl/tk support word format(with image)
or use tk & ole?
thanks




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

Date: Mon, 16 Dec 2002 20:48:57 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: unix2dos newbie question
Message-Id: <3DFE8289.BE715897@earthlink.net>

Edward Quick wrote:
[snip]
>         while( ($len2 = &write( NS, $ftpbuf, $left )) > 0 ){

What is this &write subroutine?  Why aren't you using syswrite?

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: 16 Dec 2002 18:24:51 -0800
From: rnoory@videotron.ca (R.Noory)
Subject: word lenght
Message-Id: <8fec9af1.0212161824.23fd1e58@posting.google.com>

Hello 

This expression matches word with more than 6 letters 
$matching =~ s/\b(\w{6})\w*\b/$1/;

What is the expression that matches only 6 letters

What is the expression that matches less than 6 letters

Thanks for your help


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

Date: Mon, 16 Dec 2002 21:39:44 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: word lenght
Message-Id: <slrnavt740.gr8.tadmc@magna.augustmail.com>

R.Noory <rnoory@videotron.ca> wrote:
> 
> This expression matches word with more than 6 letters 
> $matching =~ s/\b(\w{6})\w*\b/$1/;

> What is the expression that matches only 6 letters


   /\b(\w{6})\b/


> What is the expression that matches less than 6 letters


   /\b(\w{1,5})\b/


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 4273
***************************************


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