[18050] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 210 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 4 18:05:34 2001

Date: Sun, 4 Feb 2001 15:05:10 -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: <981327910-v10-i210@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 4 Feb 2001     Volume: 10 Number: 210

Today's topics:
        "Average of List of Numbers" by Abigail <brannon@lnc.usc.edu>
        A Meta-Hack for your enjoyment (Clinton A. Pierce)
    Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Abigail)
        book <mchagal@total.net>
    Re: book <jschauma@netmeister.org>
    Re: book <georg_a_k@gnuage.com>
    Re: book <georg_a_k@gnuage.com>
    Re: deleting some folders... <c.gersch@team.isneurope.com>
        Embeding Perl in C, morality, freeing SVs (Christian =?iso-8859-1?Q?Reitwie=DFner?=)
        Help with simple Unix command script to delete some tem <aida@globalnet.co.uk>
    Re: Help with simple Unix command script to delete some <jdf@pobox.com>
        Help! How to print range of array lines? robert_hughes@my-deja.com
    Re: Help! How to print range of array lines? <joe+usenet@sunstarsys.com>
    Re: Is it possible for perl to open Dos programs? dtbaker_dejanews@my-deja.com
    Re: JAPH <wuerz@yahoo.com>
    Re: JAPH (Rudolf Polzer)
        Keyword Search <rworth5@home.com>
    Re: Keyword Search (Rob - Rock13.com)
    Re: Keyword Search <tony_curtis32@yahoo.com>
    Re: LWP on win32 dtbaker_dejanews@my-deja.com
    Re: Modules/Constants. delanthear@my-deja.com
    Re: newbie <jkitchin@udel.edu>
        newbie: simple question on FTPing (Boris Golub)
        Out of memory ... nospam_nomail@usa.net
    Re: suidperl problem (David Efflandt)
        swatch.pl - watch your website's traffic in real-time <james_thornton@my-deja.com>
        Text::Template Problem (OTR Comm)
    Re: Text::Template Problem <bart.lateur@skynet.be>
        too many errors for dos screen <georgkgeorgk@my-deja.com>
    Re: too many errors for dos screen (Clinton A. Pierce)
    Re: too many errors for dos screen <georg_a_k@gnuage.com>
    Re: too many errors for dos screen (Rudolf Polzer)
    Re: too many errors for dos screen <georg_a_k@gnuage.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 04 Feb 2001 22:52:03 GMT
From: Terrence Brannon <brannon@lnc.usc.edu>
Subject: "Average of List of Numbers" by Abigail
Message-Id: <lbk876t626.fsf@lnc.usc.edu>


The Museum of Modern Programming is proud to present its first work:

"Average of List of Numbers" by Abigail.

The Museum of Modern Programming: http://www.momp.org

-- 
Terrence Brannon 
Carter's Compass:
 I know I'm on the right track when by deleting code I'm adding functionality.


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

Date: Sun, 04 Feb 2001 16:30:43 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: A Meta-Hack for your enjoyment
Message-Id: <Tsff6.279423$hD4.67521277@news1.rdc1.mi.home.com>

To annoy the critics, this is the program that I used to generate
the JAPH-like thing in the "Apologies to Joyce Kilmer" thread last
week.  Actually, I used all of the components of this in about three
different programs.  This is just tidied up a bit.

The resulting picture requires 5.6.  Bite me if you don't like that.


#!/usr/bin/perl -w

# ASCII Art Encoder   Clinton A. Pierce
#   Freely redistributable under the same terms as Perl
#
# Takes an ASCII art picture and some parameters and emits a JAPH-like
# thing on STDOUT.  Messages to STDERR.
# ** PAY ATTENTION TO THE MESSAGES ON STDERR **
# You have to adjust the picture or your encoded message so they're the
#   right size for each other!  This is a three-way balancing act between
#   the length of your message, the compression and the available slots
#   in the picture.

use strict;
require 5.6;  # We accept summer whenever it arrives

