[22230] in Perl-Users-Digest
Perl-Users Digest, Issue: 4451 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 22 21:05:42 2003
Date: Wed, 22 Jan 2003 18: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)
Perl-Users Digest Wed, 22 Jan 2003 Volume: 10 Number: 4451
Today's topics:
@INC Error <urzaserra@home.com>
Re: @INC Error (Tad McClellan)
Re: APL's relation to perl <goldbb2@earthlink.net>
Re: Can I store an array into a DataBase? <itatsumakiNO@SPAMhotmail.com>
Re: Converting a string to a valid date.. <krahnj@acm.org>
Re: File::Copy under NT appears to fail. (Fergus McMenemie)
Re: function overriding (Ben Morrow)
Getting Values Out of An Object: How Do I Do This? Th (opensourcedrm)
Re: Getting Values Out of An Object: How Do I Do This? <krahnj@acm.org>
Re: Getting Values Out of An Object: How Do I Do This? <itatsumakiNO@SPAMhotmail.com>
Re: Getting Values Out of An Object: How Do I Do This? <bongie@gmx.net>
help w simple (I think) syntax err <penny1482@attbi.com>
Re: help w simple (I think) syntax err <skuo@mtwhitney.nsc.com>
Re: how to make my perl cgi program run in IE <me@nosmap.com>
Re: how to make my perl cgi program run in IE <eighner@io.com>
Re: how to make my perl cgi program run in IE <andreas.schmidt.2002@gmx.de>
Re: how to make my perl cgi program run in IE <me@nosmap.com>
Re: how to make my perl cgi program run in IE <bongie@gmx.net>
Re: identifying web host platform? <dg1261@cs-REMOVE_THIS-.com>
In the following code snippet, how do I reference a var (opensourcedrm)
Re: In the following code snippet, how do I reference a <bongie@gmx.net>
Re: Is anyone using Perl 6 yet? (Sara)
Re: OT: I've got wild staring eyes, and I've got a stro (Jay Tilton)
Perl monitoring tool (Joseph)
Perl on IIS (run in ASP pages?) <me@home.com>
Re: Please help decoding this perl code. (Jay Tilton)
Re: Regex to find all words containing a single vowel? (Martin)
Re: slow grep <goldbb2@earthlink.net>
Re: To extract a specific portion of a text file (John Smith)
Re: To extract a specific portion of a text file (John Smith)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Jan 2003 23:34:08 GMT
From: "matt" <urzaserra@home.com>
Subject: @INC Error
Message-Id: <QTFX9.1639$QV3.123556@news2.west.cox.net>
I am new at doing perl and would like some help.
When i try to run the script below i get this error
Can't locate /my domain name.com/cgi-bin/data folder/iConfig.pm in @INC
(@INC contains: /usr/local/lib/perl5/site_perl/5.8.0/mach
/usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.0/BSDPAN /usr/local/lib/perl5/5.8.0/mach
/usr/local/lib/perl5/5.8.0 .) at inst_mysql.cgi line 40
rleevant parts of scripts
require "/onlinewebpromotion.com/cgi-bin/data folder/iConfig.pm";
require "/onlinewebpromotion.com/cgi-bin/data folder/iSubs.pm";
I know that i have the file location right because when enter the filenam
directly and comes up with an internal server error.
------------------------------
Date: Wed, 22 Jan 2003 18:00:15 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: @INC Error
Message-Id: <slrnb2uc4f.8o5.tadmc@magna.augustmail.com>
matt <urzaserra@home.com> wrote:
> When i try to run the script below i get this error
>
> Can't locate /my domain name.com/cgi-bin/data folder/iConfig.pm in @INC
^^^^^^^^^^^^^^^^^^^
> require "/onlinewebpromotion.com/cgi-bin/data folder/iConfig.pm";
^^^^^^^^^^^^^^^^^^^^^^
One of these is not like the other.
One of these things just isn't the same.
> I know that i have the file location right
^^^
Which file location?
There seems to be 2 file locations involved.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 22 Jan 2003 20:26:43 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: APL's relation to perl
Message-Id: <3E2F44D3.485970F1@earthlink.net>
Michele Dondi wrote:
>
> On Fri, 17 Jan 2003 19:11:54 GMT, Uri Guttman <uri@stemsystems.com>
> wrote:
>
> >you should take a peek at the perl 6 world. many of the apl vector
> >flavored ops are getting into perl. you will be able to convert most
> >common ops to a vector form, e.g. a scalar can be added to all
> >elements
>
> Another OT intervention from me, but at least in this case it's a Perl
> question...
>
> To your knowledge, will Perl 6 support cartesian products and the
> possibilty of iterating over them, e.g. with a syntax roughly of the
> kind of:
>
> for my ($x,$y) ((1..3)*(1..5)) {
> # do something...
> }
According Apocolypse 4, you'll be able to do:
for @foo -> $a, $b { # two at a time
...
}
Clear, if @foo contains $x, $y pairs, this will be doable.
The question, now, is how to generate @foo as the crossproduct of two
lists.... Since I havn't read through the apocolypses recently, I can't
point out the page, but I'm sure it's in there.
> I would really love that! (OK, I can check the relevant docs as
> suggested if I'm really interested in these matters...)
Indeed. The important thing is knowing where the docs are:
http://www.perl.com/pub/au/Wall_Larry
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Thu, 23 Jan 2003 00:02:18 GMT
From: "Okey Laboratory" <itatsumakiNO@SPAMhotmail.com>
Subject: Re: Can I store an array into a DataBase?
Message-Id: <H9543u.9o3@campus-news-reading.utoronto.ca>
Sure, if you've installed DBI and DBD::MySQL (check the name on that latter
module) you would do something like:
use DBI;
my $dbh = DBI->connect(dbi:MySQL:<name>, "user", "password");
my @array = (1,2,3,4,5,6);
my $sql = 'INSERT INTO <TABLE> VALUES (?,?,?,?,?,?,?,?)
my $sth = $dbh->prepare($sql);
$sth->execute(@array);
$dbh->commit();
HTH,
Paul
"Francesco Moi" <francescomoi@europe.com> wrote in message
news:5b829932.0301221420.2d28a58c@posting.google.com...
> Hello.
>
> I'm working with Perl and MySQL, and I would like to store an
> array (@my_array) into a DataBase, so that I can handle it.
>
> Is it possible?
>
> Thank you very much.
------------------------------
Date: Thu, 23 Jan 2003 00:16:02 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Converting a string to a valid date..
Message-Id: <3E2F33EC.878CE4A6@acm.org>
Bullet wrote:
>
> Well I wrote the following little snippet to handle it..
>
> I think it should work ok.. assuming my Short Month names are all correct ..
> Somehow I didnt think it would have been this easy.. all my other forays
> into
> dates and times have been much harder..
>
> Anyone see any holes? or anything I missed?
my()
> sub d_convert{
>
> %shortmonths =
> ("Jan"=>'01',"Feb"=>'02',"Mar"=>'03',"Apr"=>'04',"May"=>'05',"Jun"=>'06',
>
> "Jul"=>'07',"Aug"=>'08',"Sep"=>'09',"Oct"=>'10',"Nov"=>'11',"Dec"=>'12');
You don't need this static assignment inside the sub.
> $conv_date = $_[0];
> $conv_date =~ s/,//;
> @de = split(/\s/,$conv_date);
>
> if (length($de[2]) == 1) {
> $de[2] = '0'.$de[2];
> }
>
> return "$de[3]:$shortmonths{$de[1]}:$de[2] $de[0]"
>
> }
>
> $date_in = "17:42:50 Jan 30, 2003 PST";
> print &d_convert($date_in);
my %shortmonths =
qw( Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6
Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12 );
sub d_convert {
my @de = split /,?\s+/, $_[ 0 ];
return sprintf '%04d-%02d-%02d %s', $de[3], $shortmonths{$de[1]}, @de[2,0];
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Jan 2003 00:21:21 +0000
From: fergus@twig.demon.co.uk (Fergus McMenemie)
Subject: Re: File::Copy under NT appears to fail.
Message-Id: <1fp7q7x.em9h0r1p2131iN%fergus@twig.demon.co.uk>
Jay Tilton <tiltonj@erols.com> wrote:
> fergus@twig.demon.co.uk (Fergus McMenemie) wrote:
>
> : I have used File::Copy to copy 600000 files from one disk to another.
> : The copy returned 0 now and again for no apparent reason.
>
> What is in $! when this happens?
$! contains something similar to "No such file or directory".
--
Fergus McMenemie Email:fergus@twig.demon.co.uk.
Technical Basis Phone:(UK) 07721 376021
Unix/Mac/Intranets Analyst Programmer
------------------------------
Date: Wed, 22 Jan 2003 23:21:21 +0000 (UTC)
From: mauzo@mimosa.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: function overriding
Message-Id: <b0n91h$d3t$1@wisteria.csv.warwick.ac.uk>
"David" <perl-dvd@darklaser.com> wrote:
> I've got a nice test of this groups skills.
>
> What I'm trying to accomplish is, get my error log for a specific
>script to write to a different log (accomplished this part), but prefix
>any error line with the date/time and ip (only got about half of this
>part).
> With the code below I have successfully overridden warn() and die()
>to prefix with this info, but anytime I get an error like:
>"cp: /path/to/image.jpg: No such file or directory"
> It is not prefixed. It would be nice if it worked with compile time
>errors too (note I have this stuff in a BEGIN block).
>
>######################################
>BEGIN {
> $|=1;
> open(STDERR, ">>/path/to/logs/ss_err.log");
> use subs 'warn';
> sub warn {
> unshift (@_, "[" . localtime() .
> "] [WARN] [$ENV{'REMOTE_ADDR'}] ");
> CORE::warn(@_);
> }
> use subs 'die';
> sub die {
> unshift (@_, "[" . localtime() .
> "] [DIE] [$ENV{'REMOTE_ADDR'}] ");
> CORE::die(@_);
> }
>}
>######################################
use CGI::Carp;
You may need to install it from CPAN.
Ben
------------------------------
Date: 22 Jan 2003 16:39:04 -0800
From: opensourcedrm@netscape.net (opensourcedrm)
Subject: Getting Values Out of An Object: How Do I Do This? Thanks!
Message-Id: <607f5a5e.0301221639.36e5c13c@posting.google.com>
Suppose I have this:
$data = [
{
first => 'Jonathan',
last => 'Eisenzopf',
email => 'eisen@pobox.com'
},
{
first => 'Larry',
last => 'Wall',
email => 'larry@wall.org'
}
];
How do I get the value Jonathan?
Is it $data->first ?
Thanks for your help!
------------------------------
Date: Thu, 23 Jan 2003 01:43:16 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Getting Values Out of An Object: How Do I Do This? Thanks!
Message-Id: <3E2F485E.5910BD53@acm.org>
opensourcedrm wrote:
>
> Suppose I have this:
>
> $data = [
> {
> first => 'Jonathan',
> last => 'Eisenzopf',
> email => 'eisen@pobox.com'
> },
> {
> first => 'Larry',
> last => 'Wall',
> email => 'larry@wall.org'
> }
> ];
>
> How do I get the value Jonathan?
$data->[0]->{first}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Jan 2003 01:15:25 GMT
From: "Okey Laboratory" <itatsumakiNO@SPAMhotmail.com>
Subject: Re: Getting Values Out of An Object: How Do I Do This? Thanks!
Message-Id: <H957Hp.K6@campus-news-reading.utoronto.ca>
Well, let's think this through:
This $data is actually a reference to an anonymous array of hashes so you'll
need to get at the array:
@{$data}
And you want the first element so perhaps:
@{$data}[0]
Of course you have to put that in scalar context:
${@{$data}}[0]
And finally you need to get a hash element out of this array:
${@{$data}}[0]{first}
But perhaps I've been overzealous with the {} so maybe:
${@$data}[0]{first}
And indeed that works out.
HTH,
Paul
"opensourcedrm" <opensourcedrm@netscape.net> wrote in message
news:607f5a5e.0301221639.36e5c13c@posting.google.com...
> Suppose I have this:
>
> $data = [
> {
> first => 'Jonathan',
> last => 'Eisenzopf',
> email => 'eisen@pobox.com'
> },
> {
> first => 'Larry',
> last => 'Wall',
> email => 'larry@wall.org'
> }
> ];
>
> How do I get the value Jonathan?
>
> Is it $data->first ?
>
> Thanks for your help!
------------------------------
Date: Thu, 23 Jan 2003 02:48:34 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Getting Values Out of An Object: How Do I Do This? Thanks!
Message-Id: <4945564.IZgaJkDWvn@nyoga.dubu.de>
opensourcedrm wrote:
> $data = [
> {
> first => 'Jonathan',
> last => 'Eisenzopf',
> email => 'eisen@pobox.com'
> },
> {
> first => 'Larry',
> last => 'Wall',
> email => 'larry@wall.org'
> }
> ];
>
> How do I get the value Jonathan?
$data->[0]{first};
$data is a reference to an anonymous array of anonymous hashes, so
$data->[0] is a reference to the first hash, and $data->[0]->{first} is
the value of the entry 'first' in this hash. The arrow between
successive indices is optional, so it can also be written as
$data->[0]{first}.
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
People come up to me and they're worried...that I'll reproduce.
-- Emo Phillips
------------------------------
Date: Thu, 23 Jan 2003 00:47:18 GMT
From: "Dick Penny" <penny1482@attbi.com>
Subject: help w simple (I think) syntax err
Message-Id: <qYGX9.1573$_s4.731@rwcrnsc54>
I get the following syntax err with the following snippet. How should I code
to avoid error? I cannot figure it out. Is it even correct? I do NOT have
a function pi(). Obviously I am using strict, warnings, & math. (I am using
the ? : construct because I could not find a 'sign' operator or function in
Perl as delivered from AS).
-------error
Ambiguous use of -pi resolved as -&pi()
-------code start
if (abs($real) > .001) {$dcphase = atan2($imag,$real)}
else {$dcphase = ($imag>0) ? pi/2:-pi/2};
--------code end
Thanks
--
Dick Penny
------------------------------
Date: Wed, 22 Jan 2003 17:21:14 -0800
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: help w simple (I think) syntax err
Message-Id: <Pine.GSO.4.21.0301221719420.29194-100000@mtwhitney.nsc.com>
On Thu, 23 Jan 2003, Dick Penny wrote:
> I get the following syntax err with the following snippet. How should I code
> to avoid error? I cannot figure it out. Is it even correct? I do NOT have
> a function pi(). Obviously I am using strict, warnings, & math. (I am using
> the ? : construct because I could not find a 'sign' operator or function in
> Perl as delivered from AS).
> -------error
> Ambiguous use of -pi resolved as -&pi()
> -------code start
> if (abs($real) > .001) {$dcphase = atan2($imag,$real)}
> else {$dcphase = ($imag>0) ? pi/2:-pi/2};
> --------code end
>
> Thanks
Try using parentheses to disambiguate:
$dcphase = ($imag>0) ? pi/2 : -(pi/2);
--
Cheers,
Steven
------------------------------
Date: Thu, 23 Jan 2003 00:21:43 GMT
From: "Eric" <me@nosmap.com>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <rAGX9.1785$QV3.171677@news2.west.cox.net>
I'm a total newbie to CGI stuff and was trying to replicate a very simple
script I found on a web tutorial. Since I dont have Perl installed, I tried
the sample written in C. When i pointed the browser to it, it displayed the
contents of the script like it was an HTML page instead of trying to run it.
Do you know how to configure IIS to try to execute it?
Here's what I did:
1)create file test1_c.cgi and put it in a virtual directory.
2) use the following url:http://localhost/cgi-tests/test1_c.cgi
Here are the contents of the file:
#include <stdio.h>
void main() {
/** Print the CGI response header, required for all HTML output. **/
/** Note the extra \n, to send the blank line. **/
printf("Content-type: text/html\n\n") ;
/** Print the HTML response page to STDOUT. **/
printf("<html>\n") ;
printf("<head><title>CGI Output</title></head>\n") ;
printf("<body>\n") ;
printf("<h1>Hello, world.</h1>\n") ;
printf("</body>\n") ;
printf("</html>\n") ;
exit(0) ;
}
looking at the URL on the tutorial, it seems to point directly to the
script:
http://www.jmarshall.com/easy/cgi/hello_s.c.cgi
here's the page that describes what's being done:
http://www.jmarshall.com/easy/cgi/cgi_footnotes.html#samples
I'm running Windows XP Pro with IIS and the .NET framework installed.
Thanks,
Eric
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:au0352$f6h$2@slb6.atl.mindspring.net...
> "philip" <philip_ord@yahoo.com> wrote in message
> news:f711da37.0212201308.2cc23db@posting.google.com...
> > I wrote a simple perl program to print some HTML tags.
> > but it can only run in command mode.
> > when I tried to run it in IE, it launched the command window.
> > what is the program?
>
> IE has no capability to execute your cgi script directly. You need a
server,
> e.g., Apache, to provide that capability.
>
> IndigoPerl, available free from www.indigostar.com, is a nice
pre-configured
> Perl and Apache installation for your Windows system. Just download and
> install it, start up Apache, and point your browser to http://localhost.
If
> you get the success page, you're ready to go.
>
> Now drop a copy of your Perl script into the folder c:\indigoperl\cgi-bin
> and point your browser to http://localhost/cgi-bin/your_script_name.pl.
> Please ensure your Perl script looks something like:
>
> #!perl -w
> # usage - e.g., in c:\indigoperl\cgi-bin, type ..\bin\perl -c
> your_script_name.pl
> # I've put the path to the script above so I don't have to type it
> # when I'm testing in the "MS-DOS Prompt" window
> # remove these comments, if you like, replacing them with what you prefer
> use strict;
> use CGI qw(-no_xhtml :standard);
> print header, start_html;
> # more code here
> print end_html;
>
> Good luck and Happy Holidays!
>
> Bill Segraves
>
>
>
------------------------------
Date: Wed, 22 Jan 2003 18:36:55 -0600
From: Lars Eighner <eighner@io.com>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <slrnb2uecl.4hh.eighner@dumpster.io.com>
In our last episode, <rAGX9.1785$QV3.171677@news2.west.cox.net>, the
lovely and talented Eric broadcast on comp.lang.perl.misc:
> I'm a total newbie to CGI stuff and was trying to replicate a very simple
> script I found on a web tutorial. Since I dont have Perl installed, I tried
> the sample written in C. When i pointed the browser to it, it displayed the
> contents of the script like it was an HTML page instead of trying to run it.
> Do you know how to configure IIS to try to execute it?
Your browser cannot execute cgi (unless you have a really
advanced browser like Lynx, which has lynxcgi).
CGI is executed server-side, which means you must have a
server (such as Apache) to handle the cgi and serve the
result.
--
Lars Eighner -finger for geek code- eighner@io.com http://www.io.com/~eighner/
"Shhh! Be vewwy, vewwy quiet! I'm hunting Muswims!"
- President Elmer Bush
------------------------------
Date: Wed, 22 Jan 2003 16:48:44 -0800
From: Andreas Schmidt <andreas.schmidt.2002@gmx.de>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <20030122164844.3392b5c6.andreas.schmidt.2002@gmx.de>
On Wed, 22 Jan 2003 18:36:55 -0600
Lars Eighner <eighner@io.com> wrote:
> Your browser cannot execute cgi (unless you have a really
> advanced browser like Lynx, which has lynxcgi).
>
> CGI is executed server-side, which means you must have a
> server (such as Apache) to handle the cgi and serve the
> result.
I think he knows that already. He asked how to configure his server to make cgi running. (I don't have the answer, either, though. I recommend to just use Apache under Linux!)
Andi
------------------------------
Date: Thu, 23 Jan 2003 00:49:30 GMT
From: "Eric" <me@nosmap.com>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <u_GX9.1898$QV3.192297@news2.west.cox.net>
I'm running IIS on my local host, and assume that IIS has the capability to
run CGI scripts. I'm guessing it's a configuration issue.
I used the following URL to try to get it to execute:
http://localhost/cgi-tests/test1_c.cgi
"Lars Eighner" <eighner@io.com> wrote in message
news:slrnb2uecl.4hh.eighner@dumpster.io.com...
> In our last episode, <rAGX9.1785$QV3.171677@news2.west.cox.net>, the
> lovely and talented Eric broadcast on comp.lang.perl.misc:
>
> > I'm a total newbie to CGI stuff and was trying to replicate a very
simple
> > script I found on a web tutorial. Since I dont have Perl installed, I
tried
> > the sample written in C. When i pointed the browser to it, it displayed
the
> > contents of the script like it was an HTML page instead of trying to run
it.
> > Do you know how to configure IIS to try to execute it?
>
> Your browser cannot execute cgi (unless you have a really
> advanced browser like Lynx, which has lynxcgi).
>
> CGI is executed server-side, which means you must have a
> server (such as Apache) to handle the cgi and serve the
> result.
>
> --
> Lars Eighner -finger for geek code- eighner@io.com
http://www.io.com/~eighner/
> "Shhh! Be vewwy, vewwy quiet! I'm hunting Muswims!"
> - President Elmer Bush
------------------------------
Date: Thu, 23 Jan 2003 02:41:16 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: how to make my perl cgi program run in IE
Message-Id: <1189332.Bq4iJL0xep@nyoga.dubu.de>
Eric wrote:
> 1)create file test1_c.cgi and put it in a virtual directory.
>
> 2) use the following url:http://localhost/cgi-tests/test1_c.cgi
I don't know IIS, but I suppose you have to tell your server that the
files in .../cgi-tests are executable. Consult the documentation for
your web server.
> Here are the contents of the file:
>
> #include <stdio.h>
[...]
C ist not a scripting language, it's a compiled language[1]. If you
want to run this program (whether CGI or not), you must first compile
it.
> "William Alexander Segraves" <wsegrave@mindspring.com> wrote in
> message news:au0352$f6h$2@slb6.atl.mindspring.net...
Please don't top-post.
Please don't full-quote.
Ciao,
Harald
[1] Yes, I know there are C interpreters, but I doubt there is one
built-in in IIS. ;-)
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nicht die Erde ist flach, die Hirne sind es.
-- Hal Faber im Heise Newsticker, 14.01.2001
------------------------------
Date: Thu, 23 Jan 2003 00:17:37 GMT
From: "I'm Dan" <dg1261@cs-REMOVE_THIS-.com>
Subject: Re: identifying web host platform?
Message-Id: <BwGX9.1348$_s4.538@rwcrnsc54>
> I'm Dan <dg1261@cs-REMOVE_THIS-.com> wrote:
> > Some time ago (within the last year or two) I recall tinkering with a
way to
> > reveal the host platform and server of a website
>
> > Does this ring a bell with anyone?
>
"Tad McClellan" <tadmc@augustmail.com> wrote:
> Install the LWP module, then use the HEAD program:
>
> HEAD http://www.perl.org
Thanks! That wasn't what I was remembering, but is very useful to know.
I'll keep that in my notes.
------------------------------
Date: 22 Jan 2003 17:27:47 -0800
From: opensourcedrm@netscape.net (opensourcedrm)
Subject: In the following code snippet, how do I reference a variable?
Message-Id: <607f5a5e.0301221727.4af46519@posting.google.com>
#!/usr/bin/perl
use strict 'vars';
use warnings;
my $VAR1 = [{'0' => 'album04'},{'1' => 'album03'},{'2' =>
'album02'},{'3' => 'album01'}];
How do I reference album04?
$VAR->[{0}] doesn't seem to be working...
Thanks!
------------------------------
Date: Thu, 23 Jan 2003 02:55:10 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: In the following code snippet, how do I reference a variable?
Message-Id: <2416095.AvHzOPoch5@nyoga.dubu.de>
opensourcedrm wrote:
> How do I reference album04?
$VAR1->[0]{0};
See your thread "Getting Values Out of An Object: How Do I Do This?
Thanks!" one hour ago. (Too impatient?)
Ciao,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nothing is fool-proof to a sufficiently talented fool.
------------------------------
Date: 22 Jan 2003 17:34:42 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Is anyone using Perl 6 yet?
Message-Id: <776e0325.0301221734.11df0649@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb2tlcq.7o0.tadmc@magna.augustmail.com>...
> Sara <genericax@hotmail.com> wrote:
>
> > Cheers, I'll heed your warning and stick to 5.6 for now...
>
>
> You should give serious consideration to moving to 5.6.1 (or even 5.8.0).
Tad: wilco, I'll update. I certainly trust your judgement on that one!
-Gx
------------------------------
Date: Thu, 23 Jan 2003 00:09:33 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: OT: I've got wild staring eyes, and I've got a strong urge to fly ...
Message-Id: <3e2f31b5.491882011@news.erols.com>
"Richard Gration" <richard@zync.co.uk> wrote:
: In article <slrnb2tg78.76k.tadmc@magna.augustmail.com>, "Tad McClellan"
: <tadmc@augustmail.com> wrote:
: > Is there anybody in there? Just nod if you can hear me.
:
: Just wondering if the above is a deliberate quote? :-)
Yup.
Pink Floyd cribbed Tad's work.
So did the Beatles.
http://groups.google.com/groups?selm=slrna84jro.dtj.tadmc%40tadmc26.august.net&oe=UTF-8&output=gplain
------------------------------
Date: 22 Jan 2003 15:20:37 -0800
From: sjoseph@micronpc.com (Joseph)
Subject: Perl monitoring tool
Message-Id: <c0bf346e.0301221520.5061efe@posting.google.com>
Hi, I'm looking for some monitoring tools written in PERL to monitor
Oracle database. Basically, it should page/email DBA's in case of any
errors occur on database. Does anyone have any idea about this. If not
I'm planning to write some tool to do the same. Do you have any
resource so that I can get some help.
Please let me know.
Thanks - Joseph
------------------------------
Date: Wed, 22 Jan 2003 23:13:52 GMT
From: "MG" <me@home.com>
Subject: Perl on IIS (run in ASP pages?)
Message-Id: <QAFX9.156643$j8.4096643@twister.tampabay.rr.com>
I know ActiveState perl installs PERLIS.DLL into the components portion of
IIS, I also know that with ASP pages you can specify a language at the
beginning such as <%@ Language="JScript" %>. Is there a perl equivilant so
that I can script perl inside of my web pages? This sounds like a good idea
since I never did like having to code HTML from inside a perl program (I
still use templates whenever I can). Thanks.
- Joe
------------------------------
Date: Wed, 22 Jan 2003 23:40:55 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Please help decoding this perl code.
Message-Id: <3e2f2942.489718387@news.erols.com>
janeaustine50@hotmail.com (Jane Austine) wrote:
: I am reading Object-Oriented Reengineering Patterns. I really enjoy
: this book. On p.177, however, there is a perl code, which is all Greek
: to me. Can anyone here translate it into a pseudo-code or a python/Java
: code(literal translation might do)?
100+ lines of typo-strewn code, for free?
This is not a reasonable request.
clpm readers are willing to help and share knowledge, but they like to
see a modicum of effort from the requestor first. This is just too
close to "do my work for me."
Starting with a Perl tutorial would be a great idea. If you're at all
proficient in another language, picking up Perl should not be a
struggle. You might like it.
If there are specific parts of the code that are confusing (and there
are several less-than-transparant things about that program), you can
ask about them. You're likely to receive a simple reference to the
applicable Perl documentation[1] more often than a full-blown
explanation.
: #! /usr/bin/env perl -w
: #duplocForCPP.pl - detect duplicated lines of code (algorithm only)
: # Synopsis: duplocForCPP.pl filename ...
: # Takes code (or other) files and collects all line numbers of lines
: # equal to each other within these files. The algorithm is linear(in
: # space and time) to the number of lines in input.
[snip]
The author mentions an algorithm. One would expect that he would take
time to explain it. Grasping an algorithm is infinitely more useful
than trying to comprehend it rendered as code.
[1] http://www.perldoc.com, if you don't have Perl installed locally.
------------------------------
Date: 22 Jan 2003 16:39:45 -0800
From: mrennix@totalise.co.uk (Martin)
Subject: Re: Regex to find all words containing a single vowel?
Message-Id: <cb57fb72.0301221639.c922619@posting.google.com>
Bart Lateur <bart.lateur@pandora.be> wrote in message news:<vgqs2v8g2l0ff3iqb2rr8a2mtobleh3d0o@4ax.com>...
> Martin wrote:
>
> >I need to find all words in a file containing only a single vowel.
> >
> >For example:
> >
> >$regex = ????????
> >$string = "The quick brown fox jumped over the lazy dog";
> >$string =~ /$regex/g;
> >
> >should match:
> >
> >The
> >brown
> >fox
> >the
> >lazy
> >dog
>
> So you think "lazy" only has one vowel and "quick" has two? How odd. I
> would have thought the reverse.
Eh? Yes lazy has one vowel (a) and quick has two (ui). What's odd about that?
Are you thinking of syllables?
> Anyway, try this.
>
> /\b((?:(?=[a-z])[^aeiou])*[aeiou](?:(?=[a-z])[^aeiou])*)\b/ig
Yep that works, thanks!
--
Martin
------------------------------
Date: Wed, 22 Jan 2003 20:47:43 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: slow grep
Message-Id: <3E2F49BF.FCB867EE@earthlink.net>
Matija Papec wrote:
[snip]
> sub sub3 {
>
> my @rest = grep {!/^mato/} @arr;
>
> }
Try losing the block around the condition:
my @rest = grep !/^mato/, @arr;
Here's my benchmark of this:
[Windows 95] C:\WINDOWS>perl -MBenchmark=cmpthese
cmpthese( -5, {
a => sub { my @a = grep /5\z/, 0..99; 0 },
b => sub { my @a = grep { /5\z/ } 0..99; 0 },
c => sub { my @a; /5\z/ && push @a, $_ for 0..99; 0 },
} );
__END__
Benchmark: running a, b, c, each for at least 5 CPU seconds...
a: 5 wallclock secs ( 5.06 usr + 0.00 sys = 5.06 CPU) @ 2106.13/s (n=10657)
b: 6 wallclock secs ( 5.06 usr + 0.00 sys = 5.06 CPU) @ 716.01/s (n=3623)
c: 6 wallclock secs ( 6.10 usr + 0.00 sys = 6.10 CPU) @ 1133.11/s (n=6912)
Rate b c a
b 716/s -- -37% -66%
c 1133/s 58% -- -46%
a 2106/s 194% 86% --
So, grep without a block is fastest, then foreach, and in last place comes
grep with a block.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: 22 Jan 2003 16:22:32 -0800
From: clearguy02@yahoo.com (John Smith)
Subject: Re: To extract a specific portion of a text file
Message-Id: <500f84f3.0301221622.60dbc8cf@posting.google.com>
Hi Tad,
Sorry for the typo (in the output). It should have been
------------------------------------------------------
Test Key : test_hello_there
test_log_long_one
test_short_my_song
-----------------------------------------------------
Thanks,
John
------------------------------
Date: 22 Jan 2003 16:36:12 -0800
From: clearguy02@yahoo.com (John Smith)
Subject: Re: To extract a specific portion of a text file
Message-Id: <500f84f3.0301221636.4fbf4566@posting.google.com>
Hi David,
Thanks for your piece of code and your right assumption for my output.
My sincere apolozies to the typos.
It works fine, but still I have another little issue:
I giving my file one more time (extract.txt)
----------------------------------------------------------
Component : Main TestPiece
Language : C++
Creation Date : 20-03-2002
Test Key : test_hello_there
test_log_long_one
test_short_my_song
Code key : test_bob_smith
test_dave_smith
test_harry_smith
How are you doing there?
Copyright (C) Bla bla bla, All Rights Reserved
This software is for only the test purposes.
Test Key : test_hello_howareyou
test_log_hithere
test_hi_my_song
#ifndef TEST_H
#endif
----------------------------------------------------
I have added three new lines here:
Code key : test_bob_smith
test_dave_smith
test_harry_smith
Now when I run your code, I am getting the below output:
---------------------
Test Key : test_hello_there
test_log_long_one
test_short_my_song
test_dave_smith
test_harry_smith
-------------------------------------------------------
I don't want the last two lines, which the values for the Code Key
field. I was trying different ways in oyur piece of code, but in vain.
How could I get the right output with only first "Test KEy" and only
its values.
Thanks in advance,
John
>
> Instead, put:
> #! C:/perl/bin/perl.exe
>
> open (INPUT1, "C:/scripts/extract.txt") or die "Can not open the file:
> $!";
>
> my $found_test_key = 0;
> while (<INPUT1>) {
> last if $found_test_key and /^\s*Test Key/;
> if (/^\s*Test Key/ || /^\s*test_/) {
> $found_test_key++;
> print;
> }
> }
>
> Comments:
> - Replaced use of backslashes in paths with forward slashes. Perl can
> use either backslashes or forward slashes for paths, and forward
> slashes look nicer
> - Switched to not slurp in the whole file at the start of the program,
> but instead only load in one line at a time. This saves considerable
> memory on large files.
> - I added a flag, found_test_key, that is set to true upon first
> occurrence of Test Key. Only the first Test Key is printed out.
> - I added a begin-string anchor to the "Test Key" regex, because it
> looks like that was what you wanted to do. (Presumably I'm fixing a
> typo)
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4451
***************************************