[17690] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5110 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 14 11:05:48 2000

Date: Thu, 14 Dec 2000 08:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976809911-v9-i5110@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 14 Dec 2000     Volume: 9 Number: 5110

Today's topics:
        #include files? sort of (Stan Brown)
    Re: -KPIC, xdepend, x03 *SOLVED* <someone@somewhere.org>
    Re: -KPIC, xdepend, x03 <mark.drummond@canada.sun.com>
        a little off topic <schneider@xtewa.de>
        Array of arrays, stack & print layout eggrock@my-deja.com
    Re: Command line to sum up fields <jeffp@crusoe.net>
    Re: Does comp.lang.perl exist? Yes! (John Stanley)
    Re: Hopefully not to difficult a question. Please Help <jdhunter@nitace.bsd.uchicago.edu>
    Re: How to mysqldump from perl? (Rafael Garcia-Suarez)
    Re: How to mysqldump from perl? <joe+usenet@sunstarsys.com>
    Re: How to mysqldump from perl? (Richard Zilavec)
    Re: How to mysqldump from perl? (Abigail)
    Re: input to interactive programs (Evanda Remington)
    Re: My first JAPH.... <lmoran@wtsg.com>
    Re: My first JAPH.... (Richard Zilavec)
        Perl 5.60 and mod_perl for Apache 1.3.14 <jlbeaudet@pathe.fr.kodak.com>
    Re: Please help with this script! Weird problem <mtaylorlrim@my-deja.com>
    Re: Please help with this script! Weird problem <jeffp@crusoe.net>
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tom Christiansen)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <flavell@mail.cern.ch>
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Abigail)
        Regex can't be greedy with /(a|ab)/ ? <thisisnotanemailaddress@dtag.de>
    Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
    Re: secure cookie problem <ng@fnmail.com>
        strict, and filehandle scopeing question (Stan Brown)
    Re: TMTOWTDI - which way is better? <jeffp@crusoe.net>
        xml parser <fhoerni@intelcom.fr>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 14 Dec 2000 09:39:45 -0500
From: stanb@panix.com (Stan Brown)
Subject: #include files? sort of
Message-Id: <91am3h$3n5$1@panix6.panix.com>

	I have a small perl script that will eventually be one of a pair of
	co-operating tasks. I am planing on using on confiugration file for
	both tasks. Since the code for pareseing this file is common, I wnat to
	pull it out into a file to "#included" by both scripts. Hees what I
	have at the top of the existing script.


#!/opt/local//bin/perl -w

# "%W% %E% %U%";  /* SCCS what string */ 
#
# data_ftech.pl
#
# 12-13-2000 SDB Westvaco
#
# retrieves data from Oracle data base, and prepares
# it for ftp trnasfer to Oil Systems PI

use DBI;
use DBD::Oracle ;
use strict;
use AppConfig::File;
use File::lockf;
use IO::Handle;
use Getopt::Mixed "nextOption";

# variable set (Potentialy) from the config file
# These need to be declared here, even though they are set in a subroutine
my ( $my_pid_file, $my_tags_file, $my_ftp_lock_file, $my_max_ftp_wait );
my ( $my_csv_db_dir, $my_sleep_time_per_cycle, $my_lock_wait, $my_lock_tries);
my ( $my_log_file, $my_partner_task_has_lock, $my_max_data_wait);
my ( $my_max_tags_in_que, $my_max_data_wait_per_tag, $my_loglevel);
my ( $my_badinit);

# Config file name goes here
# May be modifed with -f <filename> at runtime
my $cfg_file = "/opt/local/lib/pi_collect.conf";

---- snip

