[16483] in Perl-Users-Digest
Perl-Users Digest, Issue: 3895 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 3 00:05:28 2000
Date: Wed, 2 Aug 2000 21:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965275512-v9-i3895@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 Aug 2000 Volume: 9 Number: 3895
Today's topics:
Re: ? User Agent for Pocket IE ? <uctraing@ultranet.com>
Re: A DOS box question (Keith Calvert Ivey)
Re: A DOS box question <elephant@squirrelgroup.com>
Actually..... Re: Parse::RecDescent with left-recursive <ocschwar@mit.edu>
Re: Actually..... Re: Parse::RecDescent with left-recur (Damian Conway)
Re: Algorithm for efficient creation of unique, random <phill@modulus.com.au>
Re: attribute names in errors in DBI:mysql <pjl-news@barefooters.org>
Re: CGI.pm cookie failure (Clinton A. Pierce)
Re: FormMail.pl problems (Gwyn Judd)
Re: Help with perl please ... <jeff@yoak.com>
Impossible RegEx Problem <rickysregistration@hotmail.com>
Re: Impossible RegEx Problem <mauldin@netstorm.net>
Re: Impossible RegEx Problem <rickysregistration@hotmail.com>
Insecure dependency when passing a parameter with GET <linux@worsdall.demon.co.uk>
Interpolating strings--special characters, _not_ variab <psmith@baynetworks.com>
Re: Interpolating strings--special characters, _not_ va <elephant@squirrelgroup.com>
Re: Interpolating strings--special characters, _not_ va <elephant@squirrelgroup.com>
Re: outputting a CGI script to another frame? <jeff@yoak.com>
Re: PerlScript <rckjr@yahoo.com>
Re: Problem with autovivification in tied hashes. <rick.delaney@home.com>
Re: Problem with autovivification in tied hashes. (Vipul Ved Prakash)
Re: Producing a .gif file using a perl script <bwalton@rochester.rr.com>
Re: question about a Regular Expression (Abigail)
Re: Regexp problem - Stripping HTML <jeff@yoak.com>
Re: Remove a blank line <rashid1218@hotmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Aug 2000 22:22:06 -0400
From: Bob <uctraing@ultranet.com>
Subject: Re: ? User Agent for Pocket IE ?
Message-Id: <pmlhosonn64d0bqhsj69bdqktjutk8vr6i@4ax.com>
On Mon, 24 Jul 2000 10:33:14 +1000, Peter Hill <phill@modulus.com.au>
wrote:
>Bob wrote:
>>
>> Anyone have a pointer to where I can get a sample of the
>> browser ID / User Agent string(s) for "Pocket PC" IE browser ?
>>
<>
>http://www.cyscape.com/browscap/
>hth
They have everything in there but the latest version (V3) of
Pocket IE... I hate to make a rash assumption that it's the same
as V2 with the version number updated :-)
If anyone knows of a pointer to the User Agent string for V3 of
Pocket IE, I could still use it.
thanks,
bob
------------------------------
Date: Thu, 03 Aug 2000 00:48:18 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: A DOS box question
Message-Id: <398cc0af.2582637@news.newsguy.com>
jason <elephant@squirrelgroup.com> wrote:
>BardicStorm writes ..
>>Start Windows as normal.. run command.com to open dos while windows is
>>running, then use c:\perl <program>
[snip]
>and just quietly .. what you propose will not work on the majority of
>Windows systems .. the perl interpreter is rarely in the root directory
>of the C drive
A more charitable interpretation is that BardicStorm left out a
greater-than after the backslash when reproducing the DOS prompt
(of course, that would probably have a capital "C" too).
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Thu, 03 Aug 2000 01:27:02 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: A DOS box question
Message-Id: <MPG.13f367cb7cdab1449896b6@news>
Keith Calvert Ivey writes ..
>jason <elephant@squirrelgroup.com> wrote:
>>BardicStorm writes ..
>
>>>Start Windows as normal.. run command.com to open dos while windows is
>>>running, then use c:\perl <program>
>[snip]
>
>>and just quietly .. what you propose will not work on the majority of
>>Windows systems .. the perl interpreter is rarely in the root directory
>>of the C drive
>
>A more charitable interpretation is that BardicStorm left out a
>greater-than after the backslash when reproducing the DOS prompt
>(of course, that would probably have a capital "C" too).
I never let charity get in the way of accuracy .. point of my post
wasn't to be uncharitable - it was to correct an error before that error
generated another off-topic thread to this newsgroup *8^)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 03 Aug 2000 02:23:12 +0000
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Actually..... Re: Parse::RecDescent with left-recursive grammar.
Message-Id: <3988D790.9F039585@mit.edu>
Damian Conway wrote:
Since primary_expression is this,
> primary_expression:
> IDENTIFIER
> | CONSTANT
> | STRING_LITERAL
> | '(' expression ')'
doesn't post_fix_expression need these mods?
> postfix_expression:
> primary_expression
> | (primary_expression)(s) '[' expression ']'
(primary_expression)(s) ('[' expression ']' )(s)
> | (primary_expression)(s) '(' ')'
> | (primary_expression)(s) '(' argument_expression_list ')'
> | (primary_expression)(s) '.' IDENTIFIER
> | (primary_expression)(s) PTR_OP IDENTIFIER
these also need something to cover foo.bar.baz and foo->bar->baz,
and then there's the issue of things like foo.bar[baz].
And this is where the dreaded ghoul of left recursion
arises from its watery grave.
> | (primary_expression)(s) INC_OP
> | (primary_expression)(s) DEC_OP
One way that might do it is
(primary_expression)(s) (suffix)(s)
where we have
suffix :
'[' expression ']'
| PTR_OP IDENTIFIER
| '.' identifier
------------------------------
Date: 3 Aug 2000 03:57:02 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Actually..... Re: Parse::RecDescent with left-recursive grammar.
Message-Id: <8maqie$lq2$1@towncrier.cc.monash.edu.au>
Omri Schwarz <ocschwar@mit.edu> writes:
>Damian Conway wrote:
[Issues with the C grammar]
Thanks for those. I'll need to look at it when I get some time.
Unless anyone else wants to volunteer to take over maintenance of the
RecDescent C Grammar from Hell :-)
Damian
------------------------------
Date: Thu, 03 Aug 2000 12:02:50 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: Algorithm for efficient creation of unique, random array
Message-Id: <3988D2CA.4D01@modulus.com.au>
Logan Shaw wrote:
>
> In article <3987D4D0.6796@modulus.com.au>,
> Peter Hill <phill@modulus.com.au> wrote:
> >I need to efficiently select 'x' unique, random (or pseudo-random)
> >numbers from 'y' options, where 'y' is the range 0..y.
> >What I've done so far is inefficient:
>
> Well, you've already discovered this is an FAQ, but this problem always
> reminds me of another problem which I've wanted a good solution for,
> but which doesn't seem to be covered by the Fisher-Yates algorithm.
>
> Anyway, imagine you have a list of items paired with floating numbers:
>
> %x = ( "a" => 1.2, "b" => 4.37, "c" => 2.10, "d" => 0.23, "e" => 1.05 );
>
> and you'd like to write a function that will randomly select
> one of the items such that the probability of selecting a given
> item is proportional to the number paired with the item. So,
> for example, "c" should be twice as likely to be selected as
> "e" and almost half as likely to be selected as "b".
>
> I've already thought of one way to do this, but I'm wondering if
> there is a more efficient way. The way I would do it is to
> essentially imagine all the numbers spread out on a (number) line
> where the distance from them to their left neighbor is equal to
> the probability that they should be selected. Then, I'd pick a
> number from zero to the length of that line and pick the number
> to the right of the number I picked. I'd model it like this:
>
> $total = 0;
> foreach $key (sort keys %x)
> {
> push (@line, [ $total += $x{$key}, $key ]);
> }
>
> This should give me an array like this:
>
> (
> [ '1.2', 'a' ],
> [ '5.57', 'b' ],
> [ '7.67', 'c' ],
> [ '7.9', 'd' ],
> [ '8.95', 'e' ]
> );
>
> Now I can pick a random number between 0 and 8.95 and locate
> the appropriate element with a binary search. So that's not
> too terrible. It's O(log N) to pick a number given the
> list. The problem is, the list is O(N) to build[1], and it
> has to be entirely (or almost entirely) rebuilt every time
> the number associated with any single item changes.
>
> So, any ideas? I realize this isn't exactly a perl question,
> but I think it might be interesting to people here.
>
> - Logan
>
> [1] O.K., technically it's not O(N) because I used the "sort" function
> but I just did that so it would look nice in the example.
This would seem to be the Monte Carlo problem, where functions describe
the distribution of a number of variables (e.g. normal, Chi-sq etc) and
the aim is to sample each of the variables multiple times to obtain a
statistical sample of their combined outcomes - commonly used in
investment planning.
I'm off to search for 'Monte Carlo' solutions.
--
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/
------------------------------
Date: 3 Aug 2000 02:00:26 GMT
From: "Paul J. Lucas" <pjl-news@barefooters.org>
Subject: Re: attribute names in errors in DBI:mysql
Message-Id: <8majnq$1mov$1@nntp1.ba.best.com>
In <slrn8ogu2f.mfs.jsd@cluttered.com> jsd@cluttered.com (Jon Drukman) writes:
>just trap the error message and substitute "login" for "key 3".
That's not generic enough. I want a stand-alone error routine
to be able to do the substitution for any key in any table
without having to have intimate knowledge of the tables.
- Paul
------------------------------
Date: Thu, 03 Aug 2000 04:02:33 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: CGI.pm cookie failure
Message-Id: <t96i5.57400$fR2.565480@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <8mado6$1vt$1@news8.svr.pol.co.uk>,
"Daniel Foster" <daniel@blackomega.com> writes:
> #!/usr/bin/perl
No -w? Bad programmer!
> use CGI;
> use CGI::Carp (fatalsToBrowser);
> use CGI::Cookie;
No "use strict"? Bad programmer!
[edited slightly]
> $co = new CGI;
> $cook2 = new
> CGI::Cookie(-name=>'test2', -expires=>'+1h', -value=>'saveme2');
>
[small editing here]
> print $co->header(-cookie=>$cook2); # doesn't work
> print 'output';
>
> It's all taken from examples, so I figured it should work. All that
> happens is 'output' gets printed in the browser, and so would anything
> else I put there, like a real HTML page or something.
You expected maybe a Mariachi band would start playing? Maybe baloons would
fall from the ceiling?
That's all the browser's going to show you. Get yourself a cookie
monitoring tool and watch the cookies go by. I've found that IE's
cookie warnings get bypassed for a lot of silly, silly reasons so
don't rely on that browser alerting you when the cookie is set.
This code works (it did for me!). If you don't believe that a
cookie's being sent try this modification:
print $co->header();
print $co->header(-cookie => $cook2);
print "Hello, world";
Now, the first print is going to print the header so you don't get a
500 error or something. The second print is going to show you the
cookie getting set and the normal text/html header getting printed.
PS: Your original pasted examples had:
print $co-header(-cookie=>$cook); # doesn't work
I hope that's not the code you were using. It's an error. It'll parse
but not run the way you want. Warnings would have helped tremendously.
--
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: Thu, 03 Aug 2000 02:14:12 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: FormMail.pl problems
Message-Id: <slrn8ohlbi.fp5.tjla@thislove.dyndns.org>
I was shocked! How could Red Jackson <redone~nospam~@siteconnect.com>
say such a terrible thing:
>Hi!
>I'm running Formmail.pl (Ver 1.6) on Apache 1.3.9 with mod_perl built
No offense but all of Matt Wrights scripts are well known to horribly
buggy and full of sucurity issues. You'd do better to write your own.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Are there those in the land of the brave
Who can tell me how I should behave
When I am disgraced
Because I erased
A file I intended to save?
------------------------------
Date: Wed, 02 Aug 2000 21:31:26 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Help with perl please ...
Message-Id: <8malk21o4r@news2.newsguy.com>
[ posted and emailed ]
In article <8mabho$3mk$1@gxsn.com>, "Jon Simmons"
<unidam@freenetname.co.uk> wrote:
>
> Can anyone tell me the best way to store large chunks of html in a file
> to be returned to the script at a later date and placed on a returned
> web page with other content too. i need this information in order to
> create a product database for my site that will have information and
> other calculated related links.
There would be some contention about the "best way," but my favorite way
is to use HTML::Mason. You can learn about it at http://www.masonhq.com/
. I hope this helps.
Cheers, Jeff
------------------------------
Date: Thu, 03 Aug 2000 01:43:23 GMT
From: "Earthlink News" <rickysregistration@hotmail.com>
Subject: Impossible RegEx Problem
Message-Id: <%64i5.4276$0W4.142671@newsread2.prod.itd.earthlink.net>
Hello,
I'm having the devil of a time with a seemingly impossible regex problem.
Scenario: I have a config file where one of the parameters is a regex of
the form:
parameter: "s%Rick%Rick is $cool%g"
where $cool is a variable set in the script.
Problem: My script reads in the parameter from the config file; sets it
to $$p ($p == parameter and $$p == "s%Rick%Rick is $cool%g"); now I'd like
to actually evaluate $$p but it doesn't evaluate. I've tried many, many
approaches.
Failed Approaches: I first tried using eval on $$p as in:
$doc =~ eval($$p);
eval($doc =~ $$p);
$foo = $p;
eval($doc =~ $foo);
eval($doc =~ eval($foo));
In all instances, $$p is written out just fine and eval($$p) (or, for that
matter, eval($foo)) results in the correct string (i.e., it substitutes
everything correctly and gives a string that is then "s%Rick%Rick is cool%g"
(without the quotes here)) but the regex doesn't execute in any of the above
formats! I've tried adding /e also to no avail. I'm sure it's something
really obvious that I'm overlooking but, for the life of me, I can't figure
out what that is. Can one of you Perl/RegEx gurus point me in the right
direction?
Thanks in advance,
Rick.
P.s., I'm using Perl 5.005_03 built for i386-linux
------------------------------
Date: Thu, 03 Aug 2000 02:28:10 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Impossible RegEx Problem
Message-Id: <3988D83C.4AC5B69F@netstorm.net>
Earthlink News wrote:
> I'm having the devil of a time with a seemingly impossible regex problem.
>
> Scenario: I have a config file where one of the parameters is a regex of
> the form:
> parameter: "s%Rick%Rick is $cool%g"
> where $cool is a variable set in the script.
Something like this came up earlier today. I guess you mean you want to
replace the substring $cool (a placeholder) with the value in the scalar
$cool, and then execute the search on some other string that is likely
to have 'Rick' in it.
$parameter = 's%Rick%Rick is $cool%g'; # rexep from config file
$cool = 'a dick'; # assignment within the script
$parameter =~ s/\$cool/$cool/; # replace substr '$cool' with value of
$cool
$_ = q(As far as I'm concerned Rick and someone to avoid); # string to
search
eval ($parameter);
print;
Your confusion is because in $paramater '$cool' looks like a variable
when in fact it is merely a bunch of characters (a substring).
-- Jim
------------------------------
Date: Thu, 03 Aug 2000 03:28:52 GMT
From: "Earthlink News" <rickysregistration@hotmail.com>
Subject: Re: Impossible RegEx Problem
Message-Id: <UF5i5.4547$0W4.154211@newsread2.prod.itd.earthlink.net>
Jim Mauldin <mauldin@netstorm.net> wrote in message
news:3988D83C.4AC5B69F@netstorm.net...
> Something like this came up earlier today. I guess you mean you want to
> replace the substring $cool (a placeholder) with the value in the scalar
> $cool, and then execute the search on some other string that is likely
> to have 'Rick' in it.
Hi Jim,
Not quite... you see, $cool *is* a variable in the script and the eval
statements referenced earlier *do* replace $cool with the value of the
scalar $cool (in this case, $cool == 'cool').
>
> $parameter = 's%Rick%Rick is $cool%g'; # rexep from config file
> $cool = 'a dick'; # assignment within the script
> $parameter =~ s/\$cool/$cool/; # replace substr '$cool' with value of
> $cool
> $_ = q(As far as I'm concerned Rick and someone to avoid); # string to
> search
> eval ($parameter);
> print;
Not quite; the eval ($parameter) does short work of this. So the logic goes
something like this:
### In config file:
parameter: "s%Rick%Rick is $cool%g"
### In the script:
# Read in config file and assign parameters to local variables:
$p = 'parameter';
$$p = '"s%Rick%Rick is $cool%g"';
$cool = 'cool but Jim is an asswipe';
$doc = 'What do you think about the posters? Rick';
# Here's where the problem starts:
$doc =~ eval($$p);
print "$doc\n";
# This *should* return
What do you think about the posters? Rick is cool but Jim is an asswipe
But, sadly, it doesn't. The eval() correctly returns 's%Rick%Rick is cool
but Jim is an asswipe%g' but the actual substitution doesn't occur for this
or any of the other eval() permutations. Any suggestions?
Thanks for your help,
Rick.
------------------------------
Date: Thu, 3 Aug 2000 02:28:37 +0100
From: Mark Worsdall <linux@worsdall.demon.co.uk>
Subject: Insecure dependency when passing a parameter with GET
Message-Id: <mhLV$KAFrMi5Ewq0@worsdall.demon.co.uk>
Hi,
I am passing a url and a string to an external perl script using the GET
method.
The error occurs on the machine calling the external script.
Using LWP::Simple causes no errors but takes to long and the returned
result, I am not interested in.
Using lynx to run the external script causes the insecure dependceny
error.
If there is a better method of calling an external (A script located on
another web server) script, then I am quite happy to use another method.
Remember, I am not interested in the result of the called script.
With the following I get Insecure dependency in system while running
setuid at Webmaster.pl line 628.
Here is an example of the data being passed to external script:-
$found = "Hello World";
$url = "http://www.foobar/";
$found =~ s/ /%20/g;
$found = "http://www.foobar/cgi-bin/arches.pl?&url=" . $url . "&q=" .
$found;
$ENV{'PATH'} = '';
Line 628 system('/usr/local/bin/lynx ' . $shadowfound);
#$shadowfound = LWP::Simple::get($shadowfound);
I put the $ENV{'PATH'} = ''; line in to stop Insecure $ENV{PATH} while
running setuid at Webmaster.pl line 627. This has stopped that error
If I replace Line 628 with the LWP:: line it takes too long and I ain't
interested in what comes back anyway.
M.
--
He came from Econet - Oh no, I've run out of underpants :(
Home:- jaydee@wizdom.org.uk http://www.wizdom.org.uk
Shadow:- webmaster@shadow.org.uk http://www.shadow.org.uk
Work:- netman@hinwick.demon.co.uk http://www.hinwick.demon.co.uk
Web site Monitoring:- http://www.shadow.org.uk/SiteSight/
------------------------------
Date: 02 Aug 2000 22:18:05 -0400
From: "Paul D. Smith" <psmith@baynetworks.com>
Subject: Interpolating strings--special characters, _not_ variables
Message-Id: <p54s53m6jm.fsf@nortelnetworks.com>
I've read FAQ4 but it talks about how to substitute variable values into
constant strings. What I want to do is do all the special character
expansion (\n, \t, etc.) on a constant string. It seems like this
should be simple, but I can't find any way to do it.
So, I have:
$foo = 'hi\nthere';
Suppose in reality the value is read from a file or something, so I
can't just replace '' with "" and be done.
Now I want to assign the value of $foo _with the special character
sequences replaced with the real values_ to $bar:
$bar = expandit $foo;
so bar now holds the string "hi<newline>there" (where <newline> is an
actual newline character obviously).
What is "expandit"? Obviously I could use s/\\n/\n/, but there are a
lot of possible sequences and it would really, really suck to have to
handle them all by hand.
Isn't there some way I can get Perl to do that substitution for me,
using its normal interpolation?
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@baynetworks.com> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
------------------------------
Date: Thu, 03 Aug 2000 03:02:55 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Interpolating strings--special characters, _not_ variables
Message-Id: <MPG.13f37e3c69c20bc59896b8@news>
Paul D. Smith writes ..
>I've read FAQ4 but it talks about how to substitute variable values into
>constant strings. What I want to do is do all the special character
>expansion (\n, \t, etc.) on a constant string. It seems like this
>should be simple, but I can't find any way to do it.
>
>So, I have:
>
> $foo = 'hi\nthere';
>
>Suppose in reality the value is read from a file or something, so I
>can't just replace '' with "" and be done.
>
>Now I want to assign the value of $foo _with the special character
>sequences replaced with the real values_ to $bar:
>
> $bar = expandit $foo;
$bar = eval qq("$foo");
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 03 Aug 2000 03:09:16 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Interpolating strings--special characters, _not_ variables
Message-Id: <MPG.13f37fbfec61c5fd9896b9@news>
jason writes ..
>Paul D. Smith writes ..
>>I've read FAQ4 but it talks about how to substitute variable values into
>>constant strings. What I want to do is do all the special character
>>expansion (\n, \t, etc.) on a constant string. It seems like this
>>should be simple, but I can't find any way to do it.
>>
>>So, I have:
>>
>> $foo = 'hi\nthere';
>>
>>Suppose in reality the value is read from a file or something, so I
>>can't just replace '' with "" and be done.
>>
>>Now I want to assign the value of $foo _with the special character
>>sequences replaced with the real values_ to $bar:
>>
>> $bar = expandit $foo;
>
> $bar = eval qq("$foo");
actually .. make that
$foo =~ s/"/\\"/g;
$bar = eval qq("$foo");
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 02 Aug 2000 21:27:13 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: outputting a CGI script to another frame?
Message-Id: <8malc50o4r@news2.newsguy.com>
In article <8mae0o$n06$1@nnrp1.deja.com>, j555@my-deja.com wrote:
> Hi, I've got a search mechanism in one frame (a form) and I'd like its
> output to go to another frame. Can someone tell me how I go about doing
> that? Thanks in advance!
This really doesn't have anything to do with Perl. You should consider an
HTML newsgroup if the documentation and FAQ that are available for HTML
don't address this.
Cheers,
Jeff
------------------------------
Date: Thu, 03 Aug 2000 02:41:51 GMT
From: Dr. Strangepork <rckjr@yahoo.com>
Subject: Re: PerlScript
Message-Id: <8mam5f$sm5$1@nnrp1.deja.com>
First off, you need to convert your script to WSH. That can easily be
accomplished by adding the following to the beginning of the script:
<Job Id="whatever>
<script language="PerlScript">
and then at the end...
</script></job>
And save the file with .WSF as the extension in 9x/NT and .WS in W2K.
Now, to answer your question, add this:
$Parent = $WScript->GetObject("IIS://"& ServerName & "/W3SVC");
Note the "$" before the WScript object. Perl needs to see that "$".
And if you find a PerlScript newsgroup, let me know! I've been looking
for weeks!
Rick
In article <DpYh5.682$rL3.91317@den-news1.rmi.net>,
"Jason Horner" <jason.horner@corp.rmi.net> wrote:
> does anyone know how to instantiate a com object in perlscript(server
side)
>
> in vb script
> ex:
> Set Parent=GetObject("IIS://"& ServerName& "/W3SVC")
>
> how would you do this in PerlScript
> also does anyone know of a Perlscript News Group I was unable to find
one.
>
> thanks
>
>
--
Rick Kasten, MCSE SysAdmin Consultant
Collective Technologies http://www.colltech.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 03 Aug 2000 02:09:02 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Problem with autovivification in tied hashes.
Message-Id: <3988D658.70F03351@home.com>
[posted & mailed]
Vipul Ved Prakash wrote:
>
> I have run into a problem while handling references in tied hashes. An
> assignment to a tied hash that is a reference in lvalue context (created
> automatically) is completely opaque inside STORE().
STORE is seeing the value it is passed. The problem is that it isn't
passed what you think it is.
> print "assignment 1\n";
> $h{headers1}->{from} = 'foo@bar.com'; # Automatic Reference opaque in STORE()
Since $h{headers} is undefined, trying to defererence it autovivifies a
hash. Let's pretend this anonymous hash's name is %anon. The order
here is:
1. Create %anon (by derefencing undef)
2. Store \%anon in $h{headers1}
3. Populate %anon
So at the time of STORE, %anon is empty.
> print "VALUE: $h{headers1}->{from}\n"; # But accessible outside.
By now it's full.
> print "\nassignment 2\n";
> $h{headers2} = {from => 'foo@bar.com'}; # Works as expected.
In this assignment the order is:
1. Create %anon
2. Populate %anon
3. Store \%anon in $h{headers}
So dereferencing inside STORE shows all the entries of %anon.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 3 Aug 2000 03:56:47 GMT
From: vipul@shell2.ba.best.com (Vipul Ved Prakash)
Subject: Re: Problem with autovivification in tied hashes.
Message-Id: <slrn8ohrbt.n2b.vipul@shell2.ba.best.com>
In article <3988D658.70F03351@home.com>, Rick Delaney wrote:
> [snip]
> 1. Create %anon (by derefencing undef)
> 2. Store \%anon in $h{headers1}
> 3. Populate %anon
Ah! I was expecting 3 would happen before 2.
> So at the time of STORE, %anon is empty.
>
> > print "VALUE: $h{headers1}->{from}\n"; # But accessible outside.
>
> By now it's full.
>
> > print "\nassignment 2\n";
> > $h{headers2} = {from => 'foo@bar.com'}; # Works as expected.
>
> In this assignment the order is:
>
> 1. Create %anon
> 2. Populate %anon
> 3. Store \%anon in $h{headers}
>
> So dereferencing inside STORE shows all the entries of %anon.
Yes, I grok it now. I suppose my only option is to access/modify this
reference in FETCH the first time it is accessed.
Thanks for your help.
best regards,
vipul.
------------------------------
Date: Thu, 03 Aug 2000 03:53:58 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Producing a .gif file using a perl script
Message-Id: <3988ED0F.876F9769@rochester.rr.com>
Johann Fuchs wrote:
>
> Hi everyone
>
> I'm trying to produce a gif file as out put from a perl script, so I can
> use it as a target for an <img src=hhhh.cgi> tag in an HTML file (cgi).
>
> Can anybody direct me to a sample, please?
>
> Thanks,
> Johann
I assume you want to include a dynamically-generated image on a web
page, right? If so, here is a simple complete example that will create
a plot of a user-specified line:
use CGI qw(:standard);
use GD;
if(param('image')){
print "Content-type: image/gif\n\n";
binmode STDOUT;
$im = new GD::Image(100,100);
$lightpurple=$im->colorAllocate(255,200,255);
$black=$im->colorAllocate(0,0,0);
$im->interlaced('true');
$im->line(param('n1'),param('n2'),param('n3'),
param('n4'),$black);
print $im->gif;
exit;
}
print header,
start_html('GD Example'),
h1('GD Example'),
start_form,
textfield('n1'),p,
textfield('n2'),p,
textfield('n3'),p,
textfield('n4'),p,
"Enter four numbers from 0 to 100 and submit",p,
submit,
end_form,
hr;
if(param()){
print img{src=>'GDtest.pl?n1='.param('n1').
'&n2='.param('n2').'&n3='.param('n3').
'&n4='.param('n4').'&image=yes',width=>100,height=>100};
}
print end_html;
Note that the above will only work when used by a version of GD that
supports GIF files. Recent versions of GD don't seem to include GIF
support -- you can use PNG, but then you'll need browser support for PNG
images. The GD in the Perl Resource Kit (at least 1st edition for
Windoze) supported GIF's.
--
Bob Walton
------------------------------
Date: 03 Aug 2000 02:36:29 GMT
From: abigail@foad.org (Abigail)
Subject: Re: question about a Regular Expression
Message-Id: <slrn8ohmkl.6n1.abigail@alexandra.foad.org>
Philip Taylor (phil.taylor@bigfoot.com) wrote on MMDXXVIII September
MCMXCIII in <URL:news:8m8idp$9ec$1@news6.svr.pol.co.uk>:
--
-- Greg Bacon <gbacon@HiWAAY.net> wrote in message
-- news:sobq96ug9ft7@corp.supernews.com...
--
-- > I would write
-- >
-- > if (/^\s* \d\d? \s*-\s* \d\d? \s*$/x) {
-- > ...;
-- > }
--
-- What does the x on the end do?
man perlop
-- > or maybe
-- >
-- > if (/^\s* # optional leading whitespace
-- > \d\d? # one- or two-digit score
-- > \s*-\s* # dash separator (with optional whitespace)
-- > \d\d? # one- or two-digit score
-- > \s*$/x) # optional trailing whitespace
-- > {
-- > ...;
-- > }
--
-- Why does the dash not need escaping above?
Why do you think it does?
Abigail
--
perl -wle 'eval {die ["Just another Perl Hacker"]}; print ${$@}[$#{@${@}}]'
------------------------------
Date: Wed, 02 Aug 2000 19:21:14 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Regexp problem - Stripping HTML
Message-Id: <8madvv0vop@news1.newsguy.com>
[posted and emailed]
In article <eli$0008021903@qz.little-neck.ny.us>, Eli the Bearded
<elijah@workspot.net> wrote:
> HTML::Parser it is, and I think version 3 can deal with this (while
> older versions probably won't -- but I don't use HTML::Parser much).
> Look at the xml_mode for the parser.
Ah then. This would be the Way.
>
>> $x =~ s/<\?php.*?\?>//g;
>
> That will turn this working, legal php fragment:
>
> <?php echo "PHP tags look like <?php {code} ?>"; ?>
>
> into
>
> "; ?>
Now it isn't fair to snip out the part of my comment where I said "if you
are sure that ?> won't appear before the end of the tag..." :-) I don't
know php from a hole in the ground. But it does sound as though it
presents the same problem as trying to parse things like
<img src="arrow.gif" alt="-->">
Token based parsers are so much better.
> I find non-greedy matches dangerous, and would prefer a five-line RE
> that avoids them to a one-liner that uses them.
In this case only? If generally, why?
Cheers,
Jeff
------------------------------
Date: Thu, 03 Aug 2000 01:23:02 GMT
From: Rashid Saharudin <rashid1218@hotmail.com>
Subject: Re: Remove a blank line
Message-Id: <8mahhk$pck$1@nnrp1.deja.com>
Thank you for the reply. It works..
However, at the ending of the text file, there it appears to be a
phrase "print "\n"; ". I tried to do some manipulation but it seems
that it does not work. Could you please help me to sort it out.
Also, how could I save the data with blank lines stripped and comments
being removed, could be opened as a new text file or as original ie the
text file when opened after this process, does not contain the blank
lines and comments.
Thank you very much.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3895
**************************************