[12323] in Perl-Users-Digest
Perl-Users Digest, Issue: 5923 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 8 16:07:25 1999
Date: Tue, 8 Jun 99 13:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 8 Jun 1999 Volume: 8 Number: 5923
Today's topics:
Re: awk history - 1 based indexing (Andrew Allen)
Binary File Uploading <dfs@thegrid.net>
C to Perl program? <rp5280@email.sps.mot.com>
CGI Problem Fixed!: use cgi qw(param); unrecognized swi aaron@preation.com
Re: CGI.pm & submit butt...ons <raj.dutt@voxel.net>
Re: Creating an external config file. How ? <raj.dutt@voxel.net>
Re: Current Directory Name RABM@prodigy.net
Re: Current Directory Name <rootbeer@redcat.com>
Re: Current Directory Name (Matthew Bafford)
extensions, XS, Fortran (Darwin O.V. Alonso)
Extracting form fields (HTML::Parser), then printing th (Jamie Jackson)
Re: Extracting form fields (HTML::Parser), then printin <rootbeer@redcat.com>
Re: Extracting form fields (HTML::Parser), then printin (Jamie Jackson)
Re: Help using Win32::Shortcut <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Help with protect.pl, pleeeease! (Pedro Couto e Santos)
help!! perl script doesn't work <jhwang2@nortelnetworks.com>
help!! <jhwang2@nortelnetworks.com>
Re: How to use <!--exec to pass arguments in cgi ? <raj.dutt@voxel.net>
if statemetn with system function (EXCHANGE:SKY:6S34)
Re: Interesting Update <perlguy@technologist.com>
Re: Interesting Update <raj.dutt@voxel.net>
Killing parent subroutines <mdw190@psu.edu>
Re: Killing parent subroutines <rootbeer@redcat.com>
Re: NET::Domain NET::SMTP (Brian Pontz)
Re: Perl "constructors" <jdporter@min.net>
Re: Perl "constructors" <jdporter@min.net>
Re: Perl on win32 <Mike.McKinlay@hboc.com>
Re: Perl on win32 <Allan@due.net>
Re: Perl Sucks! <upsetter@ziplink.net>
Re: Perl Sucks! <revjack@radix.net>
Re: Q: a simple search and replace <upsetter@ziplink.net>
Recursive Search-And-Replace wired2000@my-deja.com
Re: Recursive Search-And-Replace michc@my-deja.com
Sockets help: data gets lost <caa@strata-group.com>
Re: Using a hash slice with references? (Greg Bacon)
Re: Using a hash slice with references? (Andrew Allen)
Re: Using string variable as name of subroutine to call (Andrew Allen)
website rating perl script?? hotister@my-deja.com
Re: Why doesn't this work: open(STDOUT, "| tee >>$file" <inca@incaic.engr.sgi.com>
Re: Will future releases of Perl be rewritten in C++? <raj.dutt@voxel.net>
XS: newSVpv() and malloc (Elf Sternberg)
Re: XS: Overriding errno? (Elf Sternberg)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Jun 1999 19:14:41 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: awk history - 1 based indexing
Message-Id: <7jjq31$gko$2@fcnews.fc.hp.com>
Jim Monty (monty@primenet.com) wrote:
: As of Perl 5, assignment to ``$['' is treated as a compiler
: directive, and cannot influence the behavior of any other
: file. Its use is discouraged.
: It might be instructive to know why "[i]ts use is discouraged" by
: the author of the man page (probably Tom Christiansen).
I'm not tomc, but I'd guess that it's because it's global, evil, and
insidious. The same effect can be emulated in a neat happy fun modular
way using tied arrays.
Andrew
------------------------------
Date: Tue, 08 Jun 1999 19:54:21 GMT
From: "Capt. Ry" <dfs@thegrid.net>
Subject: Binary File Uploading
Message-Id: <01beb1e9$8ae65600$c730a2d1@ryano-ke>
Hello Group,
I am trying to create a binary upload script using CGI.pm I have tried to
follow the doc files for CGI.pm but I am running into a 500 internal error.
My uploaded file is created on my server, but no information is read into
it. So I get a file name with 0 kb ??
sub print_results{
open (NEWPIC,">../submits/$file_name");
|| die "Unable to create or open file:$!";
while(read($file_name,$data,1024)){
print NEWPIC $data;
}
close(NEWPIC);
}
I know I am missing something here I just can't figure it out! My directory
permissions are set right and I have gone though the idiot's guide so I am
hoping someone here can point out my error.
Thanks,
Ryan
------------------------------
Date: Tue, 08 Jun 1999 10:54:05 -0700
From: Mike Garcia <rp5280@email.sps.mot.com>
Subject: C to Perl program?
Message-Id: <375D58B5.9E92D303@email.sps.mot.com>
Hello,
I'm trying to convert a current C program into Perl code. I have the C
source, but I must convert it to Perl. Are there any nifty programs on
the market that can do this?
Thanks for your time,
Mike
------------------------------
Date: Tue, 08 Jun 1999 18:27:01 GMT
From: aaron@preation.com
Subject: CGI Problem Fixed!: use cgi qw(param); unrecognized switch
Message-Id: <7jjn98$sg0$1@nnrp1.deja.com>
In article <7ji8kf$bdp$1@nnrp1.deja.com>,
aaron@preation.com wrote:
>
>
> My Web Server Tells me "Unrecognized switch:" in the error log when I run
> a script. It says the error is caused by the following line:
>
> use CGI qw(param);
>
> I only know to use this line to get the info from a form that was
> submitted. When I take it out, everything else works fine, just the
> values I am trying to pass don't come through. How else can I get the
> values through, what should I call to make this work?
>
> Thanks for your help!
>
> Aaron
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Thanks to everyone who helped on this!
I got it to work and expanded it some with the new Perl stuff I am
learning. If you want to see a final result of this go to <http://
www.preation.com/Sender.html> and try it out. Yes, very basic but it
works! Try leaving one of the boxes blank and seeing what happens when
you hit submit it!
Here's the new corrected parts!
I am now using
use CGI qw(:standard)
and then using
$favorite = param('flavor')
$name = param('person')
to get the values that I need. It checks to see if the scalars hold a
value and then it constructs an appropriate sentence with the outcome in
the rest of the script.
Great thanks again!
Sincerely,
Aaron
aaron@preation.com
http://www.preation.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 08 Jun 1999 06:27:22 +0800
From: Raj Dutt <raj.dutt@voxel.net>
Subject: Re: CGI.pm & submit butt...ons
Message-Id: <375C474A.7DD6BD34@voxel.net>
> sub moveon { ## does not happen, get error message instead
> if $submit eq "send"
> sendentry();
> else if $submit eq "change"
> createform();
> }
That's syntactically incorrect. Must have braces [{,}] around all
conditional statements (or loops).
Also be aware of the differenec between else if and elsif
> if (param())
> reflectdata();
> else
> createform();
Same problem as above.
Regards,
--
____________________________________________________________
Raj Dutt Voxel Dot Net, Inc
Network Administrator info@voxel.net
raj.dutt@voxel.net http://hosting.voxel.net
------------------------------
Date: Tue, 08 Jun 1999 07:45:27 +0800
From: Raj Dutt <raj.dutt@voxel.net>
Subject: Re: Creating an external config file. How ?
Message-Id: <375C5997.8C939E14@voxel.net>
Hi Greg,
My perl is still a bit iffy, but i'll give it a go.. hope this helps..
open(INFILE,"configfile.cfg");
@config_data = INFILE;
foreach $line (@config_data) {
chomp($line);
if ($line ~= /^#/) next;
($p1,$p2) = split(/ /,$line);
$config_values{$p1} = $p2;
}
The data will be stored in $config_values in a hash table
$config_values{key} = value
Comments from all about my code would be greatly appreciated.
As you can probably see i've come from a C background but have had to
pick up perl quickly for a variety of projects.
Warm Regards,
--
____________________________________________________________
Raj Dutt Voxel Dot Net, Inc
Network Administrator info@voxel.net
raj.dutt@voxel.net http://hosting.voxel.net
------------------------------
Date: 08 Jun 1999 14:35:48 -0400
From: RABM@prodigy.net
Subject: Re: Current Directory Name
Message-Id: <uu2sileuz.fsf@prodigy.net>
>>>>> "Donny" == Donny Simonton <donsimon@bellsouth.net> writes:
Donny> What's the easiest way to get the current directory name, but not the path.
Donny> For example, if you are in the PROGRAMS directory, I need to get just the
Donny> name of the directory, and not /home/sites/blabla/programs.
Donny> Any suggestions?
Donny> Donny
use Cwd;
my( $dir ) = reverse split( '/', cwd);
--
Vinny Murphy
perl -e '$_=1;(1x$_) !~ /^(11+)\1+$/ && push(@a,$_) while $_++ < 38;print pack qq(cccc),$a[0]*$a[-1],$a[2]*$a[-7],$a[2]*($a[0]**(($a[5]-$a[2])/$a[0])),(($a[1]**$a[0])*($a[0]**$a[1])), qq(\n)'
------------------------------
Date: Tue, 8 Jun 1999 11:41:51 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Current Directory Name
Message-Id: <Pine.GSO.4.02A.9906081137390.26349-100000@user2.teleport.com>
On Tue, 8 Jun 1999, Donny Simonton wrote:
> What's the easiest way to get the current directory name, but not the
> path.
my $name = '.'; # Like that? :-)
> For example, if you are in the PROGRAMS directory, I need to get just
> the name of the directory, and not /home/sites/blabla/programs.
Of course, there may be more than one name for a directory.
/foo/bar/programs may really be a symbolic link to /baz/bar/boomerang. But
I'd guess that you probably want the Cwd module, probably in collaboration
with File::Basename. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 08 Jun 1999 19:07:34 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Current Directory Name
Message-Id: <slrn7lqpbm.38b.dragons@dragons.duesouth.net>
On Tue, 8 Jun 1999 12:25:04 -0500, Donny Simonton <donsimon@bellsouth.net>
tore up a newspaper, using the letters on the pages to write the following:
: What's the easiest way to get the current directory name, but not the path.
:
: For example, if you are in the PROGRAMS directory, I need to get just the
: name of the directory, and not /home/sites/blabla/programs.
use Cwd;
It's standard equipment, too.
: Any suggestions?
HTH,
: Donny
--Matthew
------------------------------
Date: 8 Jun 1999 18:55:20 GMT
From: dalonso@u.washington.edu (Darwin O.V. Alonso)
Subject: extensions, XS, Fortran
Message-Id: <7jjouo$foa$1@nntp6.u.washington.edu>
I've just run through the first tutorial generated by h2xs, and I
see how I would generate extensions written in C.
How does one incorporate Fortran source code?
Thanks
Darwin
dalonso@u.washington.edu
------------------------------
Date: Tue, 08 Jun 1999 18:05:32 GMT
From: wasteNOSPAMbasket@bigfoot.com (Jamie Jackson)
Subject: Extracting form fields (HTML::Parser), then printing them?
Message-Id: <375d5821.69214995@news.erols.com>
Anyone have any sample code that'll illustrate how to slurp form
fields (<form>,<input>,</form>), then print them?
I've got all the HTML::Parser docs here, if you want to refer to them.
(I'm having a hard time understanding the perldocs).
Many thanks,
Jamie Jackson
------------------------------
Date: Tue, 8 Jun 1999 12:05:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Extracting form fields (HTML::Parser), then printing them?
Message-Id: <Pine.GSO.4.02A.9906081142360.26349-100000@user2.teleport.com>
On Tue, 8 Jun 1999, Jamie Jackson wrote:
> Anyone have any sample code that'll illustrate how to slurp form
> fields (<form>,<input>,</form>), then print them?
>
> I've got all the HTML::Parser docs here, if you want to refer to them.
> (I'm having a hard time understanding the perldocs).
Well, you'll need to subclass HTML::Parser. Do you understand subclassing?
You may need to start by learning about OOP. :-(
But see whether my example program (following) does anything for you.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
#!/usr/bin/perl -w
use strict;
use HTML::Parser;
{
package FormParser;
use vars qw/ @ISA /;
@ISA = 'HTML::Parser';
# This is the subclass. What makes it different from the default
# (which does nothing)? This one prints forms, and it turns
# tags into markers which look like <<A>> and <</A>>.
my $in_form; # True whenever we're in a form
sub start {
my($self, $tag) = @_;
if ($tag eq 'form') {
$in_form = 1;
};
if ($in_form) {
print "\U<<$tag>>";
}
}
sub end {
my($self, $tag) = @_;
if ($in_form) {
print "\U<</$tag>>";
}
if ($tag eq 'form') {
$in_form = 0;
print "\n\n";
};
}
sub text {
my($self, $text) = @_;
print $text if $in_form;
}
}
my $p = new FormParser;
for (@ARGV) {
$p->parse_file($_);
}
__END__
------------------------------
Date: Tue, 08 Jun 1999 19:38:59 GMT
From: wasteNOSPAMbasket@bigfoot.com (Jamie Jackson)
Subject: Re: Extracting form fields (HTML::Parser), then printing them?
Message-Id: <375d6f32.75119796@news.erols.com>
>Well, you'll need to subclass HTML::Parser. Do you understand subclassing?
No!
>You may need to start by learning about OOP. :-(
Oh no! :-0
Can you suggest a resource for familiarization with OOP?
(object oriented programming? -- is that what that stood for?)
>But see whether my example program (following) does anything for you.
I will do that too, thank you very much.
Jamie Jackson
------------------------------
Date: Tue, 8 Jun 1999 11:39:08 -0700
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Help using Win32::Shortcut
Message-Id: <rnd73.185$tU2.4811@news2.giganews.com>
UUCP wrote in message ...
>Does anyone have any useful examples showing how to properly use
>the Win32::Shortcut module? I've been banging my head against the
>wall trying to get it working with no luck. . .
# Example 4.11. Altering all shortcuts to point to a new path.
# ----------------------------------------
# From "Win32 Perl Programming: The Standard Extensions" by Dave Roth
# Published by Macmillan Technical Publishing.
# ISBN # 1-57870-067-1
print<<EOT;
WARNING: This will modify shortcut files!!!!
This could render an application or the OS inoperable.
You may want to change the script such that it does not make
undesired modifications.
We are now aborting. Modify this script by removing the exit()
command to actually perform this action.
Hit enter to continue...
EOT
<>;
use Win32::Shortcut;
$User = Win32::LoginName();
$Dir = "$ENV{'SystemRoot'}\\profiles\\$User";
%Path = (
old => "G:\\DOCS",
new => "S:\\DOCS"
);
# Let's escape our backslashes in the %Path hash since
# we will be using the values in a regex.
map { $Path{$_} =~ s/\\/\\\\/g; } keys( %Path );
#
# The meat of the script
#
$Shortcut = new Win32::Shortcut || die "Unable to create a shortcut
object.";
ProcessDir($Dir);
$Shortcut->Close();
print "Total shortcuts checked: $Total{checked}\n";
print "Total shortcuts changed: $Total{changed}\n";
#
# ProcessDir() walks through a directory processing shortcuts
# and recursively calling ProcessDir() for other directories
#
sub ProcessDir
{
my( $Dir ) = @_;
my( @Dirs, @List, $File );
print "\nDIR: $Dir\n";
if( opendir( DIR, $Dir ) )
{
@List = readdir( DIR );
closedir( DIR );
foreach $File ( @List )
{
next if ( $File eq "." || $File eq ".." );
push( @Dirs, $File ) if ( -d "$Dir\\$File" );
ProcessShortcut( "$Dir\\$File" ) if ( $File =~ /\.lnk$/i );
}
foreach $File ( @Dirs )
{
ProcessDir( "$Dir\\$File" );
}
}
}
#
# ProcessShortcut() processes the shortcut file. If it has a path
# pointing to the the old path, change it to the new path.
#
sub ProcessShortcut
{
my( $File ) = @_;
my( $Path, $Name );
$Total{checked}++;
if( $Shortcut->Load( $File ) )
{
( $Name ) = ( $File =~ /([^\\]*)\.lnk$/i );
print "\t$Name\n";
$Path = $Shortcut->Path();
if( $Path =~ s/^($Path{old})/$Path{new}/i )
{
$Shortcut->Path( $Path );
$Shortcut->Save();
$Total{changed}++;
print " ***\t\t^^^ Changed ^^^\n";
}
}
}
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
<rothd at roth dot net> the illusion of integrity
http://www.roth.net
Win32, Perl, C++, ODBC, Training
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: Tue, 08 Jun 1999 18:35:54 GMT
From: solo@esoterica.pt (Pedro Couto e Santos)
Subject: Help with protect.pl, pleeeease!
Message-Id: <928870711.716896@gorgoroth.esoterica.pt>
Hi, I'm using Protect.pl to protect a certain number of html pages on
my site. It's all working fine, except for anchors. If I have a
protected HTML page with internal anchors, they won't work and will
simply link me to my homepage. Any ideia if this is a known innability
to deal with anchors by protect.pl?
Thanks in advance
Pedro Couto e Santos
pedro@nitrodesign.com
www.nitrodesign.com
------------------------------
Date: Tue, 08 Jun 1999 15:37:39 -0400
From: Jessica Hwang <jhwang2@nortelnetworks.com>
Subject: help!! perl script doesn't work
Message-Id: <375D7103.6A2F93D8@nortelnetworks.com>
A)I tried to install a perl script downloaded from the web in an NT
machine with IIS running. I'm getting "%1 is not a valid Windows NT
application." What does this mean?
Other perl scripts are working on this machine just fine, just not this.
I have a .pm file, with NT running IIS. Is this causing a problem?
B)
And I tried it on unix and I'm getting:
"Server Error
This error may have been caused by an incorrectly written CGI script or
a server configuration error. Please verify any scripts before phoning
the hotline. "
i made my own cgi-bin on unix so what permissions must be set ?
rwx on owner, user, and group?
------------------------------
Date: Tue, 08 Jun 1999 15:32:59 -0400
From: Jessica Hwang <jhwang2@nortelnetworks.com>
Subject: help!!
Message-Id: <375D6FEB.4CC500F0@nortelnetworks.com>
A)I tried to install a perl script downloaded from the web in an NT
machine with IIS running. I'm getting "%1 is not a valid Windows NT
application." What does this mean?
Other perl scripts are working on this machine just fine, just not this.
I have a .pm file, with NT running IIS. Is this causing a problem?
B)
And I tried it on unix and I'm getting:
"Server Error
This error may have been caused by an incorrectly written CGI script or
a server configuration error. Please verify any scripts before phoning
the hotline. "
i made my own cgi-bin on unix so what permissions must be set ?
rwx on owner, user, and group?
------------------------------
Date: Tue, 08 Jun 1999 07:52:28 +0800
From: Raj Dutt <raj.dutt@voxel.net>
To: smgpage@hotmail.com
Subject: Re: How to use <!--exec to pass arguments in cgi ?
Message-Id: <375C5B3C.38850114@voxel.net>
The problem lies with configuration (or lack thereof) of SSI, not perl.
smgpage@hotmail.com wrote:
>
> Dear Expert !
> I head is broken into two now after testing the whole nite and I
> need your help now !How to pass arguments in the TAG
> <!-- exec cgi="/cgi-bin/action.pl --> ???
>
--
____________________________________________________________
Raj Dutt Voxel Dot Net, Inc
Network Administrator info@voxel.net
raj.dutt@voxel.net http://hosting.voxel.net
------------------------------
Date: Tue, 08 Jun 1999 15:47:32 -0400
From: "Khan, Fatima (EXCHANGE:SKY:6S34)" <gsoamst@americasm01.nt.com>
Subject: if statemetn with system function
Message-Id: <375D7354.10419250@americasm01.nt.com>
Hello..
I am trying to get my script to run a program located on my system. If
it fails, I'd like my script to do some things.
What I'm doing basically is :
if (system(program_name)) {
statement;
.....
}
Basically, the block should execute only if the program failed to exit
properly i.e. not with an exit code of '0'. But its not working.
for eg, if I wanted to execute the command 'who'.
system (who) should return '0' if it executed properly. otherwise the
if statement returns true adn the block is executed. Instead I'm
getting the list of all the users on the system i.e. as if I invoked
'who' (using backticks).
------------------------------
Date: Tue, 08 Jun 1999 13:29:48 -0500
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Interesting Update
Message-Id: <375D611C.AC7F1D44@technologist.com>
what does your web server log file tell you? You might find a clue in
there.
Brent
Raj wrote:
>
> * My CGI/Perl script shoud update a textfile eliminating
> duplicate rows(lines)
> * I'm trying to delete an "a.ext" file thru the system command
> System("rm $filename.ext");
> from within my script.
> but the file is not getting deleted. Any clue?
>
> Thanx in Advance.
> Regards,
> Raj
> technology@workmail.com
------------------------------
Date: Tue, 08 Jun 1999 07:48:44 +0800
From: Raj Dutt <raj.dutt@voxel.net>
To: Raj <technology@workmail.com>
Subject: Re: Interesting Update
Message-Id: <375C5A5C.AF52645F@voxel.net>
> * I'm trying to delete an "a.ext" file thru the system command
> System("rm $filename.ext");
> from within my script.
> but the file is not getting deleted. Any clue?
Could be a variety of things.
1. Are you sure you've got your permissions right?
2. Look into using unlink() instead of a system() call
Also, I'm not positive on how you've done $filename.ext
You might have to do something like "$filename".".ext", although I'm not
sure..
Warm Regards,
--
____________________________________________________________
Raj Dutt Voxel Dot Net, Inc
Network Administrator info@voxel.net
raj.dutt@voxel.net http://hosting.voxel.net
------------------------------
Date: Tue, 08 Jun 1999 14:07:28 -0400
From: Michael Willhide <mdw190@psu.edu>
Subject: Killing parent subroutines
Message-Id: <375D5BE0.3CA452D8@psu.edu>
Howdy,
I'm not sure if this is possible, but here is what I'm looking to do.
Can I kill the parent function of a subroutine from within the
subroutine?
Like this:
sub parent {
child();
}
sub child {
# force parent to return somehow and call another function.
}
Thanks.
--
=============================
Michael Willhide
Applied Research Laboratory
Pennsylvania State University
=============================
------------------------------
Date: Tue, 8 Jun 1999 12:11:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Killing parent subroutines
Message-Id: <Pine.GSO.4.02A.9906081207480.26349-100000@user2.teleport.com>
On Tue, 8 Jun 1999, Michael Willhide wrote:
> I'm not sure if this is possible, but here is what I'm looking to do.
> Can I kill the parent function of a subroutine from within the
> subroutine?
I'm not sure what you want, but I'm pretty sure that it's not possible.
:-)
> # force parent to return somehow and call another function.
No, subroutines don't have that kind of power (and shouldn't). But they
needn't return - they can go on to do whatever they choose, for that
matter. But they can't unilaterally affect the code which called them.
OTOH, maybe you really want to raise an exception (via die), forcing the
caller to deal with it in one way or another.
OTGH, maybe you really want to use the magical 'goto &sub', as documented
in the perlfunc manpage.
If I haven't guessed correctly, you may need to ask again. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 08 Jun 1999 19:30:36 GMT
From: pontz@channel1.com (Brian Pontz)
Subject: Re: NET::Domain NET::SMTP
Message-Id: <375d6f00.2888012@news2.channel1.com>
Nevermind ...... I found it. they are in libnet-1.0606
Brian Pontz
On Tue, 08 Jun 1999 17:13:29 GMT, pontz@channel1.com (Brian Pontz)
wrote:
>Hello,
>I need the NET::Domain and NET::SMTP modules. I've looked around on
>cpan.org and they didnt have it. I also tried searching the web and
>was unable to find it as well. Anyone know where I can get these
>modules ? I need them for Mail::Tools
>
>Thanks
>Brian Pontz
>
------------------------------
Date: Tue, 08 Jun 1999 17:50:53 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7jjl5o$rkg$1@nnrp1.deja.com>
In article <7jijvk$fep$1@nnrp1.deja.com>,
armchair@my-deja.com wrote:
> > On Sat, 05 Jun 1999 07:46:02 GMT, armchair@my-deja.com said:
> >
> > >can you do this in Assembly?:
>
> Not in 4 lines...
The question was "can you do this in assembly",
not "can you do this in assembly in 4 lines".
I don't think there's *anything* you can do in only 4 lines
of assembly! :-)
The issue was not whether the languages are "equal", but really
whether they're Turing-equivalent; and they are, of course.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 08 Jun 1999 18:17:21 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7jjmn6$s8a$1@nnrp1.deja.com>
In article <7jikn4$flv$1@nnrp1.deja.com>,
armchair@my-deja.com wrote:
> In article <7jggjn$n81$1@nnrp1.deja.com>,
> John Porter <jdporter@min.net> wrote:
> > In article <7jakjq$3h4$1@nnrp1.deja.com>,
> > armchair@my-deja.com wrote:
> > > Assembly does not have the same if and while/for logic as
> C/C++/Perl.
> >
> > "Same"? Of course it's not the same. But it has them in some form.
>
> If it ain't the same or equivalent, it ain't gonna help your case, or
> the posters.
Perhaps; but fortunately for the posters, they're equivalent, even
though they're not the same. Thanks for including that qualification;
that met my needs nicely.
> > And you're making a mistake to be lumping C/C++ with Perl.
>
> Did you forget to add "in a Perl newsgroup" to the above sentence?
No, I intentially omitted that, because it's true regardless of
newsgroup.
> > > And Assembly does not
> > > have IO statements like print and printf and read/write like
> > C/C++/Perl.
> >
> > These are not statements in C/C++, they're library functions which
> > make the corresponding system calls. Asm can do that too.
>
> I see. Would you be so kind as to give me the Asm eqivalent to
> printf("The number of trucks was %d all of the color %s\n",
> numTrucks, color);
It depends on the assembler, of course, and the available libraries,
not to mention the platform. But on unix, one could easily code
something like this (forgive the pseudocode; it's been years):
push color
push numTrucks
push "The ... %d ... %s\n"
call printf
That's what C's doing under the hood, after all.
If I can do it in C, I can do it in asm.
> as well as:
> int returnCode = read(data,int,10,myFilePtr);
push MyFilePtr
push 10
push int ; although that's a reserved word in C
push data
call read
pop returnCode
If I can do it in C, I can do it in asm.
> Thanks in advance.
Glad to oblige.
> > C is a low-level language; it's merely a portable "assembly"
language
> > with a well-defined standardized function library. ANYTHING you can
> > do in C, you can do in asm. The mapping is so obvious (to anyone
> > with a clue, at least).
>
> To anyone with a clue, C is much easier to use than assembly,
Well no duh! You think I'm advocating the use of asm?!?
> much higher level,
Only for certain non-standard definitions of "higher level".
> and not "merely a portable assembler".
C comes with a great, well-defined standard library.
And excellent development environments abound for this language.
As for the language itself, and its design philosophy,
it is merely a portable assembler.
> > C++ is a little different. A lot of complex
> > baggage was added. Not that I'm complaining...
>
> Complex baggage like a string? Like iostream? Like classes? Not
> complex at all (to anyone with a clue, at least).
People with a clue as to the difference between C and C++ know that
C++ is frought with lots of very complex stuff. Call me clueless
if it makes you feel smarter; but while you're doing that, why
don't you also go read the ARM for once, and see what really
clueful people have to say about it.
> > > can you do this in Assembly?:
> > >
> > > TextArray a;
> > > returnCode = a.LoadFromTextFile("input.txt");
> > > a.RemoveBlankLines();
> > > cout << a;
> >
> > Of course. It would just be a lot more work.
> > The invention of C was not totally in vain, after all.
>
> Well, my my, in one breath we get "C is just a portable assembler
> (anyone can see the mapping who has a clue)" , and in the next we get
> "It is a lot more work to use". Perhaps you can work on those a bit.
If you insist.
First, allow me to point out that those two things were not in the
same breath, and were not about the same language. The first was
about C, the other was about C++.
C is portable assembler; the mapping of C constructs to the
equivalent assembly (which is after, essentially what the C compiler
generates, usually skipping the asm stage) is very close, though of
course C is more concise.
C++ semantics are much more complex, and the compiler has to do a lot
more work to generate executable code from your source. Not only
that, but it also generates a substantial amount of code which the
semantics require at run time. Whereas hand-translating C into asm
is basically just tedious, translating C++ into asm would be an
excercise in frustration and futility.
And I think, if this discussion is to continue, it should be taken
to another newsgroup.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 8 Jun 1999 13:13:00 -0500
From: "Michael J. McKinlay" <Mike.McKinlay@hboc.com>
Subject: Re: Perl on win32
Message-Id: <7jjm9r$8vb$1@isrv1.hbocvan.com>
Ken Flannigan <ken_flannigan@studio.disney.com> wrote in message
news:7jjj00$e8u$1@louie.disney.com...
> I am trying to set up my environment on my NT box at work for running Perl
> scripts at the command line. In the Perl book I bought, there's a setting
> for the pathext environment variable where you set it to
> pathext=%pathext%;.plx
>
> This works fine for the current dos box that's open. The problem is when
you
> close the dos box and then open a new dos session, the pathext is back to
> the original setting.
>
> Does anyone know how can I make this permanent?
If you use the Control Panel, System applet you can add directories to the
PATH variable using the Environment tab. I think this is true on Win9x, but
certain on NT. ActiveState does this at install. I suggest getting a
current release and installing it.
Thanks,
Mike McKinlay
Senior Technical Consultant
McKessonHBOC
------------------------------
Date: Tue, 8 Jun 1999 14:27:59 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Perl on win32
Message-Id: <7jjmsa$do4$1@nntp4.atl.mindspring.net>
Ken Flannigan wrote in message <7jjj00$e8u$1@louie.disney.com>...
:I am trying to set up my environment on my NT box at work for running Perl
:scripts at the command line. In the Perl book I bought, there's a setting
:for the pathext environment variable where you set it to
:pathext=%pathext%;.plx
:
:This works fine for the current dos box that's open. The problem is when
you
:close the dos box and then open a new dos session, the pathext is back to
:the original setting.
Put it in your autoexec.bat file.
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
'Out, out brief candle!
Life's but a walking shadow,
a poor player, that struts and frets his hour upon the stage,
And then is heard no more; It is a tale, told by an idiot,
full of sound and fury, signifying nothing'
- MacBeth
------------------------------
Date: Tue, 08 Jun 1999 18:34:22 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Perl Sucks!
Message-Id: <Omd73.2330$nn.715540@news.shore.net>
Jerome O'Neil <jeromeo@atrieva.com> wrote:
: Thats big time! ;->
Yeah, but how come we're not rich?
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 8 Jun 1999 19:06:32 GMT
From: Buddhism Benton <revjack@radix.net>
Subject: Re: Perl Sucks!
Message-Id: <7jjpjo$hpf$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Scratchie explains it all:
:Jerome O'Neil <jeromeo@atrieva.com> wrote:
:: Thats big time! ;->
:Yeah, but how come we're not rich?
Who says we aren't? :)
--
/~\ galvanic obstruct Shanghai touchy Sheila frustrate fiesta rater
C oo viz upperclassman something inject Torah scythe impracticable o
_( ^) 1 , 0 0 0 , 0 0 0 m o n k e y s c a n ' t b e w r o n g
/___~\ http://www.radix.net/~revjack/mnj revjack@radix.net
------------------------------
Date: Tue, 08 Jun 1999 18:32:13 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Q: a simple search and replace
Message-Id: <Nkd73.2328$nn.715540@news.shore.net>
Larry Rosler <lr@hpl.hp.com> wrote:
[re: shell redirection]
: It is not "the unix way". It is "the shell way". It will work on any
: system that runs any reasonably modern (i.e., < 20 years old) command
: interpreter. That includes DOS, Windows 3.1, Windows 95, Windows 98,
: and Windows NT. It will also work on Windows 2000. So far as I know,
: none of those is "unix".
Whattaya know, he's right. It's (fortunately) been almost three years
since I've had to write any perl code (or anything else) for Windows/DOS,
so I'd never tried to redirect anything in that shell. You learn something
new every day...
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Tue, 08 Jun 1999 17:21:51 GMT
From: wired2000@my-deja.com
Subject: Recursive Search-And-Replace
Message-Id: <7jjjf2$qr1$1@nnrp1.deja.com>
Hi,
I'm looking for a tool (I believe sed may also work instead of perl)
which can do this:
starting from a directory (which is the starting directory), a script
will go into each subdirectory, opening each file of type .shtml or
.html and will do a search and replace on every occurance of a string.
Ex: I want to replace <HTML> => <HELLO> in every webpage starting from
/usr/local/apache/share/htdocs/
The part of the recursive decent is not so hard or the extension check,
but the actual search and replace sounds hard. I don't think a simple
s/// will work across the entire file, especially if I want to replace
a block of code like this:
<html>
<head><title>Old Title</title>
</head>
to
<html>
<head><title>New Title</title></head>
Doing block based search/replaces doesn't sound that easy with the s///
Any help appreciated.
Thanks
Charles
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 08 Jun 1999 18:15:41 GMT
From: michc@my-deja.com
Subject: Re: Recursive Search-And-Replace
Message-Id: <7jjmk2$s7j$1@nnrp1.deja.com>
In article <7jjjf2$qr1$1@nnrp1.deja.com>, wired2000@my-deja.com wrote:
>
The part of the recursive decent is not so hard or the extension check,> but
the actual search and replace sounds hard. I don't think a simple> s/// will
work across the entire file, especially if I want to replace> a block of
code like this:>
> <html>
> <head><title>Old Title</title>
> </head>
>
>
to>
> <html>
> <head><title>New Title</title></head>
>
> Doing block based
search/replaces doesn't sound that easy with the s///> Any help appreciated.
Why not? You could change the delimiter to something like # and do the
following:
s#<html>\n<head><title>Old
Title</title>\n</head>#<html>\n<head><title>New Title</title></head>#
And
there you go! It looks kind of messy but does what you want it to. As the
blocks get bigger, it gets more messy. You could probably put the contents of
the new block in a variables to make it more readable.
Good luck!
Michelle
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 8 Jun 1999 10:58:12 -0500
From: "Charlene Abrams" <caa@strata-group.com>
Subject: Sockets help: data gets lost
Message-Id: <7jje4l$cbe$1@newsin-1.starnet.net>
I have an implementation of an alarm message server written in C, and
clients written in each of C and perl. When I fire off a couple of C clients
simultaneously (inasmuch as I can do that with these fingers), the behaviour
is fine, but if I fire two perl clients simultaneously, part of the data
sent by one of the clients gets lost. Just never arrives.
After the initial socket connection is established, each client sends an
alarm message, and a "goodbye" message, and expects an "ok" message from the
server after each of these messages, as well as after the initial connect
request. The server accepts both connects, sends both "ok" messages, but
receives only *one* alarm message (and so sends only one "ok"). It does
receive both "goodbye" messages though, and acknowledges them both.
In C, everything is hunky-dory.
According to the Unix book I'm using (Stevens, Advanced Programming in the
Unix Environment), the socket connection should queue up to five messages,
and I was assuming that the perl socket(), connect() etc, functions behaved
analogously to the C functions (except for the filehandle/file descriptor
discrepancy). Am I missing the boat completely? is this not what I should
expect? Any clues would be appreciated.
A secondary, though less important problem I'm having is with the receipt of
the server "ok" messages by the perl client (again, not the C client). It
receives the connection "ok" just fine, but subsequent "ok"s seem to have
blanks inserted before and after them, so the "ok" acknowledging receipt of
the alarm message is read as " o" (blank, followed by the letter o) - I'm
reading only two characters - and the next read retrieves "k " (the letter k
followed by a space).
This doesn't hurt, as the client really doesn't use these acknowledgements
for very much, but it irks me that it doesn't work. My perl client exactly
(within the constraints posed by syntactic differences of the various
function calls) mimics my C client, which displays none of this anomolous
behaviour.
If there's a better newsgroup in which to pose this problem, I'd appreciate
that advice too.
Thanks
Charlene Abrams
caa@strata-group.com
Strata Group
Earth City, Missouri
------------------------------
Date: 8 Jun 1999 18:40:06 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Using a hash slice with references?
Message-Id: <7jjo26$su0$1@info2.uah.edu>
In article <MPG.11c6f2db453e2ed1989b98@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) writes:
: That is true, but totally irrelevant. The questioner was asking about a
: hash slice, which is a list, not a scalar:
:
: @$a->{ $b, $c, $d }
What perl(s) accept this syntax?
Greg
--
...ccoommiitteess (aside: don't you think committee looks cooler and is easier
to write if we just double every letter and be done with it?).
-- Alex Lopez-Ortiz
------------------------------
Date: 8 Jun 1999 19:31:43 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Using a hash slice with references?
Message-Id: <7jjr2v$gko$3@fcnews.fc.hp.com>
John Klassa (klassa@aur.alcatel.com) wrote:
: On 8 Jun 1999 09:05:47 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
: > In the general case, @$hashref{K1,K2,K3}.
: Is there anyone else for whom this notation seems strange?
Yup. The first 20 times. Then I got used to it. Now I like it.
: I'm not saying
: it's incorrect; I'm just saying that it's not intuitive to me. The whole
: notion of:
: $$hashref{$key}
: is weird, too. I much prefer:
: $hashref->{$key}
C++-induced brain damage. I've got it too! :)
: because it makes the fact that $hashref is a reference more obvious.
: To wit, if I say:
: @$hashref{$key1, $key2}
: then later decide I should use a single element rather than a slice, my
: inclination is to lop off the front and back (more or less):
: $hashref{$key1}
resist your C++ inclinations. These structures are parallel:
$$hashref{$key1}
@$hashref{$key1, $key2}
%$hashref
the arrow notation will only yield scalar values (except for ->(),
duh), and is simply a shortcut for some common cases (much like
back-to-back brackets). Use it as a readability aid, not a crutch for
understanding references and their unique and lovable syntax :)
Andrew
------------------------------
Date: 8 Jun 1999 19:09:57 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Using string variable as name of subroutine to call
Message-Id: <7jjpq5$gko$1@fcnews.fc.hp.com>
Uri Guttman (uri@sysarch.com) wrote:
: i thought my addendum was clear. symrefs are evil and should only be
: used by evil mad scientists in their darkest modular castles!
: :-)
Can you be evil and modular at the same time?
:)~
Andrew
------------------------------
Date: Tue, 08 Jun 1999 17:37:03 GMT
From: hotister@my-deja.com
Subject: website rating perl script??
Message-Id: <7jjkbu$r7m$1@nnrp1.deja.com>
Folks, I would really really appreciate that if you could answer this
for me. I'm looking for a commercial/free/shareware perl script that
could do site rating such as this URL:
http://www.audiosurvey.com/cgi-local/mailorder.pl?
action=results&sort=votes
do you know what perl script this is? Is this a commercial perl script
available as a shareware/freeware or this company started from scratch
and wrote by themselves? I already sent them a email to ask their
webmaster but so far no response.. :(
If you have any information about this perl script or know of any other
perl script that could do the site rating (with graphics).. please let
me know. Thanks a bunch! :)
Thanks again! if possible, please also cc your reply to my deja email
account. Thanks
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 08 Jun 1999 11:10:22 -0700
From: Edwin Salgado <inca@incaic.engr.sgi.com>
Subject: Re: Why doesn't this work: open(STDOUT, "| tee >>$file")
Message-Id: <375D5C8E.6F321768@incaic.engr.sgi.com>
Edwin Salgado wrote:
>
> Hello,
>
> I want to append to a file and tee it as well.
> But this didn't work:
>
> open(STDOUT, "| tee >>$file") || .......
>
> The append actually works, but the "| tee"
> seems to be ignored.
Thanks to the people who answered my question:
The answer was to use:
open(STDOUT, "| tee -a $file")
because open(STDOUT, "| tee $file") rewrites
to the $file rather than append to it, which
is what I want.
For anyone who is confused on what 'tee' is,
my man page describes it as follows:
"tee transcribes the standard input to the standard output
and makes copies in the files."
Thanks Again,
Edwin-
------------------------------
Date: Tue, 08 Jun 1999 07:50:09 +0800
From: Raj Dutt <raj.dutt@voxel.net>
Subject: Re: Will future releases of Perl be rewritten in C++?
Message-Id: <375C5AB1.FD430F73@voxel.net>
Dmitry P. wrote:
>
> A question to the Perl experts:
>
> -- now that C++ has become a mature language and C++ complilers are stable
> and available on all platforms, wouldn't a large scale project like Perl
> benefit from strong type system, automatic initialization and clean-up, STL
> containers, etc.?
I'm a far cry from being a perl expert, but other reasons aside, C++ is
*still* a lot less portable than C.
Warm Regards,
--
____________________________________________________________
Raj Dutt Voxel Dot Net, Inc
Network Administrator info@voxel.net
raj.dutt@voxel.net http://hosting.voxel.net
------------------------------
Date: 8 Jun 1999 18:38:01 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: XS: newSVpv() and malloc
Message-Id: <7jjnu9$7k2$1@brokaw.wa.com>
Another XS clarification: when using the newSVpv(char *, int)
function, it creates a *copy* of the string you've passed in, not the
original, correct? Since I have a library that malloc()'s strings for
me to examine, once passed into newSVpv() it should be safe to free()
that string, yes?
Elf
--
Elf M. Sternberg, rational romantic mystic cynical idealist
If you're so smart, why aren't you naked?
A.A 1493 http://www.halcyon.com/elf/
------------------------------
Date: 8 Jun 1999 18:38:00 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: Re: XS: Overriding errno?
Message-Id: <7jjnu8$5cf$1@brokaw.wa.com>
In article <7jh32q$f0s$1@news.NERO.NET>
Dan Sugalski <sugalskd@netserve.ous.edu> writes:
>:>If you actually want to take complete control, you might be able to get
>:>away with setting some magic on a generic scalar and then doing a
>:>
>:> *! = \$magic_scalar;
>:>
>:>but I'm not sure I'd count on that working.
>: I tried both and ended up going with a third option. *Grin*
>: I did, however, end up using the SvNOK_on() hack. That is *so* cool!
>Just out of curiosity, what was option #3? (And you're right, the Sv?OK_on
>hacks are really cool. Sneaky and underhanded, but cool :)
The third option was to go back to basics and create my own
error variable using the SVNOK_on to set its numeric and string
qualities. This has some inconveniences-- when using the object
tied(), for example, error messages are not available. I have
prevailed on the author of the database with which I am interfacing to
store the last error in his class structure so that I can extract it
later with a function like db_lasterror(${tied %db}), and that should
be in the next release.
Elf
--
Elf M. Sternberg, rational romantic mystic cynical idealist
If you're so smart, why aren't you naked?
A.A 1493 http://www.halcyon.com/elf/
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5923
**************************************