sub parse_config_file() {
##################################################################
#
# parese config file and sets global variables optionaly set there
#
# Really does not need to be a subroutine, but this was starting to clutter
# up main(), as it's pretty large
#
###################################################################
# Ok, let's do the config thing
my $state   = AppConfig::State->new(
	{
		CASE	=> 1,
		PEDANTIC => 0,
		GLOBAL => {
				DEFAULT => '<undef>', 
				ARGCOUNT => 1,
				EXPAND_UID => 1,
				EXPAND_ENV => 1,
			  },
	}
);
$state->define("pid_file",
			{
				DEFAULT => "/opt/local/run/pi_collect.pid",
			});
$state->define("tags_file",
			{
				DEFAULT => "/opt/local/lib/pi_tags.conf",
			});
$state->define("log_file",
			{
				DEFAULT => "/dev/null",
			});
$state->define("ftp_task_lock_file",
			{
				DEFAULT => "/tmp/pi_collect.LCK",
			});
$state->define("max_tags_in_que",
			{
				DEFAULT => 1000,
			});
$state->define("max_ftp_delay",
			{
				DEFAULT => 60,
			});
$state->define("max_task_has_lock_delay",
			{
				DEFAULT => 60,
			});
$state->define("max_data_wait",
			{
				DEFAULT => 60,
			});
$state->define("max_data_wait_per_tag",
			{
				DEFAULT => 30,
			});
$state->define("sleep_seconds_per_cycle",
			{
				DEFAULT => 0.5,
			});
$state->define("lock_tries",
			{
				DEFAULT => 5,
			});
$state->define("lock_wait",
			{
				DEFAULT => 0.1,
			});
$state->define("loglevel",
			{
				DEFAULT => 3,
			});
$state->define("badinit",
			{
				DEFAULT => 0,
			});
$state->define("data_cache_dir",
			{
				DEFAULT => "/tmp",
			});
if ( ! -r $cfg_file)
{
	print("I can't read config file that you have specifed: $cfg_file\n");
	print("I have a set of hardcoded configuration defaults that I am using\n");
}
else
{
	my $cfgfile = AppConfig::File->new($state, $cfg_file);
}
$my_pid_file = $state->get("pid_file");
$my_tags_file = $state->get("tags_file");
$my_log_file = $state->get("log_file");
$my_ftp_lock_file = $state->get("ftp_task_lock_file");
$my_max_ftp_wait = $state->get("max_ftp_delay");
$my_partner_task_has_lock = $state->get("max_task_has_lock_delay");
$my_max_data_wait = $state->get("max_data_wait");
$my_max_data_wait_per_tag = $state->get("max_data_wait_per_tag");
$my_csv_db_dir = $state->get("data_cache_dir");
$my_sleep_time_per_cycle = $state->get("sleep_seconds_per_cycle");
$my_loglevel = $state->get("loglevel");
$my_lock_wait = $state->get("lock_wait");
$my_lock_tries = $state->get("lock_tries");
$my_max_tags_in_que = $state->get("max_tags_in_que");
$my_badinit = $state->get("badinit");
}

	What I want to do, is put this section it it's own file, and have the
	global varibales, and the subroutine be accessiable to booht scripts.

	I have read the section in the Camel book on modules, and packages
	(Chapter 5), but I'm a bit overwhelmed. 

	How can I acomplish this in a simple manner?



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

Date: Thu, 14 Dec 2000 09:36:27 -0500
From: Administrator <someone@somewhere.org>
Subject: Re: -KPIC, xdepend, x03 *SOLVED*
Message-Id: <3A38DAEB.F078E511@somewhere.org>

Found it. These were defined in the Config.pm file for perl
(/usr/perl5/5.00503/sun4-solaris/Config.pm on my Solaris 8 box).

- Mark


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

Date: Thu, 14 Dec 2000 09:02:36 -0500
From: Super-User <mark.drummond@canada.sun.com>
Subject: Re: -KPIC, xdepend, x03
Message-Id: <3A38D2FC.4CB67E44@canada.sun.com>

Super-User wrote:
> 
> Trying to build perldap, dbi and dbd-oracle under perl 5.005_03
> (installed with the OS), gcc 2.95.2 (installed from sunfreeware.com
> package), and solaris 8 10/00. `perl Makefile.PL` works fine (no
> errors), but the resulting Makefile has three compiler/linker options in
> it that gcc does not like:
> 
>         CCCDLFLAGS = -KPIC
>         OPTIMIZE = -xO3 -xdepend

More info: these must be coming from some source outside the module
source code. IOW, when I run `perl Makefile.PL`, that process is putting
in those options based on something outside the module source. A `find .
-type f -exec grep -i kpic {} \;` returns nothing.

- Mark


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

Date: Thu, 14 Dec 2000 14:58:40 GMT
From: SimBean <schneider@xtewa.de>
Subject: a little off topic
Message-Id: <91an6s$qg5$1@nnrp1.deja.com>

Hi Abigail,

I came across that japh of yours and I just cannot figure it out!



push @INC => sub {($\ = pop) =~ s/\..*/ /; print ""};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use
Hacker";



Could you explain what you are doing there, please. :)
I searched faq and doc but it didn't help me understand it ...

--
Ciao,
SimBean.


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 14 Dec 2000 15:33:54 GMT
From: eggrock@my-deja.com
Subject: Array of arrays, stack & print layout
Message-Id: <91ap92$sgr$1@nnrp1.deja.com>

Somewhat of a fun question, but kind of long.

