[19887] in Perl-Users-Digest
Perl-Users Digest, Issue: 2082 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 7 06:05:36 2001
Date: Wed, 7 Nov 2001 03:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005131109-v10-i2082@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 7 Nov 2001 Volume: 10 Number: 2082
Today's topics:
Re: ActivePearl in Win2k closes window immediately <bart.lateur@skynet.be>
Re: ActivePearl in Win2k closes window immediately (Assaf Lavie)
Calling a script via SSI to access MySQL <chpshi@stonix.com>
Re: Emailing attachments <tintin@snowy.calculus>
Re: File uploading without CGI.pm <tintin@snowy.calculus>
Re: File uploading without CGI.pm <bart.lateur@skynet.be>
HELP ON POSIX EREG (the Harlequin)
Re: Help with simple while loop (Tad McClellan)
Re: Help: simple perl question on Windows <jeff@vpservices.com>
Re: Help: simple perl question on Windows (Eric Bohlman)
Re: Help: simple perl question on Windows (Garry Williams)
Re: How to assign initial value to variable? (Tad McClellan)
Re: is there a function... <mikesl@wrq.com>
Re: is there a function... <bart.lateur@skynet.be>
Re: Long file names and perl. <bart.lateur@skynet.be>
Re: moving files <krahnj@acm.org>
Newbie says thank you to all who posted <robin1@otenet.gr>
Re: Newbie says thank you to all who posted <edgue@web.de>
Re: Newbie says thank you to all who posted <wyzelli@yahoo.com>
Re: NOTICE: Perlfaq updates (Rafael Garcia-Suarez)
Re: Perl modules from a C Program <bnswami@india.hp.com>
Re: Posting manual pages to clpm? <uri@stemsystems.com>
regular expressions <rg@blanktv.com>
Re: regular expressions (Rafael Garcia-Suarez)
Re: Small '-w' Question with Net::POP3 (Eric Bohlman)
some regex magic <anordae@pisem.net>
Re: some regex magic (Rafael Garcia-Suarez)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Nov 2001 09:01:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: ActivePearl in Win2k closes window immediately
Message-Id: <itshut0lpipr897o33nf5vlm92lh3gg56b@4ax.com>
Glen wrote:
>Tried running an ActivePearl script on Windows2000 system.
It's "Perl", not "Pearl". Boy you must be a newbie!
>It seems to open a dos-looking window for a microsecond with the results of
>the pearl script then closes the window.
>I don't know if this is because win2k doesn't use DOS and so doesn't like to
>run DOS like windows but does anybody know how to keep an ActivePearl
>program window up after it is finished running to see the results of your
>script instead of the window disappearing?
Use a smarter text editor than notepad (ugh!), one that allows you to
run external programs and capture their output. That way, you can get
all output in an editor window.
--
Bart.
------------------------------
Date: 7 Nov 2001 01:03:16 -0800
From: assafl@flashnetworks.com (Assaf Lavie)
Subject: Re: ActivePearl in Win2k closes window immediately
Message-Id: <ecc4590e.0111070103.63b902ac@posting.google.com>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message news:<3be85d93@news.victoria.tc.ca>...
> Glen (tara5111@home.com) wrote:
> : Hello,
> : Tried running an ActivePearl script on Windows2000 system.
> : It seems to open a dos-looking window for a microsecond with the results of
> : the pearl script then closes the window.
> : I don't know if this is because win2k doesn't use DOS and so doesn't like to
> : run DOS like windows but does anybody know how to keep an ActivePearl
> : program window up after it is finished running to see the results of your
> : script instead of the window disappearing?
Do this:
Instead of running perl.exe:
perl.exe yourfile.pl
Run it through the cmd.exe with a /k switch:
cmd /k perl.exe yourfile.exe
------------------------------
Date: Wed, 7 Nov 2001 05:21:09 -0500
From: "Alex Shi" <chpshi@stonix.com>
Subject: Calling a script via SSI to access MySQL
Message-Id: <RW7G7.955$NE2.6713@news.eol.ca>
Hi,
I have a script called via ssi from a .sht page. This script is used for
accessing
MySQL. I don't think this script has any problem but the hosting company
disabled it and said it was using a huge amount of system resources. I paste
the script as in below. Please tell me if there's anything wrong with if you
have
any idea. Thanks in advance for all answers.
------------------------- Begin of the
script -------------------------------------
#!/usr/local/bin/perl
use CGI qw/:standard/;
use Mysql;
#Connect to database
$dbhost = 'localhost';
$dbname = 'blahblah';
$dbuser = 'blah';
$dbpass = 'blah';
$dbh = Mysql->connect($dbhost, $dbname, $dbuser, $dbpass);
#Generate html header
print header();
#get mart_id
($one, $mid, $two ) = split( /\//, $ENV{'DOCUMENT_URI'} );
if( $mid eq 'us' ){
$parts = "us_parts";
} else if( $mid eq 'ca' ){
$parts = "ca_parts";
} else if( $mid eq '
$parts = "$mid_parts";
#Create a Statement
$stmt = "Select * from $parts where(op='sp')";
#Execute the Query
$sth = $dbh->query($stmt);
#Predefine html format
$td1 = "<td width=\"50%\" valign=\"top\" align=\"left\">";
$atd = "</td>\n";
$sp1 = "<span class=\"main\">";
$asp = "</span>\n";
$sp2 = "<span class=\"product\">";
#List all the query result
while(@aRow = $sth->fetchrow())
{
print "<tr>\n";
print "$td1$sp1\$$aRow[4]$asp<br>\n";
print "$sp2<b>$aRow[3]</b><br>\n";
print "$aRow[6]<br>\n";
print "[<a href=\"prdinfo.php3?code=$aRow[1]\">Order</a>]$asp";
print $atd;
if(@aRow = $sth->fetchrow()){
print "$td1$sp1\$$aRow[4]$asp<br>\n";
print "$sp2<b>$aRow[3]</b><br>\n";
print "$aRow[6]<br>\n";
print "[<a href=\"prdinfo.php3?code=$aRow[1]\">Order</a>]$asp";
print $atd;
}
print "</tr>\n";
}
exit(0);
------------------------- End of the
script -------------------------------------
Alex
------------------------------
Date: Wed, 7 Nov 2001 18:56:59 +1100
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Emailing attachments
Message-Id: <IN5G7.11$sI6.336983@news.interact.net.au>
"Jamie" <Jamie.Bates@jcu.edu.au> wrote in message
news:2d9d4717.0111061411.69b1247b@posting.google.com...
> Is there any command in specific that will allow you to create a cgi
> script allowing for attachments to be sent via a web based email
> system. I have seen multiple ones where you have to install a program
> for this to happen eg, MIME. But I would just like to be able to edit
> a current script and if necessary add a *.pl or *.pm file.
>
> Any help on this or links to valid web pages would be greatly
> appreciated.
You really are going to make life much easier on yourself if you use
MIME::Lite
It's very simple to install and very simple to use.
------------------------------
Date: Wed, 7 Nov 2001 19:02:54 +1100
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: File uploading without CGI.pm
Message-Id: <eT5G7.12$t56.139401@news.interact.net.au>
"Jason Kelley" <loophole64@home.com> wrote in message
news:9s9q3k$sal$1@news.chorus.net...
> Thanks Joe. If my hosting company doesn't have CGI::Lite installed, can I
> simply upload the module into the directory that my script is in and call
on
> it from there?
FAQ
perldoc -q "own module"
------------------------------
Date: Wed, 07 Nov 2001 09:23:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: File uploading without CGI.pm
Message-Id: <35vhutofgpu9stu28tm0eki04tdqk0igq5@4ax.com>
Jason Kelley wrote:
> If my hosting company doesn't have CGI::Lite installed, can I
>simply upload the module into the directory that my script is in and call on
>it from there?
See the FAQ, perlfaq 8, "perldoc -q lib";
How do I keep my own module/library directory?
How do I add the directory my program lives in to the module/library
search path?
If the module needs not much more of installation than decompression
into a directory iin @INC, then put a directory "lib" into your own home
directory, and add it to your @INC with the "use lib" pragma:
use lib '/home/johndoe/lib';
use CGI::Lite;
--
Bart.
------------------------------
Date: Wed, 07 Nov 2001 10:22:25 GMT
From: mapa2k@softhome.net (the Harlequin)
Subject: HELP ON POSIX EREG
Message-Id: <3be90a16.7619021@News.CIS.DFN.DE>
Hi,
I'm in truble with POSIX EREG,
does someone know if with ereg there's a sintax to obtain the number
of occurencies of a string in an hystack?
Tnx in advance
Bye
--
the Harlequin
-------------------------------------------------------
"scherzando, si può dire tutto, anche la verità"- Freud
visitate http://members.xoom.it/nuvolecarta/
ultimo aggiornamento 3/1/2001
------------------------------
Date: Wed, 07 Nov 2001 05:19:40 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Help with simple while loop
Message-Id: <slrn9uhdi2.d2t.tadmc@tadmc26.august.net>
Rashyid <rra@excite.com> wrote:
> if ($line = ' procs 0'){
>What i need it to do is to
enable warnings and run it again.
>Anybody can help me
^^^^
^^^^ how about an any_thing_? A machine can find your problem.
>here?
perl can help you, but you have to ask for help:
use warnings;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 06 Nov 2001 21:04:02 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help: simple perl question on Windows
Message-Id: <3BE8C0C2.EC39820E@vpservices.com>
Garry Williams wrote:
>
> On 6 Nov 2001 07:00:09 -0800, Araxes Tharsis <pnrmaia@hotmail.com>
> wrote:
>
> > I want to run the following script on Windows 2000, receiving input
> > from the file employees.txt. In UNIX it is:
> > MyScript.pl < employees.txt
[snip of a solution that works but doesn't use redirection]
> You are probably fighting the lame Windows shell. Try bash, if you
> want something sane. (Install Cygwin.)
Windoze is indeed lame. But that is no reason to blame everything that
goes wrong on its lameness. I have a lame car that is out of gas. Why
won't it go anywhere? Getting a non-lame car might help but if I don't
put gas in the new car, it won't go either. There are plenty of people
on this newsgroup (like Bart who already answered this thread) who know
how to make windoze do most everything that needs doing so spraying
nix-centric misinformation is not really much help.
To the OP: redirection like "perl MyScript.pl < employees.txt" works for
me on win98. You might check to see if there are other problems in your
script and/or look at the Windows section of the ActivePerl docs and
some of the past postings on clpm re file globbing and redirection
issues on windoze.
> Enable warnings. Enable strictures.
Agreed.
--
Jeff
------------------------------
Date: 7 Nov 2001 08:23:07 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Help: simple perl question on Windows
Message-Id: <9sar1b$kog$1@bob.news.rcn.net>
Jeff Zucker <jeff@vpservices.com> wrote:
> To the OP: redirection like "perl MyScript.pl < employees.txt" works for
> me on win98. You might check to see if there are other problems in your
And that will also work on NT. But if you set an automagic file
association so that you can run a script by typing its name as if it were
a command (not available in 98/ME), then redirection won't work (just as
it won't if you're executing a batch file in 98/ME). So in this case, I
think it's fair to call the shell lame.
------------------------------
Date: Wed, 07 Nov 2001 10:30:49 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Help: simple perl question on Windows
Message-Id: <slrn9ui3aa.7ps.garry@zfw.zvolve.net>
On Tue, 06 Nov 2001 21:04:02 -0800, Jeff Zucker <jeff@vpservices.com>
wrote:
> Garry Williams wrote:
>>
>> On 6 Nov 2001 07:00:09 -0800, Araxes Tharsis <pnrmaia@hotmail.com>
>> wrote:
>>
>> > I want to run the following script on Windows 2000, receiving input
>> > from the file employees.txt. In UNIX it is:
>> > MyScript.pl < employees.txt
>
> [snip of a solution that works but doesn't use redirection]
>
>> You are probably fighting the lame Windows shell. Try bash, if you
>> want something sane. (Install Cygwin.)
>
> Windoze is indeed lame. But that is no reason to blame everything that
> goes wrong on its lameness.
I can't understand how you can quote my response *and* not read it.
I *didn't* say Windows was lame. That's for someone else to decide.
I said the Windows *shell* was lame. It is. It has been for years.
I gave the OP good advice. Replace the lame Windows shell with a
non-lame shell.
On Windows:
[VFR] d:/garry $ cat > try
#!/usr/bin/perl
use warnings;
use strict;
print while <>;
^Z
[VFR] d:/garry $ ls -l try
-rwxr-xr-x 1 garry other 62 Nov 7 04:47 try*
[VFR] d:/garry $ echo hello world | ./try
hello world
[VFR] d:/garry $ echo hello world > data
[VFR] d:/garry $ ./try < data
hello world
[VFR] d:/garry $
If you're going to use Windows, you don't have to put up with its lame
shell.
> I have a lame car that is out of gas. Why
> won't it go anywhere? Getting a non-lame car might help but if I don't
> put gas in the new car, it won't go either.
So install a decent shell.
> There are plenty of people
> on this newsgroup (like Bart who already answered this thread) who know
> how to make windoze do most everything that needs doing so spraying
> nix-centric misinformation is not really much help.
Is it "spraying misinformation" to suggest another shell?
Maybe you don't consider Cygwin "much help". Others do.
> To the OP: redirection like "perl MyScript.pl < employees.txt" works for
> me on win98.
This does not answer the OP's question.
Although the OP did not describe his problem, he did say that
MyScript.pl < employees.txt
didn't do what he expected. I can assume that he knows what "Bad
command or file name" means and that is *not* his problem. So he
wants to run his script with redirection by using an association
instead of explicitly running the Perl interpreter. You can't do that
with the lame Windows shell. You can with another shell. Another
shell even understands shebang magic and doesn't rely on file
associations.
So my solution, with the lame Windows shell, is to use the while (<>)
magic (instead of <STDIN>) to allow a filename on the command line
instead of trying to use file associations with redirection which the
lame Windows shell won't do.
> You might check to see if there are other problems in your
> script
That is real useful advice.
> and/or look at the Windows section of the ActivePerl docs and
> some of the past postings on clpm re file globbing and redirection
> issues on windoze.
Yes and that will reveal the widely-known lameness of the Windows
shell.
--
Garry Williams
------------------------------
Date: Wed, 07 Nov 2001 05:19:41 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to assign initial value to variable?
Message-Id: <slrn9uhef5.d2t.tadmc@tadmc26.august.net>
spamfree <spamfree@go-away.net> wrote:
>#!/usr/bin/perl -Tw
use strict;
>Use of uninitialized value at
>/home/sites/site13/web/cgi-bin/pre-register/pre-register.pl line 139 (#1)
><cut>
[ something horrid has happened to the formatting of your code.
I hope it doesn't really look like this...
]
>sub check_data{
^
^
That is unbalanced, there's no closing brace below.
> if ($firstname =~ tr/a-zA-Z\n\t //c) {
> $errormessage = "Special characters are forbidden. You used one in the
>firstname field. ";
> &errorpage;
^
^
Do you really want the special argument treatment that you are
asking for when you use an ampersand to call a function?
Probably not, so:
errorpage();
instead.
> exit;
> }
> { $errormessage = 'The FIRSTNAME field is restricted to Max = 50
^
^
Why are you opening a naked block here?
>characters including spaces!' if length $firstname > 50;
> &errorpage;
> exit;
> }
>#The above code checks and displays errormessage + errorpage (EOF)
>#The next checks and displays errorpage only?
^^^^^^^^
Your "next code" is _never_ going to get a chance to execute.
You have above:
if() {
...
errorpage();
exit;
}
if() {
$errormessage = something
}
errorpage();
exit;
# your "next" code here. Control can never get here,
# you just exit()ed!
If both conditions are false, then you will call errorpage
without having first put anything into $errormessage.
>sub errorpage{
>print <<EOF; #Line 139
> Here is the problem: <b>$errormessage</b>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 07 Nov 2001 05:42:02 GMT
From: Michael Slass <mikesl@wrq.com>
Subject: Re: is there a function...
Message-Id: <m3668n9ly2.fsf@thneed.na.wrq.com>
tadmc@augustmail.com (Tad McClellan) writes:
>
> perldoc perlop
>
>--------------------------------------------------------------
>The C</g> modifier specifies global pattern matching--that is,
>matching as many times as possible within the string. How it behaves
>depends on the context. In list context, it returns a list of the
>substrings matched by any capturing parentheses in the regular
>expression.
>--------------------------------------------------------------
>
>
<DING!>
That was the sound of the bulble[1] of comprehension going on over my head.
I got the regexp, but I didn't get the part about returning a list of
each of the captured parenthesized matches.
Thanks for you help.
Footnotes:
[1] bulble: a word coined by Berkeley Breathed (of Bloom
County) for the little light bulb that goes on over a cartoon
character's head when he has an idea.
--
Mike
------------------------------
Date: Wed, 07 Nov 2001 09:08:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: is there a function...
Message-Id: <3cuhutoanmjirslmjcasd4t55pb6n23g7t@4ax.com>
Mark Sidarous wrote:
>is there a function that drops a decimal point all the trailing characters
>from a variable?
Uh... sprintf()?
For example, this will round a number, keeping only 2 decimals:
$var = sprintf "%.2f", 3.1415926;
print $var;
->
3.14
--
Bart.
------------------------------
Date: Wed, 07 Nov 2001 09:11:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Long file names and perl.
Message-Id: <ajuhutop46a6vpj6fql6t3scsenot5oi18@4ax.com>
Andy Ralph wrote:
>I've got a problem with a perl script on windows NT Server (using Apache and
>Tomcat). I get the following error message when attempting to call my Perl
>CGI script from a form (eg, <form action = "FileUpload.cgi"......>):
>
> fileupload.cgi is not executable; cannot translate to a short path name.
>
>It worked on our local server but when uploaded to another (supposedly
>identical) machine, it stopped working.
That's a file permissions (for the server) problem.
>I thought it may be to do with
>windows NT not supporting long filenames properly but it should do!
It does. preferably avoid spaces in the full path, though.
>Or
>maybe the path to the perl executable is too long (#!
>e:/Share/ActivePerl/bin/perl -w).
Nope.
It's most likely a server configuration problem: it refuses to execute
the CGI script.
--
Bart.
------------------------------
Date: Wed, 07 Nov 2001 08:46:35 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: moving files
Message-Id: <3BE8F4EB.2EF98C70@acm.org>
Joe Smith wrote:
>
> In article <jsKF7.77812$ez.10056973@news1.rdc1.nj.home.com>,
> bubba <pmi@iname.com> wrote:
> >I need to write this in perl (part of a larger program)
> >
> >in Bash shell: mv `ls | head -50` ../dir
> >
> >"Move the first 50 files from this directory to another directory
>
> http://www.inwap.com/mybin/?hourly.pl has sample code to do that.
> It runs on Unix and on Win9x.
#!/usr/local/bin/perl5
# Name: backyard/hourly.pl Author: Joe.Smith@inwap.com
08-Sep-2001
No "use warnings", no "use strict"
[snip]
sub move {
local($dir,$hours,$move_to) = @_;
^^^^^
Still using Perl 4?
opendir(DIR,$dir); @imgs = grep(/jpg$|gif$/i,readdir(DIR));
closedir(DIR);
What happens when opendir() fails?
@imgs = grep(!/capture/,@imgs); # Skip capture_t.jpg
If you want to skip capture_t.jpg then why not
grep(!/^capture_t\.jpg$/,@imgs);?
if ($verbose > 1) {
@gifs = grep(/gif/,@imgs); @jpgs = grep(/jpg/,@imgs);
This will include files like "mygiffiles.doc" and "anyjpgimages.xls".
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 7 Nov 2001 11:26:35 -0800
From: "Dynamo" <robin1@otenet.gr>
Subject: Newbie says thank you to all who posted
Message-Id: <9sav360p90@enews3.newsguy.com>
Hi,
Thank you to all who posted in response to "Some very basic questions"
especially those who explained in simplistic terms that a total newbie could
understand. It was suggested by one poster that I should search the NG
before posting and asking such basic questions. To be fair I did, but found
little to help a complete newbie that explained in terminology that I could
understand.
Since I am new to the group I do not wish to upset anybody as I will almost
certainly be posting some more questions in the future (after having read
the documentation :-)). However, I did find it amusing when in reponse to my
question [quote] "Am I correct in saying that activestate perl is an
environment (similar to a shell) that will allow me to write commands using
a simple text editor and execute them at the prompt (similar to dos batch
commands.)?"[unquote],
one responder replied [quote] "No. ActiveState-Perl is just an enhanced perl
distribution. It will bring you the perl binaries and dlls."[unquote], while
another wrote [quote] "Yes (except for the "similar to a shell"
part)."[unquote].
Is it any surprise that people get confused ;-(
And to the responder who asked what is FPE, it is one of the many
abbreviations that I have found for Front Page Extensions.
Once again thanks to you all
Paul Robinson
------------------------------
Date: Wed, 07 Nov 2001 11:05:52 +0100
From: Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
Subject: Re: Newbie says thank you to all who posted
Message-Id: <3BE90780.3537FE22@web.de>
Dynamo wrote:
> Is it any surprise that people get confused ;-(
Well, sometimes it is easier to let the product speak
for itself:
"ActivePerl contains Perl, the Perl Package Manager, (for installing
packages
of CPAN modules), and complete online help.
The Windows version of ActivePerl also includes Perl for ISAPI and
PerlScript."
quoted from the related HTML documentation.
------------------------------
Date: Wed, 7 Nov 2001 20:25:19 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Newbie says thank you to all who posted
Message-Id: <UZ7G7.8$et6.427@vicpull1.telstra.net>
"Dynamo" <robin1@otenet.gr> wrote in message
news:9sav360p90@enews3.newsguy.com...
> Hi,
>
> Thank you to all who posted in response to "Some very basic questions"
> especially those who explained in simplistic terms that a total newbie
could
> understand. It was suggested by one poster that I should search the NG
> before posting and asking such basic questions. To be fair I did, but
found
> little to help a complete newbie that explained in terminology that I
could
> understand.
>
> Since I am new to the group I do not wish to upset anybody as I will
almost
> certainly be posting some more questions in the future (after having read
> the documentation :-)). However, I did find it amusing when in reponse to
my
> question [quote] "Am I correct in saying that activestate perl is an
> environment (similar to a shell) that will allow me to write commands
using
> a simple text editor and execute them at the prompt (similar to dos batch
> commands.)?"[unquote],
> one responder replied [quote] "No. ActiveState-Perl is just an enhanced
perl
> distribution. It will bring you the perl binaries and dlls."[unquote],
while
> another wrote [quote] "Yes (except for the "similar to a shell"
> part)."[unquote].
>
> Is it any surprise that people get confused ;-(
No, in fact in much computer and technical documentation, prior knowledge is
often assumed, with no reference on where to get that which is lacking.
Perl is a programming language.
perl.exe is the executable part that performs the interpreting and running
of Perl programs, which are text files.
Perl is distributed under the Artistic License, usually as source code which
needs to compiled before use (C compiler). This is common practice in the
Open source / Unix / Linux environment.
Activestate distribute a pre-compiled (binary) distribution of perl.exe
which is designed for Windows (hence the dll's). They also make one for
Linux.
Perl programs are simple or complex text files which are parsed by the perl
interpreter (not entirely technically true - Check the FAQ for details) and
then run. On Unix/Linux the first line of the program starts with
#!/usr/bin/perl (called a shebang) which tells the operating system (shell)
what interpreter (and where to find it) to use to 'run' the current file.
This can also be used to run 'shell scripts' and other files. On Windows
(With some exceptions) the file extension (.pl) tells the operating system
what program to use to load the current file.
www.perl.com is a good starting point for getting information about Perl, as
is browsing this Newsgroup.
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: 7 Nov 2001 09:03:49 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: NOTICE: Perlfaq updates
Message-Id: <slrn9uhu8i.5gp.rgarciasuarez@rafael.kazibao.net>
Uri Guttman wrote in comp.lang.perl.misc:
>
> thanx for the FAQ bot and for editing it with the feedback and
> such. will this updated version be the one to go into 5.8?
Yes, Jarkko is periodically importing the perlfaq pods from CVS into the
development tree. That's why you may find notes about Perl 5.8.0 in the
posts from the faqbot.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
You can't trust code that you did not totally create yourself.
-- Ken Thompson, http://www.acm.org/classics/sep95/
------------------------------
Date: Wed, 7 Nov 2001 10:40:09 +0530
From: "swami" <bnswami@india.hp.com>
Subject: Re: Perl modules from a C Program
Message-Id: <9safj6$ir5$1@web1.cup.hp.com>
thanks that works
--
Best Regards-
Swami
-
"Eduardo Oliveros" <eod_spam@yahoo.es> wrote in message
news:3BE7B51E.937F7889@yahoo.es...
> why not:
>
> #include <stdlib.h>
>
> int system(const char *string);
>
> --edu
>
> "Narayanaswami B." wrote:
>
> > Hi,Can anyone give me some ideas on how to call perl modules ( or how
> > toexecute a perl script ) from a c program with some cmd line
> > arguments to the perl script?Thanks in advance--
> > Best Regards-
> > Swami
> > -
>
------------------------------
Date: Wed, 07 Nov 2001 05:09:26 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Posting manual pages to clpm?
Message-Id: <x7vggntbd2.fsf@home.sysarch.com>
>>>>> "CF" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:
CF> What does everyone think about posting sections from the core manual
CF> pages?
CF> My thought is to post a section of the manual page once every 12
CF> hours or so. A "section" might be the doc for one of the functions,
CF> or an operator. The goal is two fold. First is to get these things
CF> out there so that programmers have an opportunity to trip over
CF> interesting features that they did not know about. Second is to
CF> allow the gurus to comment on the accuracy and clarity of the prose
CF> and code. Comments could be used by the documentation project to
CF> improve the core manual.
overall i like the idea but some perldoc sections are enormous. the
functions could be autoposted like the FAQ is. how would you break up
sections like perlsyn? some like perlvar could be broken into smaller
chunks fairly easily.
some sections are too esoteric to post such as perlguts. others like
perldiag make no sense to post.
just musing,
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 07 Nov 2001 08:07:35 GMT
From: rg <rg@blanktv.com>
Subject: regular expressions
Message-Id: <3BE8EAE0.9B8637D7@blanktv.com>
hi,
i'm new to perl and regular expressions.
i was wondering if anybody could help me with the following.
i need to extract only the email addresses from a large document that
has many
other characters.
also, how do you choose only the phrases in quotation marks from a
document
with many such phrases such as:
"this is a test"
"going - all"
"....was wondering *"
thanks for any help.
------------------------------
Date: 7 Nov 2001 08:52:58 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: regular expressions
Message-Id: <slrn9uhtk7.5gp.rgarciasuarez@rafael.kazibao.net>
rg wrote in comp.lang.perl.misc:
>
> i need to extract only the email addresses from a large document that
> has many
> other characters.
A regular expression can't recognize properly email addresses. See in
perlfaq9 : "How do I check a valid mail address?"
There's a module on CPAN to extract email addresses from a text :
Email::Find. You should use it.
> also, how do you choose only the phrases in quotation marks from a
> document
> with many such phrases such as:
>
> "this is a test"
> "going - all"
> "....was wondering *"
There's on CPAN several modules that can help you for this task as well.
Take a look on Text::ParseWords. However you didn't describe your
problem very well, so it's difficult to help you...
For a simple thing : the following code snippet
$s = q/abc"def"ghi"jlk"foo/;
@y = $s =~ /"[^"]*"/g;
print"@y";
outputs
"def" "jlk"
Look at the perlre and perlop manpages for the points you don't
understand about this code.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 7 Nov 2001 08:29:14 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Small '-w' Question with Net::POP3
Message-Id: <9sarcq$kog$2@bob.news.rcn.net>
Mike Mackay [Ultrafusion] <newsgroup_mike@ultrafusion.co.uk> wrote:
> Yes that is my real code, in regards to the mailserver not being quoted, I
> made a typo while posting the code to the NG and changing the real values.
> Sorry I didn't spot that.
YM "Sorry I tried to retype my code rather than cutting and pasting it
into my post." Retyping often introduces spurious bugs and, due to the
phenomenon called "psychological set," sometimes hides real bugs (you end
up typing what the code should be rather than what it actually is).
> Yes, for some reason when I enable to warnings on the shebang line and the
> password is incorrect I get an 'Error 500' in the browser. When I remove
> the -w switch and enter an incorrect password, it says my custom error
> message in the browser.
That suggests that perl is issuing a warning before you've output the
appropriate headers, and your server is getting confused.
------------------------------
Date: Wed, 07 Nov 2001 10:32:51 +0300
From: Balance Keeper <anordae@pisem.net>
Subject: some regex magic
Message-Id: <3BE8E3A3.D7F27616@pisem.net>
There is a string in HTML file:
<b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
too!</i></b>
and we want to extract _all_ words, that are bold and italic
simultaneously.
It is an example from Perl Cookbook, but the regex in it doesn't work
properly.
Maybe somebody can help me with this.
--
Temel Nosce
------------------------------
Date: 7 Nov 2001 08:29:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: some regex magic
Message-Id: <slrn9uhs84.5gp.rgarciasuarez@rafael.kazibao.net>
Balance Keeper wrote in comp.lang.perl.misc:
> There is a string in HTML file:
> <b><i>this</i> and <i>that</i> are important.</b> Oh, <b><i>me
> too!</i></b>
>
> and we want to extract _all_ words, that are bold and italic
> simultaneously.
A regular expression will not be sufficent. Look at the HTML::Parser
module on CPAN.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
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 2082
***************************************