# The trick is to find a picture where the encoded message will look like
#   background noise or a commonly-repeated set of things.  Leaves and bubbles
#   are good.  This world will do just fine for a sample.
my $picture='
               ,,ggddY"""Ybbgg,,
          ,agd6EEb,_ "YE, ___`""Ybga,
       ,gdP""EEEEEEEEbaa,.""Eb    "EEbg,
     ,dP"     ]EEEEEEEEEP`  "Y     `EEEYb,
   ,dP"      ,EEEEECEEP"  db,       "FP""Yb,
  ,P"       ,EEEEEEEEEb, dEEEEa           "E,
 ,P`        dEEEEEEEEEEE,EEP"` a,          `E,
,E`         EEEEEEEEEEEEEEPP"  ""           `E,
d`          IEEEEEEEEEEEP"                   `b
E           `E"EEP""YEP`                      E
E            Y E[  _ "                        E,
E              "YEdEb  "Y a                   E,
E                 `""Ed,   __                 E
Y,                    `"EbdEEEb,             ,P
`b,                     ,dEEEEEEEbaaa       ,d`
 `E,                    EEEEEEEEEEEE`      ,d`
  `Ea                   "EEEECEEEEEI      aE`
   `Yba                  `YEEEEEECP`    adP`
     "Yba                 `EEEEEEP`   adY"
       `"Yba,             dEEEEP" ,adP"`        
          `"YEbaa,      ,dEEEP,adEP"`
               ``""YYbaEEEEP""``    
';  # Anonymous ASCII art, author unknown

# The message you want to hide in the picture
#    Remember, the longer the message the bigger the picture will need to be.
my $string_to_encode="Clinton A. Pierce, Artistic Lic.";

# Charset is the characters which will be used to hide the picture
#    they should be in $picture, but will be swapped out for $schar
#    below.  So put $schar's in the picture and they'll get changed
#    out with $charset.  The larger the $charset, the better the 
#    compression
my $charset=[ qw| 9 @ B | ];

# $c1 and $c2 are actually part of $charset, except that they'll be 
#    alarmingly common in your picture.  Plan accordingly.
my $c1="0";
my $c2="O";

# Character which will be used to hold the codes.  Will not
# appear in the final picture.  If you do it right.
my $schar="E";

# Given a string, find and group the longest substrings 
#   contained within it.  This is the start of a 
#   a simple compression function.  NOTE: is is SLOW for large strings.
sub longest {
	my($t)=@_;
	my($long, %repeats)=("");
	$t=~s/\n//g;  # Be anal here.
	while($t=~m/(\d\d*).*(\1)/omg) {
		$repeats{$1}=1;
		$long=$1 if ((length $1) > (length $long));
		# Reposition the start of the search to the character after
		# the first character of the first match of the pair.
		pos $t=$+[1];
	}
	foreach(keys %repeats) {
		my $r=0;
		while($t=~/$_/g) {
			$r++;
		}
		$repeats{$_}=$r;
	}
	foreach(keys %repeats) {
		delete $repeats{$_} if (length $_ < 3);
		delete $repeats{$_} if (length $_ > 20);
		delete $repeats{$_} if ($_ =~/^0/);
	}
	# Sometimes one or the other gives better compression.  It depends.
	my(@a,@b);
	@a=sort {length $b<=>length $a } keys %repeats;
	@b=sort { $repeats{$b}<=>$repeats{$a} } keys %repeats;
	return(\@a, \@b);
}

# Encode the message, decide which compression is best.
#
sub encode {
	my($string, $charlist, $zero, $one)=@_;
	my($r1, $r2);

	my $binary=unpack("B*", $string);
	($r1->{list},$r2->{list})=longest($binary);
	$r1->{string}=$binary;
	$r2->{string}=$binary;

	for my $attempt ($r1, $r2) {
		for my $enc ( @$charlist ) {
			my $s=shift @{$attempt->{list}};
			print STDERR "$enc is encoded as $s\n";
			$attempt->{string}=~s/$s/$enc/g;
			$attempt->{table}->{$enc}=$s;
		}
		$attempt->{string}=~s/0/$zero/g; $attempt->{table}->{$zero}=0;
		$attempt->{string}=~s/1/$one/g;  $attempt->{table}->{$one}=1;

		print STDERR "String compressed to: ", 
				length($attempt->{string}), "\n";
		print STDERR $attempt->{string}, "\n";
	}

	return (sort { length($a->{string}) <=> length($a->{string}) } 
		    ($r1, $r2))[0];
}

my $strobj=encode( $string_to_encode, $charset, $c1, $c2);

# Now, make up the decoding table.  Decimal is okay it can be changed.
my $decodetab='%e=(';
foreach(keys %{$strobj->{table}}) {
	$decodetab .= qq{'$_'=>};
	$decodetab .= eval "0b" .$strobj->{table}->{$_};
	$decodetab .= qq{,\n};
}
$decodetab.=");";

# Now encode the top.
my $message=$strobj->{string};
while(length $message) {
	my $c=substr($message, 0, 1);  # Pull off char 1
	unless ($picture=~s/$schar/$c/ ) {
		my $l;
		$l=($picture=~tr/$schar//);
		die "Picture too small for encoding! $l characters leftover";
	}
	$message=substr($message, 1);
}
if ($picture=~/$schar/) {
	warn "You've got too many $schar 's in your picture\n";
}

# The decoder appears in multiple parts.

my $cs=join("", ($c1,$c2,@$charset)); $cs="\Q$cs";
my $top=qq&=~m/(.*)/s;\$_=\$1;s![^$cs]!!g;&;
my $bottom=q~
     for$a(keys %e){$e{$a}=sprintf"%b",$e{$a};}$y= qq{(}.
     join('|',map"\Q$_\E",keys %e).qq{)}; s/$y/$e{$1}/gex;
     print pack"B*",$_;~;

# And voila!  But you still have to arrange it.
#
print qq{'} . $picture . qq{'};
print $top;
print $decodetab;
print $bottom;


-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 4 Feb 2001 19:41:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <slrn97rc2q.jf8.abigail@tsathoggua.rlyeh.net>

Rudolf Polzer (rpolzer@web.de) wrote on MMDCCXIV September MCMXCIII in
<URL:news:slrn97qilt.44h.rpolzer@rebounce.rpolzer-lx>:
`' Abigail <abigail@foad.org> schrieb Folgendes:
`' > Rudolf Polzer (rpolzer@web.de) wrote on MMDCCXIV September MCMXCIII in
`' > <URL:news:slrn97qbos.1i4.rpolzer@rebounce.rpolzer-lx>:
`' > $$ Abigail <abigail@foad.org> schrieb Folgendes:
`' > $$ > /^1?$|^(11+?)\1+$/
`' > $$ 
`' > $$ I like this prime test...
`' > $$ but why does it not get faster when compiled once? I know that the secon
`' > $$ ? just improves the speed by beginning with small divisors instead of bi
`' > $$ ones.
`' > 
`' > 
`' > What makes you think it gets compiled more than once to begin with?
`' 
`' When I call it more often.


What makes you think a regex called "more often" needs to be compiled
more than once?



Abigail
-- 
print 74.117.115.116.32.97.110.111.116.104.101.114.
      32.80.101.114.108.32.72.97.99.107.101.114.10;


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

Date: Sun, 4 Feb 2001 12:20:07 -0500
From: "myriam chagal" <mchagal@total.net>
Subject: book
Message-Id: <%2gf6.2710$B_6.191396@news.total.net>

please recommend a good perl book

--

Myriam Chagal   :-)
mchagal@total.net




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

Date: Sun, 04 Feb 2001 13:13:52 -0500
From: "Jan Schaumann" <jschauma@netmeister.org>
Subject: Re: book
Message-Id: <rYgf6.5814$Zp3.546434@e3500-chi1.usenetserver.com>

* "myriam chagal" <mchagal@total.net> wrote:

> please recommend a good perl book

O'Reilley's "Camel" book (http://www.ora.com)

> --

Please change that to "-- "

-Jan

-- 
Jan Schaumann <http://www.netmeister.org>

Most women look for a man who is tall, dark and hung some.


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

Date: Sun, 4 Feb 2001 13:13:13 -0500
From: "georg_a_k" <georg_a_k@gnuage.com>
Subject: Re: book
Message-Id: <95k5ve01mgj@enews4.newsguy.com>

Perl Black Book by Steven Holzner (CoriolisOpenPress)


"myriam chagal" <mchagal@total.net> wrote in message
news:%2gf6.2710$B_6.191396@news.total.net...
> please recommend a good perl book
>
> --
>
> Myriam Chagal   :-)
> mchagal@total.net
>
>




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

Date: Sun, 4 Feb 2001 13:22:03 -0500
From: "georg_a_k" <georg_a_k@gnuage.com>
Subject: Re: book
Message-Id: <95k6fr01ncu@enews4.newsguy.com>

a quicky book that was helpful is:
VISUAL QUICKSTART GUIDE - PERL and CGI
their various guides cover many areas of computers and are well-stocked on
the shelves of barnes&noble


"georg_a_k" <georg_a_k@gnuage.com> wrote in message
news:95k5ve01mgj@enews4.newsguy.com...
> Perl Black Book by Steven Holzner (CoriolisOpenPress)
>
>
> "myriam chagal" <mchagal@total.net> wrote in message
> news:%2gf6.2710$B_6.191396@news.total.net...
> > please recommend a good perl book
> >
> > --
> >
> > Myriam Chagal   :-)
> > mchagal@total.net
> >
> >
>
>




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

Date: Sun, 4 Feb 2001 16:57:28 +0100
From: "Christian Gersch" <c.gersch@team.isneurope.com>
Subject: Re: deleting some folders...
Message-Id: <95ju5a$tnd$04$1@news.t-online.com>

Hi Bob!

Thank you for your reply :-)

>Please describe in much much greater detail.  "doesn't work correctly"
>leaves a lot of possibilities open.
It does not produce any error - ist just runs and exits - but nothing had
happened to the folders. :-(

>Looks like it would work to me, if
>unlink() were capable of removing a directory which is not empty.  But
>it won't even remove a directory unless you are superuser and Perl was
>started with -U.
Oh yes, why did I forget that? ;-)
Ehmm...but how can the script
a) check which directory is older than 5 minutes
b) change to the directory
c) delete the files in it
d) delete the directory itself

By the way: Of course I would pay for a good solution (= written script)
:-))

>You don't say what your platform is, but maybe system("rm -f -r $_")
>would work in place of unlink.  It might be slow.
It a deciated server, running RedHat Linux 7, Apache and Perl 5 (its a dual
processor system, not public - it should be fast enough ;-)

-Chris
--
Christian Gersch, chris@team.isneurope.com
:: www.neukunden.myisn.de - Geld für Ihre Startseite ::




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

Date: Sun, 4 Feb 2001 20:24:32 +0100
From: darkfusion@iceball.dyndns.org (Christian =?iso-8859-1?Q?Reitwie=DFner?=)
Subject: Embeding Perl in C, morality, freeing SVs
Message-Id: <slrn97rb9u.1vm.darkfusion@iceball.dyndns.org>

Hi!

I am embedding Perl in C and have some problems freeing SVs, perhaps it's
misuse of mortality.

I use some user-defined (i.e. runtime-created via eval) packages in which
there's a method I call several times. Before calling, I set some scalars to
saved values, after calling I save them again.
There's the possiblity for the method (via XS) to add some scalars to the
"save-pool" vi a XS function and to create a new "thread" (not a process
thread
or something like that) where these scalars are saved in. These threads can
alsobe terminated.

The problem happens the following way:
I have a "thread" a and I run the method in package where thread a was
executed for the last time. In this run, a new thread is created and the same
scalars are saved, as the first thread saved before (the same names, not the
same values). Then i run thread a, which has moved to another package and when
I want to save the scalar again after running the method, I get a segvault.
(at sv_setsv(thread-saved-sv, perl_get_sv(tmp1, TRUE));, where tmp1 is
package::scalar-name)

Now to how I implemented all that:

thread_start comes down to the following:

threadsv = perl_get_sv("package::thread", TRUE);
sv_setuv(threadsv, (unsigned) thread);
/* thread is a pointer and is used as thread-ID when a perl script calls a
 * function that manipulates a thread */
thread_save_scalar(thread, "package::thread")


thread_save_scalar:

SV *sv = perl_get_sv("package::scalar", FALSE);
thread-saved-sv = newSVsv(sv);


thread_terminate:
only the following is relevant, which is done for every saved scalar:
SvREFCNT_dec(thead-saved-sv);

now the two functions that are called before and after (respectively) the
perl-method call:
(it's already inside ENTER;SAVETMPS;...FREETMPS;LEAVE;)

threadvars_set:
SV *sv = sv_2mortal(perl_get_sv("package:scalar", TRUE));
sv_setsv(sv, thread-saved-scalar);

threadvars_reget:
sv = perl_get_sv("package::scalar", FALSE);
if (sv == NULL) sv = &PL_sv_undef;
sv_setsv(thread-saved-scalar, sv);


OK, that's all. I have used another method before, which worked very well (not
using sv_2mortal, but only setting the sv and leaving it set after the
method returned.). Today I discovered this bug, inserted the mortal-code but
this didn't help.
I got another error before, that the scalar can't be freed and now I only get
a SEGV (even with efence).

Thanks in advance for you help,

         Christian

	 


-- 
Christian Reitwießner <Christian@Reitwiessner.de>
--> http://www.secretstar.de
Kenny the talking bot:
--> kenny_dod #frg on IRCNet


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

Date: Sun, 4 Feb 2001 17:36:13 -0000
From: "Dr. Eldon D. Lehmann" <aida@globalnet.co.uk>
Subject: Help with simple Unix command script to delete some temp files...
Message-Id: <t7r4rli54117de@xo.supernews.co.uk>

Hi there.  I have a need to create a really simple script to automate the
deletion of some temporary data & image files from a temp directory at my
Website, but I am not quite sure how to do this, or where to start.  I am
not even sure whether I need to arrange this as a PERL script, or whether
there is a 'simpler' alternative.

The background is - I have some Web-based programs (PERL scripts) running at
my site which generate some temporary data and image files as part of their
operation.  These small files do *not* need to be kept long term.  On a
previous server the ISP set up some sort of separate   'tidyup'   PERL
script which I think ran automatically as a cron / chrond job, once a day.
This was operated against a standard temp directory for the entire server.

I do not have this previous tidyup script available to me now, and since the
application has been ported to a new server, I now have to use a temporary
directory just allocated for my own Webspace.  I now find this filling up
with all these interim data / image files.  If I do not manually delete
these, all my Webspace will become filled up with these files
(unnecessarily).

I do not know if anyone call help or offer some guidance about this.

However rather than just deleting the entire contents of the temporary
directory it would be tidier to be able to only delete the   *.dat   and
*.gif    files (while allowing other files to remain there, in case needed).

Also rather than deleting all files once a day, it would be preferable to
delete all files more than, say, one day (24 hours) old.  The exact age of
the files isn't important.  However if all files are deleted and someone is
accessing the application via the Web at the same time as the chron job is
run, then they run the risk of losing their data.  Therefore only deleting
files older than, say, 24 hours should circumvent this problem.

Alternatively rather than checking both the date & time when files were
created, if it is simpler it would also be fine to ensure that the  *.dat
and  *.gif  files with a file date older than say (current date - 1 day)
were deleted, with the other files left in place.  However I am not sure how
to arrange for the dates of the files to be checked and for only old ones to
be deleted.

I would be grateful for any help / advice that anyone may be able to offer
about this.

Thanking you for your kind assistance.

With best wishes,


Dr. Eldon Lehmann
E-mail:  aida@globalnet.co.uk





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

Date: 04 Feb 2001 17:09:32 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Help with simple Unix command script to delete some temp files...
Message-Id: <7l36je1v.fsf@pobox.com>

"Dr. Eldon D. Lehmann" <aida@globalnet.co.uk> writes:

> I would be grateful for any help / advice that anyone may be able to
> offer about this.

Dr Lehmann - with all due respect, it seems as though you're looking
to *hire* someone to write a program or a group of programs for you.
This newsgroup is for the discussion of Perl language issues.

If you are looking to learn Perl, then you'll want to pick up a copy
of the book "Learning Perl".  If you are looking to have a script
written for you, then you'll want to place an ad in the appropriate
jobs newsgroup or in your local newspaper.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Sun, 04 Feb 2001 16:56:12 GMT
From: robert_hughes@my-deja.com
Subject: Help! How to print range of array lines?
Message-Id: <95k1jb$3qq$1@nnrp1.deja.com>

Please Help!!

I am trying to display a list of contacts in a
webpage.

When calling the script I first read in the pipe
delimited file to an array so that I can sort by
last name or by company depending on a user
inputed variable.

Once the array is sorted I then need to be able
to print to screen only array lines that are
between two variables. e.g. 1-25 or 26-50 etc.

The problem I'm encountering is I can't use the
standard <FILE> line count comparison with an
array:
----------------------------------
$current_first = 1;
$current_last = 25;
if ($current_first == $. ... $current_last == $.)
{ print "print stuff here";}
----------------------------------

I know $. refers to the current line number in
the last opened <FILE> but what would I use to
represent the current line number in an array?

Let me know if I should post the complete code if
I've not explained well enough.

Thank you for your input and please excuse me if
this seems to be a stupid question to you Gods of
PERL, but I'm really trying to learn this crap
and after searching for three days through
perldoc and the perl faqs, asking here is my last
hope.

Regards,

Robert Hughes





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


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

Date: 04 Feb 2001 12:41:34 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help! How to print range of array lines?
Message-Id: <m3elxe1h2p.fsf@mumonkan.sunstarsys.com>

robert_hughes@my-deja.com writes:

> Once the array is sorted I then need to be able
> to print to screen only array lines that are
> between two variables. e.g. 1-25 or 26-50 etc.

Sounds like you want an array slice:

        my @array = map {"$_\n"} 1..100;
        print @array[25..49]; #second batch of 25


For more details, see 

% man perldata

HTH
Joe Schaefer
-- 
"The most beautiful thing we can experience is the mysterious. It is
the source of all true art and all science. He to whom this emotion is
a stranger, who can no longer pause to wonder and stand rapt in awe, is
as good as dead: his eyes are closed."
                                         --Albert Einstein


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

Date: Sun, 04 Feb 2001 20:39:14 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: Is it possible for perl to open Dos programs?
Message-Id: <95keli$cqq$1@nnrp1.deja.com>

In article <95hi7s$dqo$1@nnrp1.deja.com>,
  fenderstratocaster@my-deja.com wrote:

> What would people need to do, to get this program to run on their
> system? Or is Perl a bad language to use for this sort of programming?
---------

Not quite sure what you mean by "getting this program to run on their
system." Could be run:

- as a local install if they had perl, your script, and your external
app loaded on their machine... essentially duplicate whatever
environment you have.

- *maybe* as a local install if you used the perl2exe utility from
www.perl2exe.com to "compile" the perl stuff, plus your third party app.

- *maybe* as a web client if you had your script and the third party app
installed on a webhost, and build an html interface to allow them to
input the required parameters. Probably pretty involved since you'd most
likely want to restrict access to the tool rather than let the world in.
All very possible.


as far as being the correct language to use... I dunno. Perl has pros
and cons when compared to a compiled language like C. Depends on what
libraries are available, what platforms you'd want to build on, etc,
etc, etc.

D

-------------------------------------------------
I never check deja email because of the spam-bots....
if you want to email me directly use dan_at_dtbakerprojects.com
after making the obvious substitution.
- thanx, Dan


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


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

Date: Sun, 04 Feb 2001 15:59:54 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: JAPH
Message-Id: <040220011559546388%wuerz@yahoo.com>

In article <3a7d48e9.30d9$288@news.op.net>, mjd@plover.com (Mark Jason
Dominus) wrote:

> It's an obfuscation.  Who the heck cares if it's not strict-clean?
> 
> 'strict subs' is there to prevent maintenance headaches from unquoted
> strings.  That is a non-issue for this program.

fair enough, but

(1) the gleefully stated intention of the code was to 'infect' other
scripts which in turn would include strictures and the -w switch,
presumably. But then, the introductory paragraphs were pretty
obfuscated themselves, so I might have missed something, I'll admit
that.

(2) of course I only turned all that on after the code -as pasted-
failed to compile.

-mona


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

Date: Sun, 4 Feb 2001 20:52:52 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: JAPH
Message-Id: <slrn97rcok.357.rpolzer@rebounce.rpolzer-lx>

Mona Wuerz <wuerz@yahoo.com> schrieb Folgendes:
> In article <3a7d48e9.30d9$288@news.op.net>, mjd@plover.com (Mark Jason
> Dominus) wrote:
> 
> > It's an obfuscation.  Who the heck cares if it's not strict-clean?
> > 
> > 'strict subs' is there to prevent maintenance headaches from unquoted
> > strings.  That is a non-issue for this program.
> 
> fair enough, but
> 
> (1) the gleefully stated intention of the code was to 'infect' other
> scripts which in turn would include strictures and the -w switch,
> presumably. But then, the introductory paragraphs were pretty
> obfuscated themselves, so I might have missed something, I'll admit
> that.
> 
> (2) of course I only turned all that on after the code -as pasted-
> failed to compile.

And this should depend on your Perl version.

-- 
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote


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

Date: Sun, 04 Feb 2001 18:21:26 GMT
From: "Richard & Stacy" <rworth5@home.com>
Subject: Keyword Search
Message-Id: <G4hf6.9857$wI1.787400@news1.rdc1.mb.home.com>

I am still looking for an answer to my above question.
Was looking for some help before Monday, if there is any.

Thanks




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

Date: 4 Feb 2001 16:09:53 GMT
From: rob_13@excite.com (Rob - Rock13.com)
Subject: Re: Keyword Search
Message-Id: <903E705DBrock13com@207.91.5.10>

Richard & Stacy <rworth5@home.com>:

>I am trying to figure out how to extract keywords from the URL
>when someone visits my site and keep a log of all keywords.

Log the referers, then regexp the query strings in the logs for 
keywords.

>I know this is probably very simple, but my head is becoming very
>sore from banging against the keyboard and I have resoted to
>asking for some help. 

I suppose that's how its done, I use Wusage and it takes care of this 
for me:-) You might look at some software that does logging to see 
how they do it.
-- 

Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


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

Date: 04 Feb 2001 12:26:58 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Keyword Search
Message-Id: <87ae82483x.fsf@limey.hpcc.uh.edu>

>> On Sun, 04 Feb 2001 05:49:42 GMT,
>> "Richard & Stacy" <rworth5@home.com> said:

> I am trying to figure out how to extract keywords from
> the URL when someone visits my site and keep a log of
> all keywords.

What do you mean by "keyword"?
What is "the URL"?

> When they are extracted from URL, I want to increment if
> it already exists or if it is a new keyword add to the
  ^^
Increment what?  And what is "it"?

Your question is far too vague for anyone to even guess
what you're trying to do.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Sun, 04 Feb 2001 20:42:33 GMT
From: dtbaker_dejanews@my-deja.com
Subject: Re: LWP on win32
Message-Id: <95kerp$d4b$1@nnrp1.deja.com>

In article <3A7B97B7.8C5EFE92@dstmail.itg.ti.com>,
  Regy <varghese@dstmail.itg.ti.com> wrote:
> This is an example in the ORielly Web Client Programming book:
>
> #!perl/bin/perl
> use LWP::Simple;
>
> print (get $ARGV[0]);
>
> This works perfectly when I used it to download a webpage, using a
linux
> machine but does not return anything on a winnt machine. There are no
> errors either. Any ideas as to why?
--------------

try adding the -w option to your first line and check error logs.

#!perl/bin/perl -w

-dan


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


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

Date: Sun, 04 Feb 2001 22:17:06 GMT
From: delanthear@my-deja.com
Subject: Re: Modules/Constants.
Message-Id: <95kkd0$gme$1@nnrp1.deja.com>

<deleted cuz Deja has messed it up>

> To illustrate nobull's point:
>
>   $ cat x
>   #!/usr/local/bin/perl -l
>   package A;
>   use warnings;
>   use strict;
>   use x_h;
>
>   print HELLO;
>
>   package B;
>   use warnings;
>   use strict;
>   use x_h;  # already loaded in package A
>
>   print HELLO;
>
>   __END__
>   $ perl x
>   Name "B::HELLO" used only once: possible typo at x line 14.
>   hello
>   Filehandle B::HELLO never opened at x line 14.
>   $
>
> >The is a module designed to overcome this problem - it is called
> >Exporter.
>
> Declaring constants in their own name space and exporting into the
> using name space prevents this problem.
>
> --
> Garry Williams

Ok.  I'm confused.  Here is my situation.

I have a main script, which is what you run.   There are 2
other 'modules'.  One containing functions which deal with
communications between the main script and a server, and another which
contains numerous constants (about 100) which are used by _both_ the
main script, and the communications modules.

Do I
1: Have the constants module 'use'd' in both scripts?
2: Have it just in one of the scripts?
3: Or give up and declare them in both scripts :)

It just seems really messy to have all 100 odd constants put into an
exporter variable again :)

Incidently, I've just realised that having the constants in a seperate
file and useing them isn't working :(  Where abouts in the module do
they need to be declared?


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


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

Date: Sun, 04 Feb 2001 17:30:42 -0500
From: John Kitchin <jkitchin@udel.edu>
Subject: Re: newbie
Message-Id: <3A7DD812.F913D82C@udel.edu>

You aren't very clear on what exactly you are trying do do, but the following use of a regexp will work to identify lines with matching
brackets.

$string="\section{environment}";
if ($string=~ m/{*}/ ){print "true \n"}

are you trying to convert latex source to somethin?


j

Deja User wrote:

> Hi there
>
> I am Balaji from Cambridge, I am using perl for data conversion areas, could anyone explain me how to use perl for matching brackets.
>
> e.g. \header{The aricle title \it{vs}}
>
> Thanks in Advance
>
> Balaji
>
> ------------------------------------------------------------
> --== Sent via Deja.com ==--
> http://www.deja.com/
>
>  Sent via Deja.com http://www.deja.com/
>  Before you buy.



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

Date: Sun, 04 Feb 2001 17:58:25 GMT
From: bgolub@student.math.hr (Boris Golub)
Subject: newbie: simple question on FTPing
Message-Id: <3a7d96a6.3300172@bagan.srce.hr>

What is the best way to write a simple perl script that tries to fetch
a file from a host and

1. there is a time limit to establishing a connection with host
2. number of tries is also limited

Thanks in advance

Boris Golub


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

Date: 4 Feb 2001 18:00:34 -0000
From: nospam_nomail@usa.net
Subject: Out of memory ...
Message-Id: <QW9VJNZ636926.7920601852@frog.nyarlatheotep.org>

If somebody could help ...

Trying to mirror a website on another server with a Perl Script (the Fefe's
WebMirror), I always got an "Out of memory" error after some files.

The log file looks like:

Getting [remote domain/page 1]
saving to [my repertory/page 1]
Content-Type: text/html

Getting [remote domain/page 2]
saving to [my repertory/page 2]
Content-Type: text/html

etc

Getting [remote domain/page 1]
saving to [my repertory/page 1]
Out of memory!

Thanks for your help !

Jim



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

Date: Sun, 4 Feb 2001 19:19:19 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: suidperl problem
Message-Id: <slrn97rao3.5gf.efflandt@efflandt.xnet.com>

On 03 Feb 2001 18:06:40 +0000, nobull@mail.com <nobull@mail.com> wrote:
>Beggar <cpegbeggar@mail.com> writes:
>
>> #!/usr/bin/suidperl -w
>> $ENV{'PATH'}="/usr/bin:/usr/sbin:/bin:/sbin";
>> 
>> print "content-type: text/html\n\n";
>> 
>> $temp1=`cat /etc/shadow`;
>> $temp2=`/bin/ps`;
>> 
>> `nohup "start_my_server_program"`
>> 
>> print "$temp1,$temp2"
>> =========================================
>
>> Q1:    Why when I run the perl with "perl 123.pl", it always show:
>>     Insecure $ENV{BASH_ENV} while running setuid at ./123.pl line 7.
>
>See the entry for the error message "Insecure $ENV{%s} while running
>%s" in perldiag.
> 
>> Q2:    The problem in Q1 does not happy in using as CGI call from web.
>
>Probably because the web server didn't define BASH_ENV in the CGI
>script's environment.
>
>>     But I can only got the output from "$temp1", no output from
>> "$temp2".
>>     Why can't I use "ps" in this script.

Because 'ps' with no options only shows what is running on that terminal
and there is no terminal in CGI.

>> Q3.    When I run my program with "nohup", it seems that it can't run at 
>>     all, why ?
>
>There's little point using nohup when the program is already running
>without a controlling terminal.

Look for deamonize in:  perldoc perlipc Return something useful from the
CGI, then daemonize, cd, and run the program using:

system("/path/cmd &");

>BTW: don't use backticks in a void context.  For reason see FAQ
>"What's wrong with using backticks in a void context?"
>
>It would probably be enlightening to take a look in the HTTP server's
>error log.
>
>> Please cc a mail to cpegbeggar@mail.com
>
>Please post only to newsgroups you read.
>
>Please use Mail-copies-to: header rarther than asking us to do it manually.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Sun, 04 Feb 2001 20:46:31 GMT
From: James Thornton <james_thornton@my-deja.com>
Subject: swatch.pl - watch your website's traffic in real-time
Message-Id: <95kf36$d6v$1@nnrp1.deja.com>

swatch.pl -- Site Watch is a PERL script that provides a means for you
to watch your website's traffic in real-time.

    http://www.jamesthornton.com/code/swatch.txt


James Thornton
_________________________________________________________
MIT Web Curriculum Free Online (Nexus Watch October 2000)
--> http://www.jamesthornton.com/nexuswatch/20001018.html


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


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

Date: Sun, 04 Feb 2001 17:57:29 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: Text::Template Problem
Message-Id: <3a7d97fb.121580894@news.wildapache.net>

Hello,

I just down loaded the TEXT::Template module from CPAN, but I can not
get something to function.

I have a template defined like shown in the man page, i.e.:


Here is a list of the things I have got for you since 1907:
{ my $blist = ''; 
foreach $i (@items) {
$blist .= qq{  * $i\n};
}
$blist;
}


then I build a hash in a script with:

#!/usr/bin/perl

 ...snip...
my @items = qw(This is Cool);

my $result = $text_template->fill_in(HASH => \%items);

when I print $result, it is not correct.  All I get back is:

Here is a list of the things I have got for you since 1907:


but if I use:

my $result = $text_template->fill_in(HASH => {items => ["This", "is",
"cool"]});

then the results are as expected; i.e.:

Here is a list of the things I have got for you since 1907:
  * This
  * is
  * cool

Any ideas?  I really would like to use this module, but if it is not
working properly, does anyone know of a similar text template
module/paradigm that I can use?

I have a perl script that I am working on that will print out billing
invoices/statements and would like to be able to modify the format of
the reports (if ever necessary) with external to the script templates.

Since I am working with invoices/statements, I need to be able to pass a
hash of invoice line items to the template.

Text::Template would be perfect, if I could get it to work.

Incidently, I have written to every address that I can find at
www.plover.com (authors of the module) but I can not get a response from
them.  If anyone knows how else I can contact those guys, I will.

Thanks,
Murrah Boswell


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

Date: Sun, 04 Feb 2001 22:44:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Text::Template Problem
Message-Id: <vnmr7tk06hr8l53c21u776sd94jndiqeso@4ax.com>

OTR Comm wrote:

>my @items = qw(This is Cool);
>
>my $result = $text_template->fill_in(HASH => \%items);

@items and %items is not the same variable.

>but if I use:
>
>my $result = $text_template->fill_in(HASH => {items => ["This", "is",
>"cool"]});
>
>then the results are as expected

Well, then you need to use "{ items => \@items }" instead of "\%items".

-- 
	Bart.


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

Date: Sun, 04 Feb 2001 17:18:01 GMT
From: georg_a_k <georgkgeorgk@my-deja.com>
Subject: too many errors for dos screen
Message-Id: <95k2s6$4l6$1@nnrp1.deja.com>

Is there any way in activeperl to redirect error messages to a file
from activeperl's DOS window.

I have tried the following :) all have failed :(
1)   dos mode command cant accept cols>80 || lines>50
2)   dos command |more unaffected by perl error display
3)   dos pipe > postfix on command line unaffected by perl error display
4)   PrintScreen (capture mode) on keyboard NG on hp820cse win printer

Thanks in advance...


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


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

Date: Sun, 04 Feb 2001 17:56:27 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: too many errors for dos screen
Message-Id: <fJgf6.279504$hD4.67585567@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <95k2s6$4l6$1@nnrp1.deja.com>,
	georg_a_k <georgkgeorgk@my-deja.com> writes:
> Is there any way in activeperl to redirect error messages to a file
> from activeperl's DOS window.
> 
> I have tried the following :) all have failed :(
> 1)   dos mode command cant accept cols>80 || lines>50
> 2)   dos command |more unaffected by perl error display
> 3)   dos pipe > postfix on command line unaffected by perl error display
> 4)   PrintScreen (capture mode) on keyboard NG on hp820cse win printer

perl myscript > output



-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sun, 4 Feb 2001 13:20:11 -0500
From: "georg_a_k" <georg_a_k@gnuage.com>
Subject: Re: too many errors for dos screen
Message-Id: <95k6cb01n6u@enews4.newsguy.com>

I tried that as stated in the original message # 3, but errors dont get
redirected with >.
Thanks

"Clinton A. Pierce" <clintp@geeksalad.org> wrote in message
news:fJgf6.279504$hD4.67585567@news1.rdc1.mi.home.com...
> [Posted and mailed]
>
> In article <95k2s6$4l6$1@nnrp1.deja.com>,
> georg_a_k <georgkgeorgk@my-deja.com> writes:
> > Is there any way in activeperl to redirect error messages to a file
> > from activeperl's DOS window.
> >
> > I have tried the following :) all have failed :(
> > 1)   dos mode command cant accept cols>80 || lines>50
> > 2)   dos command |more unaffected by perl error display
> > 3)   dos pipe > postfix on command line unaffected by perl error display
> > 4)   PrintScreen (capture mode) on keyboard NG on hp820cse win printer
>
> perl myscript > output
>
>
>
> --
>     Clinton A. Pierce              Teach Yourself Perl in 24 Hours!
>   clintp@geeksalad.org         for details see http://www.geeksalad.org
> "If you rush a Miracle Man,
> you get rotten Miracles." --Miracle Max, The Princess Bride




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

Date: Sun, 4 Feb 2001 20:59:25 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: too many errors for dos screen
Message-Id: <slrn97rd4t.36j.rpolzer@rebounce.rpolzer-lx>

georg_a_k <georg_a_k@gnuage.com> schrieb Folgendes:
> I tried that as stated in the original message # 3, but errors dont get
> redirected with >.
> Thanks
> 
> "Clinton A. Pierce" <clintp@geeksalad.org> wrote in message
> news:fJgf6.279504$hD4.67585567@news1.rdc1.mi.home.com...
> > [Posted and mailed]
> >
> > In article <95k2s6$4l6$1@nnrp1.deja.com>,
> > georg_a_k <georgkgeorgk@my-deja.com> writes:
> > > Is there any way in activeperl to redirect error messages to a file
> > > from activeperl's DOS window.
> > >
> > > I have tried the following :) all have failed :(
> > > 1)   dos mode command cant accept cols>80 || lines>50
> > > 2)   dos command |more unaffected by perl error display
> > > 3)   dos pipe > postfix on command line unaffected by perl error display
> > > 4)   PrintScreen (capture mode) on keyboard NG on hp820cse win printer

use REDIR.EXE from the djgpp package to redirect STDERR:
redir -eo perl x.pl

You could also try pressing the PAUSE key at the correct point.

-- 
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote


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

Date: Sun, 4 Feb 2001 15:35:49 -0500
From: "georg_a_k" <georg_a_k@gnuage.com>
Subject: Re: too many errors for dos screen
Message-Id: <95kebd0276p@enews4.newsguy.com>

Thanks Rudolf, that worked great!

"Rudolf Polzer" <rpolzer@web.de> wrote in message
news:slrn97rd4t.36j.rpolzer@rebounce.rpolzer-lx...
> georg_a_k <georg_a_k@gnuage.com> schrieb Folgendes:
> > I tried that as stated in the original message # 3, but errors dont get
> > redirected with >.
> > Thanks
> >
> > "Clinton A. Pierce" <clintp@geeksalad.org> wrote in message
> > news:fJgf6.279504$hD4.67585567@news1.rdc1.mi.home.com...
> > > [Posted and mailed]
> > >
> > > In article <95k2s6$4l6$1@nnrp1.deja.com>,
> > > georg_a_k <georgkgeorgk@my-deja.com> writes:
> > > > Is there any way in activeperl to redirect error messages to a file
> > > > from activeperl's DOS window.
> > > >
> > > > I have tried the following :) all have failed :(
> > > > 1)   dos mode command cant accept cols>80 || lines>50
> > > > 2)   dos command |more unaffected by perl error display
> > > > 3)   dos pipe > postfix on command line unaffected by perl error
display
> > > > 4)   PrintScreen (capture mode) on keyboard NG on hp820cse win
printer
>
> use REDIR.EXE from the djgpp package to redirect STDERR:
> redir -eo perl x.pl
>
> You could also try pressing the PAUSE key at the correct point.
>
> --
> $p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
> -u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
> C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
> learn.to/quote




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

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


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