I have an array in which values are shifted/unshifted from with never
more than 100 values on it. Call it @stack (global). I want to display
these
values in a 10x10 grid, with the first ($stack[0]) value displayed in
the upper-left corner, the next value below it (0x0y for 1st value, 0x1y
for second value) and so on until the 11th value which would be in 1x0y.
It would actually be a 11x11 grid since all 0y values are labels, same
with 0x values.

Here's what I did:

sub print_stack() {
   #set up grid so everything has a value
   my @print_stack = (
      [' ', '==00==', '==10==', '==20==', '==30==', '==40==', '==50==',
'==60==', '==70==', '==80==', '==90==', ],
      ['==01==', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ],
 .snipped. ==02== to ==09==
      ['==10==', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ],
   );

   my $count = 0;
   foreach (@stack) {
      #get x,y pos. and add 1 to each
      my $y = $count % 10 + 1;
      my $x = int($count / 10) + 1;
      $print_stack[$y][$x] = $_;
      $count++;
   }

   for($y = 0; $y <= 10; $y++) {
      for($x = 0; $x <= 10; $x++) {
         printf "%6s ", $print_stack[$y][$x];
      }
      print "\n";
   }
}#print_stack()

Is there a better (faster) way? It seems to be fairly quick as it is.


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 14 Dec 2000 09:10:19 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Command line to sum up fields
Message-Id: <Pine.GSO.4.21.0012140906030.4213-100000@crusoe.crusoe.net>

[posted & mailed]

On Dec 14, John Lin said:

> 45  19  23
> 32  33  54
> 34  21  15
> 45  72  26
>-----------
>156 145 118
>
>    perl -ape 'for $i (0..$#F) { $sum[$i]+=$F[$i] }
>        END { print "-----------\n@sum\n" }' input.txt
>
>He didn't seem to be satisfied.
>Because I used to show him some Perl magic like
>
>    @sorted = @original[@indexes];
>
>I think he expected to get something more terse.

He has to understand that David Copperfield doesn't use the same type of
magic to make a space shuttle disappear as he does to make two rubber
bands pass through each other.

The most I can think of doing:

>    perl -ape 'for $i (0..$#F) { $sum[$i]+=$F[$i] }
>        END { print "-----------\n@sum\n" }' input.txt

  perl -ape '$sum[$_]+=$F[$_] for 0..$#F; END { ... }' file

which is just what you did.  Let your boss know that David Copperfield
probably doesn't levitate his toothbrush to his hand every morning, and
probably does some things on his own, human-like.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: 14 Dec 2000 14:45:34 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Does comp.lang.perl exist? Yes!
Message-Id: <91amee$a7b$1@news.NERO.NET>

In article <m18zpjwqeu.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "BUCK" == BUCK NAKED1 <dennis100@webtv.net> writes:
>BUCK> Randall was wrong. Yes, comp.lang.perl does exist. Here's proof of its
>BUCK> existence.
>
>It *authoritatively* does not exist, by decree from the group of
>people who have managed Usenet since its beginning in 1979.  That does
>not keep people from posting articles that have *NON-EXISTING*
>newsgroups in their headers.

Nor does it keep admins, who are the ultimate arbiter of what groups
exist, from creating it or failing to remove it after it has been
created. The only decree these inspecified managers have are the rmgroup
and newgroup messages, and those can be ignored by any admin who wants
to.

There are other groups that do not exist according to the "managers",
but they still do. They're called 'inet' groups.

>It does not exist.  

Perhaps not on your server. On other servers it may. And that statement
does not make any value judgements about those servers, just states the
fact. 



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

Date: 14 Dec 2000 08:43:03 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Hopefully not to difficult a question. Please Help
Message-Id: <1rpuivcbd4.fsf@video.bsd.uchicago.edu>

>>>>> "msalerno" == msalerno  <msalerno@my-deja.com> writes:

    >> 
    msalerno> There was absolutely nothing wrong with the proposed
    msalerno> solution, but, I want to get as much information as
    msalerno> possible before I consider the script complete.  There
    msalerno> are many ways to accomplish the same task with perl, and
    msalerno> I like to get as many opinions as I can.  The
    msalerno> information supplied by Chris Fedde was perfect, but the
    msalerno> reason that we all post here is so that we can collect
    msalerno> as much information as possible, and that is all that I
    msalerno> am doing.  And since I just got 4+ posts letting me know
    msalerno> that I cannot modify a field in the passwd file without
    msalerno> rewriting the entire file, I can focus on that.

Here's another solution.  If assumes colon separated fields in
/etc/passwd and a shell cp in your path.  The script writes to STDOUT.
Uncomment line to write to /etc/passwd after testing.

There is a hash of pairs from usernames to encrypted passwords which
stores the values that need updating.

Good luck,
John Hunter

