[19021] in Perl-Users-Digest
Perl-Users Digest, Issue: 1216 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 29 06:05:35 2001
Date: Fri, 29 Jun 2001 03:05:08 -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: <993809108-v10-i1216@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 29 Jun 2001 Volume: 10 Number: 1216
Today's topics:
Re: Basic Questions about Locking a DBM <m.grimshaw@salford.ac.uk>
Re: Code Review Needed! <krahnj@acm.org>
diff btw. open("|-") && pipe? was: Re: how can i get th (Thomas Schulze-Velmede)
Re: diff btw. open("|-") && pipe? was: Re: how can i ge <goldbb2@earthlink.net>
Re: Naming a hash ;-) <christoph.neubauer@siemens.at>
Re: Naming a hash <goldbb2@earthlink.net>
Re: Need help again with global vars! (wac)
Odd fork-problem was:Re: how can i get the output of a (Thomas Schulze-Velmede)
Re: Odd fork-problem was:Re: how can i get the output o (Villy Kruse)
Re: Opening files on the Mac? (newbie) <bart.lateur@skynet.be>
Re: Regexp problem (Bernard El-Hagin)
Re: Regexp problem <krahnj@acm.org>
Re: Regexp problem <goldbb2@earthlink.net>
Re: Rename .htm to .html <goldbb2@earthlink.net>
Re: Rename .htm to .html (Bernard El-Hagin)
replacement -- peculiar interpolation <seppo.enarvi@genera.fi>
Re: replacement -- peculiar interpolation <goldbb2@earthlink.net>
small perl cdrom program....help required <fail006@hotmail.com>
Re: turbo perl <hafner-usenet@ze.tu-muenchen.de>
Re: turbo perl <perler@yahoo.com>
Re: turbo perl <perler@yahoo.com>
Re: UPDATE & for loop <goldbb2@earthlink.net>
Re: Where I can find BINMODE, any examples ??? (Joe Smith)
Re: Where I can find BINMODE, any examples ??? <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Jun 2001 10:44:50 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: Basic Questions about Locking a DBM
Message-Id: <3B3C4E12.9CED9334@salford.ac.uk>
dave wrote:
>
> open (DBLOCK, "$db_lock") or bail("Cannot open lock file $db_lock
> $!");
> flock(DBLOCK, LOCK_EX);
>
> #dbmopen, tie, save the world here, but most likely:
> #open something
> #write to it
> #close it
>
> close (DBLOCK) or bail("Can't close size file $db_lock $!");
> flock(DBLOCK, LOCK_UN);
doesn't closing the filehandle DBLOCK implicitly unlock it?
------------------------------
Date: Fri, 29 Jun 2001 08:17:15 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Code Review Needed!
Message-Id: <3B3C39CA.8CBFEE3B@acm.org>
Dave Hoover wrote:
>
> I would greatly appreciate ANY feedback anyone could provide. The
> following page will provide details and a link to download the
> tarball.
>
> http://www.redsquirreldesign.com/soapbox
From Soapbox.pm:
sub getDate {
my $s = shift;
my $type = shift;
my $date;
if ($type =~ /now/i) {
chomp($date = `date`);
my @date = split(/\s+/, $date);
my $day = $date[2];
$date[5] =~ s/\d\d(\d\d)/$1/;
my $year = $date[5];
my %month = (
Jan => "01",
Feb => "02",
Mar => "03",
Apr => "04",
May => "05",
Jun => "06",
Jul => "07",
Aug => "08",
Sep => "09",
Oct => "10",
Nov => "11",
Dec => "12"
);
$date[1] =~ s/^(...)/$month{$1}/;
my $month = $date[1];
return [ $month, $day, $year ];
Replace the previous 22 lines of code with:
my @date = localtime;
return [ $date[4] + 1, $date[3], $date[5] % 100 ];
In Soapbox.pm there are nine times where a file is opened but only once
do you test the return from open!
sub loadSubs {
[snip]
if (@count > 0) {
my $n = @count;
$out .= "<a
href=$s->{config}{soap_web}main.cgi?type=Browse&sub_id=$_->[0]>$_->[1]</a>
($n)<br>";
}
[snip]
An array in scalar context can not have a negative value, it is probably
simpler to combine the two statements.
if (my $n = @count) {
$out .= "<a
href=$s->{config}{soap_web}main.cgi?type=Browse&sub_id=$_->[0]>$_->[1]</a>
($n)<br>";
}
In sub deleteArticle you don't test the return value of unlink.
In sub siteNameUpdate and sub contentUpdate you don't test the return
value of rename.
sub validateInput {
my $s = shift;
my $msg;
$msg = "All fields are required.<br>" unless ($s->{param}{title} &&
$s->{param}{summary} && $s->{param}{keywords});
for (values %{$s->{param}}) {
my $ill_chars = q{()*+=<>;};
my $ok_chars = q{ a-zA-Z0-9\'-\\\.@,\?/\"\!\:};
^^^ ^ ^^ ^^^^^^
if (/([^$ok_chars]|[$ill_chars])/) {
$msg = "Illegal character was submitted: $1.<br>";
last;
}
Why put the character classes in variables when the scope is only three
lines? Some characters are escaped that don't need to be, some that
aren't escaped should be. Or did you really want the the range of
characters "'-\" which includes "()*+,-./0-9;:<=>?@A-Z["?
if ( m{([^ a-zA-Z0-9'\-\\.@,?/"!:]|[()*+=<>;])} ) {
sub convertApos {
for ($s->{param}{title}, $s->{param}{summary},
$s->{param}{keywords}) {
s/\Q'/'\E/g; # Converting apostrophe
^^ ^^
}
}
The "\Q" and "\E" aren't needed and the "\E" is in the wrong place
anyways. (also in sub formatTerms)
John
--
use Perl;
program
fulfillment
------------------------------
Date: 29 Jun 2001 02:12:30 -0700
From: tsv.werbung@web.de (Thomas Schulze-Velmede)
Subject: diff btw. open("|-") && pipe? was: Re: how can i get the output of a forked child?
Message-Id: <227269e2.0106290112.b20885d@posting.google.com>
Hi Ren,
thank you for your help!
One additional question:
In the camel book I found another way to talk to your child:
$pid = open(PIPEHANDLE, "-|");
Is there any difference between using the pipe-command and that
open(.."|-") / open(..."-|")-solution? It seems to be the same.
Best regards
Thomas
------------------------------
Date: Fri, 29 Jun 2001 05:49:18 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: diff btw. open("|-") && pipe? was: Re: how can i get the output of a forked child?
Message-Id: <3B3C4F1E.16DB475C@earthlink.net>
Thomas Schulze-Velmede wrote:
>
> Hi Ren,
>
> thank you for your help!
>
> One additional question:
>
> In the camel book I found another way to talk to your child:
> $pid = open(PIPEHANDLE, "-|");
>
> Is there any difference between using the pipe-command and that
> open(.."|-") / open(..."-|")-solution? It seems to be the same.
No there isn't really much difference between this and an explicit
fork/pipe, but using open is less code, and is easier on the eyes.
Plus, neither parent nor child has to remember to close one end of the
pipe after forking.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 29 Jun 2001 11:19:33 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: Naming a hash ;-)
Message-Id: <3B3C4825.B1A14588@siemens.at>
Just in wrote:
> <snip>
>
> I would really appreciate if someone were to enlighten me.
>
> Thanks
>
> Just (I dont know nuts) in
To get real enlightenment, I'd suppose to try with meditation. ;-)
CN
------------------------------
Date: Fri, 29 Jun 2001 06:13:24 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Naming a hash
Message-Id: <3B3C54C4.BD290F98@earthlink.net>
Just in wrote:
>
> Dear group,
>
> Suppose I was in a loop, and I wanted to push some values into a hash,
> but I wanted the hash to have a different name for each iteration of
> the loop. i.e how can I do this:-
>
> for ($a = 0; $a <= $#SomeArray; $a++)
> {
> # do something to get data here
>
> $NewHash$a{$Var} = $Val;
> }
>
> Obviously this wont work, and variations of the theme (that I have
> attempted), dont work either.
>
> I would really appreciate if someone were to enlighten me.
What you're asing for is how to do symrefs. As mentioned, symrefs are
evil, and another method should be used [eg, a hash of hashes, or an
array of hashes]. However, if you *really* want to know, here's how to
do it:
for my $a ( 0 .. $#SomeArray ) {
${"NewHash$a"}{$Var} = $Val;
}
Note that the above will not work if "use strict" is in your program.
Personally, I would [probably] use an array of hashes instead, though.
for my $a ( 0 .. $#SomeArray ) {
$NewHash[$a]{$Var} = $Val;
}
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: 29 Jun 2001 00:22:59 -0700
From: wac@edge-china.com (wac)
Subject: Re: Need help again with global vars!
Message-Id: <af3e7ca1.0106282322.7cc6478c@posting.google.com>
you can create global vars use this method:
$var:: = $value;
------------------------------
Date: 29 Jun 2001 02:36:38 -0700
From: tsv.werbung@web.de (Thomas Schulze-Velmede)
Subject: Odd fork-problem was:Re: how can i get the output of a forked child?
Message-Id: <227269e2.0106290136.3801656a@posting.google.com>
Hi,
I encountered a problem when trying to execute the code-snippet below
(which is the same as in the refered article). The code wouldn't work
on Solaris boxes. I have executed the script using Perl v5.6.1 built
for sun4-solaris on a Ultra 5. It works fine on my Linux-box.
That problem was also mentioned in a article of 2000/05/17 from
Kenneth Herron (kherron@sgum.mci.com). Does anyone know something
about this problem? Is it a Solaris or a Perl bug? And, especially: Is
there a list of known bugs?
Thanks in advance
Best regards
Thomas
PS: The script, that causes the problem:
> ----------------------------
> #!/bin/perl
> #
> # A full parallel cat...
>
> open (LIST, "<$ARGV[0]") or die "Can't open file";
>
> while(<LIST>){
> if($pid = fork){
> # parent here
> next;
> } elsif (defined $pid){
> # child here
> print;
> exit;
> } else {
> die "Can't fork, father stopped";
> }
> }
> close LIST;
> ----------------------------
------------------------------
Date: 29 Jun 2001 09:48:23 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Odd fork-problem was:Re: how can i get the output of a forked child?
Message-Id: <slrn9jojn7.n0p.vek@pharmnl.ohout.pharmapartners.nl>
On 29 Jun 2001 02:36:38 -0700,
Thomas Schulze-Velmede <tsv.werbung@web.de> wrote:
>Hi,
>
>I encountered a problem when trying to execute the code-snippet below
>(which is the same as in the refered article). The code wouldn't work
>on Solaris boxes. I have executed the script using Perl v5.6.1 built
>for sun4-solaris on a Ultra 5. It works fine on my Linux-box.
>
>That problem was also mentioned in a article of 2000/05/17 from
>Kenneth Herron (kherron@sgum.mci.com). Does anyone know something
>about this problem? Is it a Solaris or a Perl bug? And, especially: Is
>there a list of known bugs?
>
You would need to call wait somewhere, wouldn't you. You may otherwise
run up so many zombies that you can't fork another process.
Villy
------------------------------
Date: Fri, 29 Jun 2001 08:54:25 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Opening files on the Mac? (newbie)
Message-Id: <dueojt0edt38vm0umtpg3tu96jmcgme212@4ax.com>
Steve wrote:
>I have tried every permutation of the following:
>
>require 'StandardFile.pl'; #not sure what this does
It allows you to show a "choose/new file" dialog box (in Applescript
terms), to choose the name of the file.
>open(TEXT,">/Macintosh HD/Applications/PERL/sampledata.txt") || die
>"Couldn't open TEXT.\n";
Display the valmue of $! in your error message.
>resulting in: "# Couldn't open TEXT." (file does exist...)
It's the file directory separator, ":" instead of "/", provided that
"Macintosh HD" is indeed the hard disk name, and no leading colon. All
directories must already exist, trying to open a file will NOT create
them for you.
There must be some info available in the MacPerl help files, but I
forgot where... check the help menu item "Macintosh Specific Features",
that's it. MacPerl comes with a really nice POD reader, Shuck, with a
corncob as an icon (a bit of a poor interpretation of the word "pod"
IMO). You can go through this help menu, for standard podfiles, or put
the cursor on a word in a script window, that you want help with, and
press command-H. And you can open .pod or .pm files directly from within
Shuck.
--
Bart.
------------------------------
Date: Fri, 29 Jun 2001 07:30:59 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Regexp problem
Message-Id: <slrn9job9u.112.bernard.el-hagin@gdndev25.lido-tech>
On Fri, 29 Jun 2001 09:00:05 +0200, Jan Klaverstijn <jan@klaverstijn.nl> wrote:
>Hi all,
>
>This is what looks to me a simple regexp challenge but it drove me crazy.
>I'm clearly a newbie at Perl regexp's. So now I turn to you.
>
>What I want is to extract the date from a mail header line. The "Date:" line
>comes can have an optional timezone at the end. That timezone must be
>stripped, together with the Date: at the beginning.
>
>Date: Mon, 25 Jun 2001 17:56:26 +0200 (CEST)
>
>If the timezone was always there it would be easy: $date = $1 if
>/^Date:\s(.+)\s(\(.+\))/;
>But this fails to match when the timezone is not there.
>
>Date: Mon, 25 Jun 2001 17:56:26 +0200
>
>I thought making the timezonepart optional: (\(.+\))?. No luck.
>
>How should I approach this to make it work with a single regular expression?
s/^Date:\s(.+?)(?:\([^)]+\))?$/$1/;
Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'
------------------------------
Date: Fri, 29 Jun 2001 08:47:38 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Regexp problem
Message-Id: <3B3C40EB.7921976F@acm.org>
Jan Klaverstijn wrote:
>
> This is what looks to me a simple regexp challenge but it drove me crazy.
> I'm clearly a newbie at Perl regexp's. So now I turn to you.
>
> What I want is to extract the date from a mail header line. The "Date:" line
> comes can have an optional timezone at the end. That timezone must be
> stripped, together with the Date: at the beginning.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200 (CEST)
>
> If the timezone was always there it would be easy: $date = $1 if
> /^Date:\s(.+)\s(\(.+\))/;
> But this fails to match when the timezone is not there.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200
>
> I thought making the timezonepart optional: (\(.+\))?. No luck.
>
> How should I approach this to make it work with a single regular expression?
Just extract the parts that you want and ignore the rest.
my ( $dow, $day, $mon, $year, $hour, $min, $sec, $offset ) =
/^Date:\s*(\w+),\s+(\d+)\s+(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+([+-]?\d+)/;
# OR
my $date = /^Date:\s*(\w+,\s+\d+\s+\w+\s+\d+\s+\d+:\d+:\d+\s+[+-]?\d+)/;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 29 Jun 2001 06:07:02 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Regexp problem
Message-Id: <3B3C5346.806F6187@earthlink.net>
Jan Klaverstijn wrote:
>
> Hi all,
>
> This is what looks to me a simple regexp challenge but it drove me
> crazy.
> I'm clearly a newbie at Perl regexp's. So now I turn to you.
>
> What I want is to extract the date from a mail header line. The
> "Date:" line comes can have an optional timezone at the end. That
> timezone must be stripped, together with the Date: at the beginning.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200 (CEST)
>
> If the timezone was always there it would be easy:
> $date = $1 if /^Date:\s(.+)\s(\(.+\))/;
> But this fails to match when the timezone is not there.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200
>
> I thought making the timezonepart optional: (\(.+\))?. No luck.
>
> How should I approach this to make it work with a single regular
> expression?
Your first attempt (with the TZ optional):
$date = $1 if /^Date:\s(.+)\s(\(.+\))?/;
is quite close. You just need to move the \s inside of the second set
of parens:
$date = $1 if /^Date:\s(.+)(\s\(.+\))?/;
This has the unintended side-effect of setting $2, which you migh not
want to happen. So:
$date = $1 if /^Date:\s(.+)(?:\s\(.+\))?/;
Of course, you could shorten this statement even further, by putting the
match into a list context:
($date) = /^Date:\s(.+)(?:\s\(.+\))?/;
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 29 Jun 2001 03:24:31 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Rename .htm to .html
Message-Id: <3B3C2D2F.A3C05E3C@earthlink.net>
Bernard El-Hagin wrote:
[snip]
> foreach my $file (<*.html>){
> $file =~ /(.*).$/;
> rename ($file, $1);
> }
What's wrong with:
/(.*)./s && rename $_, $1 foreach (<*.html>);
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 29 Jun 2001 07:18:52 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Rename .htm to .html
Message-Id: <slrn9joajg.112.bernard.el-hagin@gdndev25.lido-tech>
On Fri, 29 Jun 2001 03:24:31 -0400, Benjamin Goldberg <goldbb2@earthlink.net>
wrote:
>Bernard El-Hagin wrote:
>[snip]
>> foreach my $file (<*.html>){
>> $file =~ /(.*).$/;
>> rename ($file, $1);
>> }
>
>What's wrong with:
>/(.*)./s && rename $_, $1 foreach (<*.html>);
Ummm, like, it's the same thing.
Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'
------------------------------
Date: Fri, 29 Jun 2001 09:23:13 GMT
From: "Seppo Enarvi" <seppo.enarvi@genera.fi>
Subject: replacement -- peculiar interpolation
Message-Id: <5OX_6.3650$8q.161699@news.kpnqwest.fi>
Hello,
I'm trying to understand the interpolation occuring in the replacement
operator.
I have a text file which contains "variables" that need to be replaced with
their appropriate values. The variables resemble Perl variables; that is,
they are simply some text of the form $variable_name.
This is how I naturally (*) would do the thing:
$string = 'a string containing $variable';
$variableName = '$variable';
$variableValue = 123;
$string =~ s/$variableName/$variableValue/g;
However, the script doesn't work; it doesn't replace the variable. I noticed
that the script works if I change the second line to the following:
$variableName = '\$variable';
The assignment in the second line doesn't interpolate the pattern
('$variable'), instead the pattern is treated as a string literal. So it
seems like there occured two recursive interpolations in the s/// operator:
$variableName -> $variable -> ''
Could someone explain me what is happening here? Thank you.
(*) "Naturally": I'm just learning Perl but have some experience on other
languages
Seppo Enarvi
------------------------------
Date: Fri, 29 Jun 2001 05:44:03 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: replacement -- peculiar interpolation
Message-Id: <3B3C4DE3.64755D37@earthlink.net>
Seppo Enarvi wrote:
>
> Hello,
>
> I'm trying to understand the interpolation occuring in the replacement
> operator.
>
> I have a text file which contains "variables" that need to be replaced
> with their appropriate values. The variables resemble Perl variables;
> that is, they are simply some text of the form $variable_name.
>
> This is how I naturally (*) would do the thing:
>
> $string = 'a string containing $variable';
> $variableName = '$variable';
> $variableValue = 123;
> $string =~ s/$variableName/$variableValue/g;
This would be better done as:
$string =~ s/\Q$variableName/$variableValue/g;
However, this still isn't the best way to do it... You can only replace
one at a time like this, and it isn't particularly efficient.
my %variables = (
variable1 => "value1",
variable2 => "value2",
var3 => "val3",
);
my $str = "some string with $var3 $variable2 and $urk_whats_this";
my $vars = join "|", sort {length($b)<=>length($a)} keys %variables;
$str =~ s/\$($str)/$variables{$1}/g;
# produces "some string with val3 value3 and $urk_whats_this";
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 29 Jun 2001 22:12:00 +1200
From: "fail006" <fail006@hotmail.com>
Subject: small perl cdrom program....help required
Message-Id: <9hhjnd$eto$1@lust.ihug.co.nz>
Hi,
I am new to perl. i am trying to write a small script that will eject the
cdrom dirve in Linux and let the use put in the CD and once the cdrom is
closed the script should mount the cdrom drive.
How can make perl know that there was a cdrom inserted.....and than mount
the cdrom dirve....
I would also like to a GUI front end to this....how do i go about this...?
Thanks
------------------------------
Date: 29 Jun 2001 09:17:19 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: turbo perl
Message-Id: <srjels3hi0w.fsf@w3proj1.ze.tu-muenchen.de>
Patrick Erler <perler@yahoo.com> writes:
> unfortunately you deleted the most important line in my posting:
>
> "now, when i sit in front of vi or the built-in editor in midnight
> commander to hack a little script in perl..."
>
> the guy one floor above me in front of his /text mode/ turbo-c has a very
> handy online help system at his fingertips. /that's/ what i miss.
>
> no gnome/kde/windows BIG help system, but just a shortcut from my text mode
> editor to the help files. that's what made it extremely easy for me to
> lern, in these days, no flames please, pascal. ;)
Have you tried Emacs with Cperl Mode and the Perl info files installed?
has all you want: Text based help, debugger, optional syntax hiliting
and indentation, ... It needs some tuning to be useable, though.
The pointer to Cperl mode is posted about once a month in this group. I
don't have it at hand in the moment. I _think_, newer versions of Emacs
come with CPerl mode installed instead of the older Perl-Mode.
Regards
-Walter
------------------------------
Date: Fri, 29 Jun 2001 10:45:05 +0200
From: Patrick Erler <perler@yahoo.com>
Subject: Re: turbo perl
Message-Id: <Xns90CF6D5D6584fuyyehcesyrdx@62.153.159.134>
Walter Hafner <hafner-usenet@ze.tu-muenchen.de> wrote in
news:srjels3hi0w.fsf@w3proj1.ze.tu-muenchen.de:
> Patrick Erler <perler@yahoo.com> writes:
>
>> unfortunately you deleted the most important line in my posting:
>>
>> "now, when i sit in front of vi or the built-in editor in midnight
>> commander to hack a little script in perl..."
>>
>> the guy one floor above me in front of his /text mode/ turbo-c has a
>> very handy online help system at his fingertips. /that's/ what i miss.
>>
>> no gnome/kde/windows BIG help system, but just a shortcut from my text
>> mode editor to the help files. that's what made it extremely easy for
>> me to lern, in these days, no flames please, pascal. ;)
>
>
> Have you tried Emacs with Cperl Mode and the Perl info files installed?
> has all you want: Text based help, debugger, optional syntax hiliting
> and indentation, ... It needs some tuning to be useable, though.
>
> The pointer to Cperl mode is posted about once a month in this group. I
> don't have it at hand in the moment. I _think_, newer versions of Emacs
> come with CPerl mode installed instead of the older Perl-Mode.
i used emacs some time ago (aeh.. 6 years?!) and after some weeks i really
enjoyed it, but spent more time with lisp then with perl ;) (very
interessting too)
i think i'll give it a try after all this time...
--
PAT
vcard/LDAP/PGP: http://dresden-online.com/perler/identity.html
PGP fingerprint: DAC6 2FDA 1ED7 AD55 BD1F 5142 3D5F 72BF
Yahoo-ID: perler - http://jpager.yahoo.com/jpager/messenger.html
------------------------------
Date: Fri, 29 Jun 2001 10:50:31 +0200
From: Patrick Erler <perler@yahoo.com>
Subject: Re: turbo perl
Message-Id: <Xns90CF6E4991F0Afuyyehcesyrdx@62.153.159.134>
rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote in
news:slrn9jo9a9.5fl.rgarciasuarez@rafael.kazibao.net:
> Patrick Erler wrote in comp.lang.perl.misc:
> }
> } the guy one floor above me in front of his /text mode/ turbo-c has a
> very } handy online help system at his fingertips. /that's/ what i
> miss.
>
> You missed perldoc. A /very/ /handy/ /text-mode/ help system.
>
> At the prompt, enter "perldoc perldoc".
i think you all don't get the point... there is a difference between
looking at help pages with less and having a hyperlinked textmode help... i
think you never experienced that kind of comfort you have in borlands
IDEs..
but ok... *rummages for his emacs book...*
regrads,
--
PAT
vcard/LDAP/PGP: http://dresden-online.com/perler/identity.html
PGP fingerprint: DAC6 2FDA 1ED7 AD55 BD1F 5142 3D5F 72BF
Yahoo-ID: perler - http://jpager.yahoo.com/jpager/messenger.html
------------------------------
Date: Fri, 29 Jun 2001 03:32:03 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: UPDATE & for loop
Message-Id: <3B3C2EF3.2CE8ACEC@earthlink.net>
bin wrote:
[snip]
> my $old_park_date = localtime($i);
> my $parkdate = UnixDate(($old_park_date), "%Y-%m-%d");
Is UnixDate something like POSIX::strftime? And why do you have those
extra parens around $old_park_date?
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Fri, 29 Jun 2001 07:56:49 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: Where I can find BINMODE, any examples ???
Message-Id: <9hhcc1$djr$1@nntp1.ba.best.com>
In article <9hbqlr$h9d$3@bob.news.rcn.net>,
Eric Bohlman <ebohlman@omsdev.com> wrote:
>Peter <rig01@yahoo.com> wrote:
>> Where I can find BINMODE, any examples ???
>
>Look up binmode (note the lower case) in the perlfunc document (perldoc -f
>binmode will do that for you).
In case what Eric said is not clear, do this:
1) Open up an MS-DOS window
2) At the "C:\>" prompt, enter "perldoc -f binmode".
or
*) At the Unix command prompt, enter "perldoc -f binmode".
or
*) Click on the appropriate menu item to bring up the on-line docs.
But "perldoc -f binmode" does not have any examples. Bummer.
open IN,"$file.gif" or &die_message("Cannot access file $file.gif - $!\n");
binmode IN; binmode STDOUT; # No-op for UNIX, mandatory for Win32
while (sysread(IN,$_,32*1024)) { print $_; } # Send GIF to browser
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Fri, 29 Jun 2001 06:01:04 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Where I can find BINMODE, any examples ???
Message-Id: <3B3C51E0.920737A9@earthlink.net>
Joe Smith wrote:
[snip]
> open IN,"$file.gif" or &die_message("Cannot access file $file.gif - $!\n");
> binmode IN; binmode STDOUT; # No-op for UNIX, mandatory for Win32
> while (sysread(IN,$_,32*1024)) { print $_; } # Send GIF to browser
Calling a sub with & disables the prototype... is this what you really
want to do? Also, that sysread/print could be coded shorter. Oh, and
you might prefer to use a lexical instead of IN, if you aren't going
to examine the return value of close. And (especially important), you
should be careful when using a variable for a filename with the two
argument version of open... if it contains leading spaces which you
want to keep, or if it contains something that looks like a mode
specifyer (ie, > or >> or |), you may get very much undesired behavior.
{ open( my $in, "<", $file . ".gif" )
or die "Couldn't open $file.gif: $!\n";
binmode $in; binmode STDOUT;
local $/ = \ -s $in;
print scalar <$in>;
undef $/; print <$in>;
} # at end of scope, $in gets closed.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
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 1216
***************************************