#!/usr/local/bin/perl -w

use strict;
use Shell('cp');

#username passwd pairs
my %updates = ('jdhunter' => 'passwd1',
	       'miriam' => 'passwd2');

#make this whatever you want
my $backupFile = 'passwd.bak';
cp('/etc/passwd', $backupFile);  #make a backup
open(PASSWD, "<$backupFile") || die "can't open /etc/passwd\n";

#uncomment after sufficient testing convinces you the script is ok
#open(OUTFILE, ">/etc/passwd") || die "Can't write /etc/passwd\n";
open(OUTFILE, ">-") || die "Can't write to STDOUT\n";

while (<PASSWD>) {
  my @fields = split /:/;
  $fields[1] =  $updates{$fields[0]} || $fields[1];
  print OUTFILE join ':', @fields;
}


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

Date: Thu, 14 Dec 2000 14:20:32 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How to mysqldump from perl?
Message-Id: <slrn93hlpr.18e.rgarciasuarez@rafael.kazibao.net>

ogg wrote in comp.lang.perl.misc:
> How do I get my perl script to do a mysqldump of my entire database?
> I can do it from the command line eg
> mysqldump dbase -u name -p >dbase.csv

I believe that MySQL supports a SELECT ... INTO OUTFILE 'filename'
statement (see the MySQL docs). So, if you execute this statement from
the standard DBI interface, you should obtain the desired result.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 14 Dec 2000 10:47:37 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to mysqldump from perl?
Message-Id: <m3hf47uhra.fsf@mumonkan.sunstarsys.com>

"ogg" <ogg@shrunk.com> writes:

> How do I get my perl script to do a mysqldump of my entire database?
> I can do it from the command line

#!/usr/bin/perl -wT

$ENV{PATH}='/path/to/mysqldump';
$ENV{ENV}='/dev/null';

my $name= 'horse';
my $passwd = 'hooves';
my $dbase = 'dbase';
my $outfile = 'dbase.csv'; # csv or sql ?

print `mysqldump dbase -u$name -p$passwd >$outfile`;

__END__

(Instead of backticks, it might be better to use open, 
 system, or any other nice tools Perl provides for ipc.)

% perldoc perlipc

HTH.
-- 
Joe Schaefer



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

Date: Thu, 14 Dec 2000 15:54:18 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: How to mysqldump from perl?
Message-Id: <3a39ec91.164558392@news.tcn.net>

On Thu, 14 Dec 2000 14:20:32 GMT, rgarciasuarez@free.fr (Rafael
Garcia-Suarez) wrote:

>> How do I get my perl script to do a mysqldump of my entire database?
>> I can do it from the command line eg
>> mysqldump dbase -u name -p >dbase.csv

I wrote a script that contains something like this, which is executed
by a nightly cronjob.

`$somepath/bin/mysqldump dbname -uname -pword > $some.csv`;

Seems to do the trick...

--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: 14 Dec 2000 16:00:41 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How to mysqldump from perl?
Message-Id: <slrn93hrl9.elk.abigail@tsathoggua.rlyeh.net>

On Thu, 14 Dec 2000 14:20:32 GMT, Rafael Garcia-Suarez (rgarciasuarez@free.fr) wrote in comp.lang.perl.misc <URL: news:<slrn93hlpr.18e.rgarciasuarez@rafael.kazibao.net>>:
++ ogg wrote in comp.lang.perl.misc:
++ > How do I get my perl script to do a mysqldump of my entire database?
++ > I can do it from the command line eg
++ > mysqldump dbase -u name -p >dbase.csv
++ 
++ I believe that MySQL supports a SELECT ... INTO OUTFILE 'filename'
++ statement (see the MySQL docs). So, if you execute this statement from
++ the standard DBI interface, you should obtain the desired result.


That of course doesn't dump a database. It would dump the result of a
select statement into a file, in a format not very suitable for restores.


Abigail


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

Date: 14 Dec 2000 15:28:57 GMT
From: evanda@ater.org (Evanda Remington)
Subject: Re: input to interactive programs
Message-Id: <slrn93hppo.56k.evanda@mist.ater.org>

Perhaps the expect module would work, i need something pretty standard
(about as standard as perl, since it's hard enough getting people to
install it on some of these machines we maintain.  Can it be done with
pipes?  Where's a good example of how pipes are used?

-e

Bob Walton said:
>Evanda Remington wrote:
>> 
>> How would i go about sending input to interactive programs?
>> Is there a handy "waitfor" type deal?  What i'm aiming at is having
>> something call passwd and give it the required info.

>Maybe what you want is the Expect module?
>-- 
>Bob Walton


-- 

Evanda Remington
evanda@ater.org
http://www.ater.org


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

Date: Thu, 14 Dec 2000 09:19:53 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: My first JAPH....
Message-Id: <qllh3tchpss091spri07s6ltqdkmav0l6i@4ax.com>

On 13 Dec 2000 18:49:54 GMT, atspragg@garbanzo.engr.ucdavis.edu (Adam
Spragg) wrote wonderful things about sparkplugs:

It is very nice, but shouldn't it read:
Just Another Perl Hacker
instead of:
Just another Perl hacker
?

And no I have no idea how to make it do that. <sheepish grin>


>Necessity might be the mother of invention, but boredom is certainly the 
>father...
>
>@_=(join"","0",eval join("*",17,435983),eval join("*",ord" ",ord"H",5,4441),
>eval join("*",(ord"d")+(ord"/"),461,1433),eval(join"*",7,ord"/",3529),"0",eval
>(join"*",ord"0",23209),0,eval(join"*",3,17,157061),eval(join"*",179,229499),
>"0409".7099,eval(join'*',2,5689,9413))=~m%.{0,3}%g;for(@_){print chr;}print"\n";
>
>Is that good?
>
>Adam


lmoran@wtsgSPAM.com
print "\x{263a}"


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

Date: Thu, 14 Dec 2000 15:46:34 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: My first JAPH....
Message-Id: <3a38eb18.164181310@news.tcn.net>

>It is very nice, but shouldn't it read:
>Just Another Perl Hacker
>instead of:
>Just another Perl hacker

My understanding is that Just another Perl hacker is correct, the
comma is optional, but only the first and third word start with
capital letters.

--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Thu, 14 Dec 2000 15:02:40 +0000
From: Jean-Luc BEAUDET <jlbeaudet@pathe.fr.kodak.com>
Subject: Perl 5.60 and mod_perl for Apache 1.3.14
Message-Id: <3A38E110.7F1A2577@pathe.fr.kodak.com>

Hi

I'm newbie on SOLARIS OSes and i do  have to install
Perl and mod_Perl on a SUN UltraSPARC 5 station.

1) I don't really know which Release i use:
bash-2.03# uname -X
System = SunOS
Node = petrus
Release = 5.7
KernelID = Generic_106541-11
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 1

2) I'd like to install Perl 5.6.0 so that i can compile a mod_perl
and make it work with Apache 1.3.14 ( installed and runni' OK ! )

3) Where can i obtain either a Configure script accorded to my
SOLARIS Rel or
a Perl 5.6.0 pre_compiled so that all i have to do is make make test
make install...

Any help welcome !!!

Thanks all

JLB ;O(






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

Date: Thu, 14 Dec 2000 13:58:45 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: Please help with this script! Weird problem
Message-Id: <91ajmi$nao$1@nnrp1.deja.com>


> <snip>
>
> I tried this once and came to the conclusion that the
>
> print <<END
> stuff...
> END
>
> structure only works for plain text, i.e. variables muck it up. I
didn't
> find any documentation to support this theory but any size of text
WITHOUT
> variables in it worked fine, but even a single line WITH a variable
didn't.
>
> HTH
> Andy
>
>
No, I use variables in mine all the time without problems. Look
elsewhere for a problem.

Mark

--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 14 Dec 2000 09:15:07 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Please help with this script! Weird problem
Message-Id: <Pine.GSO.4.21.0012140913190.4213-100000@crusoe.crusoe.net>

[posted & mailed]

On Dec 14, Mike Lin said:

>print "Content-type: text/html\n\n";
>print "<html><title>My page</title>";
>
>Actually though I did this...(so I wouldn't have to keep typing "print")
>
>print<<"END"
>Content-type: text/html\n\n
><html><title>My page</title>
>END

You've forgotten to print a header when you need it in your actual output.

>print<<"END";
><HTML><HEAD><TITLE>Error</TITLE>

That should be

  print << "END";
  Content-type: text/html

  <HTML><HEAD>....

Then, it should work for you.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: 14 Dec 2000 07:08:37 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <3a38d465@cs.colorado.edu>

In article <123h3ts3uf0gn2sp02g28b2sb45sdokjmt@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>Tom Christiansen wrote:
>
>>>It will not be posted in POD. It will be posted in plain text.
>>
>>Perhaps, but you should not _f_o_r_b_i_d people from posting in pod. 
>
>Now here's an example of something that should be considered "verboten".

Get a real newsreader.

--tom


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

Date: 14 Dec 2000 14:25:50 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91al9e$9tm$1@news.NERO.NET>

In article <slrn93gd1r.18n.tadmc@maxim.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>>I'm asking why you think that they will follow your
>>suggestions when they don't follow any others. 
>
>I do not think that they will follow my suggestions.
>
>I only hope that they follow my suggestions.

Sigh. Fine. Why do you "hope" they will follow them when they do not
follow any of the other suggestions? The question isn't that hard. 

>>Then why are you spending the time doing this? 
>
>I don't have anything better to do.

Anything better than clutter the group with off-topic discussion of how
you want everyone else to post on-topic?

>I'm just sitting around in the hotel room.

I'm glad you have time to spend asking others to read your articles.

>>If it has no effect, then
>
>I did not say that it has no effect.

You do not think it will have any effect. Assuming you are correct, then
it will have no effect. That's the reason for "if" at the start of my
sentence. I'm giving you the benefit of the doubt and assuming you are
right.

>I'll settle for an insignificant effect (because that is
>all I can reasonably expect).

It is insignificant, then it is more clutter than it removes. It's two
steps back for one step forward. We lose. Please stop.

>>it is adding to the clutter. 
>>Is that your goal?
>
>No.

Fine. Then do the right thing.



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

Date: 14 Dec 2000 14:27:29 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91alch$9tp$1@news.NERO.NET>

In article <qm3h3tsh3rnkrerq3qgk6ltd0219q162bp@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>John Stanley wrote:
>>I'm asking why you think that they will follow your
>>suggestions when they don't follow any others. 
>
>But now these will be published guidelines. People ignoring these
>guidelines deserve all the flames they get.

What a hoot. Anyone can write a FAQ. Being "published" on USENET doesn't
give any patina of respectability, nor is it an excuse for you to flame
more people for doing things you don't like.



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

Date: 14 Dec 2000 14:29:33 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91algd$9u2$1@news.NERO.NET>

In article <4j3h3toa17j89nn36cqgvfd2cd6trvm3e5@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>John Stanley wrote:
>>>   Do we want a "flag" in the Subject for filtering purposes?
>>
>>Yes. As opposed to Abigail, I want to see neither the FAQ nor any
>>responses to it, as all such articles will be off-topic.
>
>Doesn't your newsreader allow you to ignore threads containing articles
>of certain authors?

That is why I asked that these articles contain a constant From:
header as well. But this isn't an issue of my newsreader. It has nothing
to do with my newsreader, in fact. I've already said why I asked for
this.



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

Date: 14 Dec 2000 14:37:14 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91aluq$a2n$1@news.NERO.NET>

In article <slrn93gd7d.18n.tadmc@maxim.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>>comp.lang.pod.misc, then it will be correct to post pod. If you object
>>to HTML and claim it should be prohibited, then you've tarred pod with
>>the same brush. Both are markup languages.
>
>But one of them is Perl and one of them isn't.

Neither of them is perl. Pod is a markup language created by the same
people, which is one way of writing documentation for perl things, but
HTML can be used to document it, too. Pod is intended to be run through
a converter before it is read by humans, and USENET isn't.

>I suppose HTML posts in a WWW newsgroup would be fine, 

Not really. HTML in posts would be ok, but HTML posts aren't.

>but this is not such a newsgroup.

Nor is this a pod newsgroup. If you want one, it can be created.



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

Date: 14 Dec 2000 14:39:36 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91am38$a2r$1@news.NERO.NET>

In article <67rg3t4sjfavvgmtjnv0afubd3o14l9e1j@4ax.com>,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
>> What is the ' for? 
>
>My guess: (Internet => 'net) + etiquette.

That would be silly. This isn't the Internet, it's USENET.



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

Date: Thu, 14 Dec 2000 15:14:23 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <Pine.LNX.4.30.0012141512181.26202-100000@lxplus002.cern.ch>

On Wed, 13 Dec 2000, Tad McClellan wrote:

> I suppose HTML posts in a WWW newsgroup would be fine,

Try it, you'll soon find out....    :-(

Posts containing examples of HTML are fine.  Posts formatted in HTML
are not.  Posts that do both are a &amp;lt;strong&amp;gt;bloody
nightmare&amp;lt;/strong&amp;gt;




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

Date: 14 Dec 2000 15:12:00 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <slrn93hoq0.elk.abigail@tsathoggua.rlyeh.net>

On Wed, 13 Dec 2000 20:48:13 -0600, Tad McClellan (tadmc@metronet.com) wrote in comp.lang.perl.misc <URL: news:<slrn93gd7d.18n.tadmc@maxim.metronet.com>>:
++ John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
++ >In article <3a381054@cs.colorado.edu>,
++ >Tom Christiansen <tchrist@perl.com> wrote:
++ 
++ >>You might as well forbid posting of perl.

Postings *of* perl are not postings *in* perl.

++ >This is a perl newsgroup. When the group changes name to
++ >comp.lang.pod.misc, then it will be correct to post pod. If you object
++ >to HTML and claim it should be prohibited, then you've tarred pod with
++ >the same brush. Both are markup languages.
++ 
++ 
++ But one of them is Perl and one of them isn't.

People don't post articles as a running Perl program either; that is,
one has to interpret the program to get to the meaning of the post.
Articles may contain snippets of Perl code - but the article itself
is plain text.

++ I suppose HTML posts in a WWW newsgroup would be fine, but
++ this is not such a newsgroup.

Actually, they aren't. At least not in the first 4 or 5 years of its
existance, considering the S/N ratio has dropped to below 0.01% there,
I wouldn't be surprised if it's allowed now.

People don't post in jpeg format in a jpg group either.

This medium is Usenet. Its format is plain text, regardless of the topic.


Abigail


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

Date: Thu, 14 Dec 2000 16:14:10 +0100
From: Patrick Stein <thisisnotanemailaddress@dtag.de>
Subject: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <91ao42$vag$00$1@news.t-online.com>


I searched the FAQ, but couldn't find anything so someone here might know:

Is there a way to get | in regexes greedy ( matching the most possible 
characters )

$string =~ /(a|ab)/;

How can I match 'ab' without first sorting ? This regex will never match 'ab' 
and that's where the perl interpreter should complain.
Sorting might help, but I think that perl might have a better way of finding 
'ab' ( especially if the strings you are looking for are coming from arrays ) 
and the perl interpreter builds the matching trie or tree anyways.

Thanx in advance - Patrick



--
                                                  stay cool - jolly
===================================================================
Patrick Stein or Jolly                               at jinx dot de
===================================================================
           "I've seen things you people wouldn't believe.
           Attack ships on fire off the shoulder of Orion.
   I watched C-beams glitter in the dark near the Tannhauser gate.
     All those moments will be lost in time, like tears in rain.
                            Time to die."                 - r.batty
===================================================================



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

Date: Thu, 14 Dec 2000 15:36:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x7puivhv5p.fsf@home.sysarch.com>

>>>>> "PS" == Patrick Stein <thisisnotanemailaddress@dtag.de> writes:

  PS> Is there a way to get | in regexes greedy ( matching the most possible 
  PS> characters )

  PS> $string =~ /(a|ab)/;

change the order to (ab|a). alternation works left to right and always
returns the first legal match.

read the book 'mastering regular expressions' for much more on how to
make them do your bidding.

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, 14 Dec 2000 09:59:29 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: Re: secure cookie problem
Message-Id: <91aqp6$ct3$1@info1.fnal.gov>

oh
well, actually I wont be scripting across protocols.
non of my cookies are designed to last more than one session.

I cant seem to get my cookie to work at all inder the secure connection
I use
onClick="document.cookie='top_button=2; secure'"
do I need to get it a special way?
--
Enrico Ng <ng@fnmail.com>
"Fred Serry" <fred.serry@wolmail.nl> wrote in message
news:3a388ba3$0$175$4d4ebb8e@newnews.nl.uu.net...
> Enrico Ng <ng@fnmail.com> schreef in berichtnieuws
919qun$q2i$1@info1.fnal.gov...
> > I have a webpage where  I can click on a button that will set a cookie,
then
> > reload the page.
> > the page will then change the page based on the value of the cookie.
> >
> > The problem is that my server has special security, where user in the
domain
> > can use it regularly, but people outside the domain need to access the
> > script via secure connection.
> >
> > how should I store the cookie so it doesnt matter if the script is run
from
> > a secure connection or a nonsecure connection?
> >
> > on the non secure connection it works fine
> > on the secure connection
> > when I look at document.cookie, the cookie is listed there.
> > but the script to get the cookie doesnt find it.
> > --
> > Enrico Ng <ng@fnmail.com>
> >
> >
> >
> >
>
> Hi,
>
> Due to security measures you cant script across protocols. This means that
> a cookie, set by a page loaded on https can't be read by a script in a
non-
> secure page.
>
> http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp
>
> Fred
>
>




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

Date: 14 Dec 2000 09:06:47 -0500
From: stanb@panix.com (Stan Brown)
Subject: strict, and filehandle scopeing question
Message-Id: <91ak5n$3rl$1@panix2.panix.com>

	I must be doing something wrong here. 

	I have something like the dollowing:


#!/opt/local//bin/perl -w

# "%W% %E% %U%";  /* SCCS what string */ 
#
# data_ftech.pl
#
# 12-13-2000 SDB Westvaco
#
# retrieves data from Oracle data base, and prepares
# it for ftp trnasfer to Oil Systems PI

use DBI;
use DBD::Oracle ;
use strict;
use AppConfig::File;
use File::lockf;
use IO::Handle;

sub clean_house() {
##################################################################
#
# Dose end of program file closing and gnereal cleanup
#
# Really does not need to be a subroutine, but this was starting to clutter
# up main(), as it's pretty large
#
###################################################################
# Destroy the statement handles, and close the databases
my $key;

	foreach $key (sort keys(%record))
	{
		$sth = $record{$key}{STH};
		$sth->finish();
	}
	$dbh->disconnect;
	$stho->finish();
	$sthc->finish();
	$sths->finish();
	$sthd->finish();
	$sthd->finish();
	$sthq->finish();
	$sthb->finish();
	close FH;
	unlink $my_ftp_lock_file;
	logit(1, "Exiting");
	close LOGFILE;
}


# main()
my $tag_count;
my $my_pid;
my $lock;
my $is_new_lock;

---- snip

# Open a file to obatain a lock
# This lock will be used to synchronize our interactions
# with the ftp task
# I might could have depended on the inherent locking of the
# DBI:CSV stufff, but I did not trust it, and could
# not come up with a convincing test plan.
# This I have tested, and know works
open FH, "> $my_ftp_lock_file";
$lock = new File::lockf(\*FH);

# Dynamic runtime init.
$now = time();
$last_lock_time = $now;
$last_ftp_time = $now;
$last_data_rcd = $now;

# Main Loop
while (1) # Forever
{

------ section I want to be a subroutine

	$records_in_cache  = $sths->execute or die $DBI::errstr;
	if($records_in_cache ne "0E0")
	{
		$status = $lock->slock($my_lock_tries, $my_lock_wait, 0);
		if($status == 0)
		{
		my $found = 0;
		my $count = 0;
			# Select * from cache_data into pi_data
			@cache_results = $sths->execute or die $DBI::errstr;
			while ( @cache_results = $sths->fetchrow_array ) {
			( $stho->execute ( @cache_results ) )
				or  die   ;
				$count++;
				if ($Debug >= 3)
				{
					print "@cache_results Writen from cache DB\n";
				}
			}
			File::lockf::ulock FH;
			if ($Debug >= 1)
			{
				print "$count records Writen from cache DB\n";
			}
			# Delete all records in cache DB
			( $sthd->execute )
			  	or  die   ;
			if ($Debug >= 1)
			{
				print "delete * from cache table\n";
			}
		}
	}

}

	And when I pull the section of code out, that I have marke, and put it
	in a subroutine, that is at the top of the file, where the example
	subroutine that I have left in is, I gaet a complaint a barewords not
	being allowed using "strict" for FH

	Clearly I am missing something about filehandle scopeing.

	How should I do this?




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

Date: Thu, 14 Dec 2000 09:12:26 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: TMTOWTDI - which way is better?
Message-Id: <Pine.GSO.4.21.0012140910310.4213-100000@crusoe.crusoe.net>

[posted & mailed]

On Dec 14, Philip Lees said:

>On Wed, 13 Dec 2000 09:25:25 -0500, Jeff Pinyan <jeffp@crusoe.net>
>wrote:
>>  my $found;
>>  for (@old_html) {
>>    # /o modifier because $link_fields[0] doesn't change, right?
>>    $found ||= s/pattern/$include_string/io;
>>    print FH $include_string, "\n" if m!^</body>$!i and not $found;
>>    print FH;
>>  }
>
>Is there any advantage/disadvantage to checking the $done/$found
>variable at the start of the line with unless, as I did, rather than
>putting it after the pattern match, as you do?

Actually, on rethinking, you should probably put the most simplistic
operands at the beginning of the test, so that if they're false, Perl
didn't figure out the others were true, only to figure out that a BOOLEAN
value is false.

  if ($on and process_that_takes_a_minute_to_return()) { ... }

is obviously a far better approach than if they were swapped.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: Thu, 14 Dec 2000 14:46:31 +0100
From: "Frédéric Hoerni" <fhoerni@intelcom.fr>
Subject: xml parser
Message-Id: <91aipv$sq5$1@news.jetonline.fr>

hello
i am looking for an XML parser to read from an XML file and get some values
from some objects.

I tried the XML::Parser module that does not read the values of the items in
the file
I tried the XML::XPath that cannot read 'name' in the following : <item
name='xyz'/>
(XML::XPath can read only this : <item><name>xyz</name></item>)

thanks

--
Frederic Hoerni
fhoerni@intelcom.fr




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

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 5110
**************************************


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