[13320] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 730 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 7 11:07:22 1999

Date: Tue, 7 Sep 1999 08: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)

Perl-Users Digest           Tue, 7 Sep 1999     Volume: 9 Number: 730

Today's topics:
        Automating Secure Copy using Perl floodrk@my-deja.com
    Re: Case insensitive SQL query (Mark W. Schumann)
    Re: Case insensitive SQL query (Mark W. Schumann)
        Data structure for Dynamic Use of CGI.pm? <dchurch@kabana.net>
        eof() <erpeng@cs.auc.dk>
    Re: fork? <meowing@banet.net>
    Re: How do I delete apostraphe from a string? <mikecard@my-deja.com>
    Re: How do I delete apostraphe from a string? <sariq@texas.net>
    Re: How to get the result of a system call (Gabor)
    Re: large dataset problem (Benjamin Franz)
        PB Win32::OLE word open <olivier.maas@at-lci.com>
    Re: perldoc on Windows (was:how to make sort() case ins (Bill Moseley)
    Re: suggestion to revise grep (another Q: reference com (Bill Moseley)
    Re: teen angst. <contact@nativetongues.com>
    Re: Unix Trouble ljl_ljl@my-deja.com
    Re: Unix Trouble <c4jgurney@my-deja.com>
    Re: using code written in C (anyone know about stemming <theglauber@my-deja.com>
        Writing to a file <rmramos@aud.alcatel.com>
    Re: Writing to a file <jpeterson@office.colt.net>
    Re: Y2K bugs on the Internet <pfaffben@msu.edu>
    Re: Y2K bugs on the Internet <flavell@mail.cern.ch>
    Re: Y2K bugs on the Internet <jpeterson@office.colt.net>
    Re: Y2K bugs on the Internet <gellyfish@gellyfish.com>
    Re: Y2K bugs on the Internet (Jim Ley)
    Re: Y2K bugs on the Internet (David Alan Black)
    Re: Y2K bugs on the Internet (Bill Moseley)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 07 Sep 1999 14:27:56 GMT
From: floodrk@my-deja.com
Subject: Automating Secure Copy using Perl
Message-Id: <7r37cr$ie5$1@nnrp1.deja.com>



BACKGROUND

I've got about 100 Linux machines around the world which I will call
remotes.  I have one Sun Solaris workstation which I will call local.
I use secure copy (i.e. scp) to transfer large files from my remote
hosts to a local workstation.

WHAT I WANT TO DO

Recently, I've had a lot of problems with scp crashing out in the
middle of large file transfers.  So, I want to write a Perl script that
copies each file in a certain directory using secure copy.  I want my
script to realise if it was unsuccessful in copying the file, and retry.

I thought I could detect errors using $?, but I can't seem to get it to
work.

MY CURRENT APPROACH

Here is what I'm trying:

________________________
#!/usr/bin/perl

@files=`/bin/ls `;
foreach $file (@files)
{
chop($file);
print "scp ./$file rflood\@dhcp-019189.scott.af.mil:/home/rflood/\n";
   open(INPUT,`/usr/local/bin/scp ./$file rflood\@dhcp-
019189.scott.af.mil:/home/rflood/|`);

close(INPUT);

print "$?\n";
}

 open(INPUT,`/usr/local/bin/scp -B sdassa rflood\@dhcp-
019189.scott.af.mil:/home/rflood/|`);

close(INPUT);
print "$?\n";
#print "killed" if $?;

__________________________________

PROBLEM WITH CURRENT APPROACH

Now, say I kill the sshd daemon on the host this script is supposed to
copy to, and then run this script on a remote.  I want to be able to
detect the error.  What happens is that $? is still zero.  My script
returns control to me, and then few seconds later I get the error
messages:


	Secure connection to dhcp-019189.scott.af.mil refused.
	lost connection
	Secure connection to dhcp-019189.scott.af.mil refused.
	lost connection
	Secure connection to dhcp-019189.scott.af.mil refused.
	lost connection
	Secure connection to dhcp-019189.scott.af.mil refused.
	lost connection

Is there a way for my program to detect this, so that I can properluy
handle it?  It seems like I should be able to do this with:
foreach $file (@files)
{
chop($file);
print "scp ./$file rflood\@dhcp-019189.scott.af.mil:/home/rflood/\n";
   open(INPUT,`/usr/local/bin/scp ./$file rflood\@dhcp-
019189.scott.af.mil:/home/rflood/|`);
while (<INPUT>)
{
	if (/Secure connection to dhcp-019189.scott.af.mil refused/)
		[do something else]
}
close(INPUT);

print "$?\n";

but this does not seem to work.  Is there a way to tell open that I
want to see standard error instead of standard output?

Am I totally off-base?

Any help would be greatly appreciated.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: 7 Sep 1999 10:53:21 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Case insensitive SQL query
Message-Id: <7r38t1$dui@junior.apk.net>

In article <7qmvv2$2no$1@brokaw.wa.com>,
Lauren Smith <laurensmith@sprynet.com> wrote:
>mrbog@my-deja.com wrote in message <7qmsva$7na$1@nnrp1.deja.com>...
>>
>>I still contest that SQL IS tangentially related to perl, given that as
>>much as 30 to 40% of people who program perl for a living have to write
>>code that consults a database. That's in the "duh" category.
>
>I'm pretty sure this is on topic for this group.  Could someone help me
>with typing?  I figure that if you program, you have at least a little
>experience with keyboard layout and typing techniques.

Instead of flaming the newcomers who demand answers to unPerl questions,
why don't we do just like this?  I'll answer your MySQL question, but
only after you answer my macroeconomics question.

*sigh*

Maybe _that_ will help get the point across.



------------------------------

Date: 7 Sep 1999 10:57:46 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Case insensitive SQL query
Message-Id: <7r395a$f89@junior.apk.net>

In article <7qpc3d$ne$1@nnrp1.deja.com>,  <mrbog@my-deja.com> wrote:
>Yes, and my feeling is that it sould be about 10% because my god how
>goddamn painful is it for you for someone to ask something outside of
>your so tightly drawn lines.

Here's why:

$ trn
2417 unread messages in comp.lang.perl.misc--read now [y/n]?

This after being gone a day or two.  Do you have any idea how much
stuff this is to read... to help OTHER people?  The more the regulars
get sucked into answer non-Perl questions,
_to_which_better_resources_exist_elsewhere_, the less time they have
to help people with Perl.

The people who answer questions here do it because they want to help
others learn how to use Perl.  You're making it harder for them to do
that.  Is that so difficult to understand?



------------------------------

Date: Tue, 7 Sep 1999 08:00:28 -0600
From: "Linux GNUBEE" <dchurch@kabana.net>
Subject: Data structure for Dynamic Use of CGI.pm?
Message-Id: <7r35p3$qvj$1@macaw.cyberport.com>

I want to read in a file with four values on each line.  Each value is
separated by a \t.  I want to display one of the variables (the fourth one
from each line) from each line of four as a radio-button selection in a FORM
(using CGI.pm).  If a particular radio-button is selected on the form, I
want to pass all four variables to another script.  How can I efficiently
identify which other three variables relate to the selected variable?  A
hash table?  Any ideas on a data structure example?

Thanks!

dchurch@kabana.net





------------------------------

Date: Tue, 07 Sep 1999 13:32:16 GMT
From: Chen Li <erpeng@cs.auc.dk>
Subject: eof()
Message-Id: <37D51366.C459544E@cs.auc.dk>

Hi, all:

How to exit when end of file. I read in two lines data file one by one.
The last read will
fetch only one line data. I tried until eof(FH), it does not work.


Regards,
erpeng



------------------------------

Date: 07 Sep 1999 09:18:09 -0400
From: meow <meowing@banet.net>
Subject: Re: fork?
Message-Id: <874sh6273i.fsf@slip-32-100-244-230.ma.us.ibm.net>

Dan Sugalski <dan@tuatha.sidhe.org> wrote:

{in response to my more or less panning Perl's threading implementation}

> Now, now, it's not that bad. Threads work on any system that implements
> either the POSIX draft4 or final thread spec, as well as Win32, OS/2, and
> (I think) the Next.

Up to a point.  I wouldn't be at all surprised if the little ditties
in the test directories behave the same way on all those machines;
it's when real work is brought it.

> The implementation's just fine, thanks,

No, it hasn't been just fine at all.  There have been problems with
rather basic functions like open() and unlink(), variable scoping,
memory usage piling up long after references should have been long
dead.

These problems variously appeared or didn't appear with the same
applications running under the same versions of Perl under different
platforms.  The same old stuff recoded into both C and Python did not
exhibit any such problems.  It's been slop in Perl.

> though the
> docs are definitely lacking at the moment. The only quirks you need to
> work around are bugs,

Yes, big hairy bugs that won't stay put.  It's been possible to work
around this stuff, but babysitting Perl was taking too much time away
from working on the applications.

> and there are fewer of those with each release. 5.6
> should see things nicely solid.

That should be a relief for people trying to work out useful ideas
with it in the future.

> There's definitely no portability problems-- threaded perl runs the same on
> all systems threaded perl builds on.

That's simply not been the case.  Crashes and memory leaks
reproducible on some systems but not all are not portable.

> (And threads are *not* tough to program--they're really a snap. 

Absolutely, with good tools.  To date, Perl has *not* been a good tool
for programming with threads.


------------------------------

Date: Tue, 07 Sep 1999 13:22:42 GMT
From: mike cardeiro <mikecard@my-deja.com>
Subject: Re: How do I delete apostraphe from a string?
Message-Id: <7r33ik$f8g$1@nnrp1.deja.com>

In article <37D4EBA7.C8F3090C@insnet.net>,
  Matt Duggan <matt@insnet.net> wrote:


> Has anyone got an idea of what the regular expression
> to delete an apostraphe from a string would be?


#!/usr/bin/perl -w

$string = q!monster's!;

$string =~ s/'//g;
print $string;



mike cardeiro


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 07 Sep 1999 09:45:21 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: How do I delete apostraphe from a string?
Message-Id: <37D52501.97A5508D@texas.net>

mike cardeiro wrote:
> 
> In article <37D4EBA7.C8F3090C@insnet.net>,
>   Matt Duggan <matt@insnet.net> wrote:
> 
> > Has anyone got an idea of what the regular expression
> > to delete an apostraphe from a string would be?
> 
> #!/usr/bin/perl -w

Using warnings...that's good.  Not using the strict pragma, that's bad.

> $string =~ s/'//g;

This is exactly for what the 'tr' (or 'y') operator is.  It's been
documented several times to be much more efficient than the above regex
method.  Search deja.com if you're interested.

- Tom


------------------------------

Date: 7 Sep 1999 09:11:05 -0400
From: gabor@vmunix.com (Gabor)
Subject: Re: How to get the result of a system call
Message-Id: <slrn7ta3n8.48f.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, stephen chan <schan_ca@geocities.com> wrote :
# Hello:
# 
# How do I get the result of a system() call?
# I need to do a "cksum" on a bunch of files.
# This code use system to execute the "cksum"
# command:
# 
# $file="a_program";
# system('cksum',$file);

Use qx();

$output = qx(cksum $file);

# It works, but prints the result of "cksum" on screen.
# I need the result of "cksum" in my Perl script
# to further checking.
# 
# Thanks
# Stephen
# 
# 
# 
# 
# 


------------------------------

Date: Tue, 07 Sep 1999 14:18:48 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: large dataset problem
Message-Id: <c99B3.1438$PV2.63004@typhoon01.swbell.net>

In article <7r2sbr$re1$1@news.qub.ac.uk>,
Stephen Trew <s.trew@qub.ac.uk> wrote:
>Hi,
>
>I have a very large dataset of monthly sea surface temperature covering many
>years.
>
>The data is in text file in this format:
>
>    1  1990    [ month and year ]
>-1000 -1000 -1000 -1000 ......  continues for 360 columns
>-1000 -1000 -1000 -1000
>.
>. continues for 180 rows
>.
>    2 1990
>-1000 -1000 -1000 -1000 ......  continues for 360 columns
>-1000 -1000 -1000 -1000
>.
>. continues for 180 rows
>.
>   etc.
>
>Simply put, there are 360 columns of data and 180 
>rows for each month, thus the data is in 1 degree 
>cells and covers the entire globe.  The datafile
>contains eight years worth, about 60 months.
>
>I need to extract a value at a specific longitude 
>and latitude for each month, e.g.. 6W and 49N equals 
>column 174 and row 41 for each month.  What
>is the best way to build a script to do this?

You want to use a data structure like this:

 $data->[$year]->[$month]->[$row]->[$column] = $value;

You didn't explictly state the mapping of columns and
rows to longitude and latitude, but inferring from
your example here is code that does that (note
this code has been neither tested or run - but
it should work).

#!usr/bin/perl -w

use strict;

my $filename = '/path/to/dataset';
my $dataset  = WeatherData->read_dataset($filename);
my $value    = $dataset->element(1990,1,'49N','5W');

package WeatherData;

sub element {
    my $self = shift;

    my ($year,$month,$latitude,$longitude) = @_;

    my ($hemisphere,$row,$column);
    ($row,$hemisphere) = $longitude =~ m/^(\d+)(E|W)$/i;
    if (not $hemisphere) { die ("Bad longitude\n"); }
    if ($hemisphere =~ m/^E$/i) {
        $row = 180 + $row;
    } else {
        $row = 180 - $row;
    }
    
    ($column,$hemisphere) = $latitude =~ m/^(\d+)(N|S)$/i;
    if (not $hemisphere) { die ("Bad latitude\n"); }
    if ($hemisphere =~ m/^S$/i) {
        $row = 90 + $row;
    } else {
        $row = 90 - $row;
    }
    
    $self->[$year]->[$month]->[$row]->[$column];
}

sub read_dataset {
    my $proto = shift;
    my $class = ref ($proto) || $proto || __PACKAGE__;
    my $self  = bless {},$class;

    my ($file) = @_;

    open (DATASET,$file) || die ("Couldn't open $file: $!\n");
    
    my $done = 0;
    until ($done) {
        my $date = <DATASET>;
        last if (not $date);
        chomp $date;
        $date =~ s/^\s+//;
        $date =~ s/\s+$//;
        my ($month,$year) = split(/\s+/,$date); 
        for (my $row = 0; $row < 180; $row++) {
            my $data = <DATASET>;
            chomp $data;
            $data =~ s/^\s+//;
            $data =~ s/\s+$//;
            $self->[$year]->[$month]->[$row] = [ split (/\s+/,$data) ];
        }
    }

    $self;
}


------------------------------

Date: Tue, 07 Sep 1999 15:39:19 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: PB Win32::OLE word open
Message-Id: <37D51586.8028CE32@at-lci.com>

Hello,
I am using a perl program with a Win32::OLE library to open a word file
and save it in text format.
the perl prog works when I run it from DOS, but when used in IE4 I get
an error on the line opening the file :

################################## begining of part of the prog
   #Acces aux bibliotheques Win32
 use Win32::OLE;
 use Win32::OLE::Const 'Microsoft Word';

 #Initialisation des variables
   undef $CloseWhenGoingOut;
   undef $application;
   undef $document;

  unless (defined $application)
 {
 $application=Win32::OLE->new('Word.Application', 'Quit') || warn
"Impossible de cr&eacute;er un objet OLE";
 $CloseWhenGoingOut=1;
 }

############ TEST
# A faire si l'on est en train de tester
if ($FlTest eq 1){
 print "$fichier <BR>\n (r&eacute;f&eacute;rence OLE application
$application et doc:";
 }
############ TEST

#Ouverture du fichier word test
$document=$application->Documents->Open("d:\\test.doc");  #$fichier);
########### line that gives the error

########### the files exists and is a

########### valid word file
$error=Win32::OLE->LastError;
############ TEST
# A faire si l'on est en train de tester
if ($FlTest eq 1){
 print "$document) is open<BR> Error:$error<BR>\n";
 }
############ TEST

#Comptage du nombre de mots
$res=$document->Words->{'Count'};
##################################end of part of the prog


etc...

here is the retrieved error :
OLE exception from "Microsoft Word": Impossible d'ouvrir la macro de
stockage.  (impossible to open the storage macro)
Win32::OLE(0.1005) error 0x800a175d in METHOD/PROPERTYGET "Open"

Anyone would have an idear what happens?

Please also reply by email at maas@ensae.fr
thanks anyway, blue skies and soft landings
olivier









------------------------------

Date: Tue, 7 Sep 1999 07:16:39 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: perldoc on Windows (was:how to make sort() case insensitive?)
Message-Id: <MPG.123ebe1ead959007989711@nntp1.ba.best.com>

Allan M. Due (Allan@due.net) seems to say...
> more will work it just needs to be in the batch file.  So, one solution
> is to open the perldoc.bat file and add | more to the line which reads
> perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9

> perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 | more

But then you can't say 'set pager=notepad', which I use all the time to 
bring the documentation into an editor.



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


------------------------------

Date: Tue, 7 Sep 1999 06:56:40 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: suggestion to revise grep (another Q: reference comparison)
Message-Id: <MPG.123eb978b384695c98970f@nntp1.ba.best.com>

John Lin (johnlin@chttl.com.tw) seems to say...
> It happened on my careless bug.
> 
> @friends=('Johnson','Mary','Tommy');
> $person='Johnson';
> if(grep($person,@friends)) { print "$person is my friend" }
> 
> Hey, I got strange friends on those input values
> 
> $person='John';  $person='Tom';  and even  $person='son';

That's not strange at all.


> But I think it is worthy to revise the grep function
> since "find an element in an array" is quite basic.
> For example, elements can be objects:
> 
> @objects=($johnson,$mary,$tommy);
> $reference=$johnson;
> if(grep($reference,@objects)) {  # simpler and clearer
>     print $reference->{name}," is my friend";
> }

How is that easier? $johnson is just some memory address?  And it still 
doesn't work:

> I guess it works because I luckily grep on the string
> "HASH(0xcb3d80)"
> among a list of strings
> ("HASH(0xcb3d80)","HASH(0xcb3d12)","HASH(0xcb3d34)");

It's the same mistake you made the first time, and not working like you 
think.


> Anyway, just like we have 2 kinds of split:
> split on regular expression and split on string,

We do?

> 
> What do you think about it?

perldoc -f grep
perldoc -f split

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


------------------------------

Date: Tue, 7 Sep 1999 14:46:18 +0100
From: "Martin" <contact@nativetongues.com>
Subject: Re: teen angst.
Message-Id: <7r358m$in4$1@gxsn.com>

Can anyone see a reason to continue this thread?

I bought the book, I have no axe to grind... I'm learning that the book
could be better but it's the only one there is available, as far as I can
see... Am I wrong???

If you think you can write a better one then for gods sake, get your word
processor loaded and get writing. I'd be happy to read, learn and even buy
it... but so far those people busy flaming everyone else (well alright one
person) could be spending their time better than continuing this thread.

So, I have a sensible question and I'd appreciate a sensible answer. Are
there any good online, printed resources at all that cover PHP3, mySQL,
their integration with Perl and also anything on Search engine and spider
designing?

Thank-you.

Martin
PS: I'm relatively new to this group so I've not observed the previous
"interesting" dialogues re: Mr Reese
BUT THERE WERE TWO OTHER AUTHORS!!! Thought I'd point that little nugget
out... :-)

Andrew Johnson <andrew-johnson@home.com> wrote in message
news:y62B3.6054$0M6.149385@news1.rdc2.on.home.com...
> In article <eA%A3.376$96.26431@ptah.visi.com>,
>  George Reese <borg@imaginary.com> wrote:
>
> [snip]
>
> ! I really do not care if my opinions carry weight with you or
> ! Abigail. You both clearly lack any reasoning skills. I am just trying
> ! to point out your faulty reasoning for people who might actually find
> ! my book useful for learning MySQL or mSQL except for your irrational
> ! criticisms.
>
> Speaking of reasoning skills, who wants to pay good money for
> a book buy an author who uses the following logic:
>
> ! in Message-ID: <wv0O1.1521$Ge.4809664@ptah.visi.com>
> !
> ! George Reese wrote:
> ! ! I have provided premises which you can debate or not.  You have not
> ! ! chosen to debate those premises.  What exactly do you want?
> ! !
> ! ! If I say:
> ! !
> ! ! All Americans speak French.
> ! ! I am American.
> ! ! Therefore I speak French.
> ! !
> ! ! As this argument follows from the premises, I have provided an
> ! ! argument with support.  You can either choose to debate my premises or
> ! ! concede that I speak French.
>
> But then you also add this:
>
> ! You are bordering on ridiculous if you think you need to support your
> ! premises.  Such an argument is an infinite regression.
>
> So, your argument is "supported" with whatever premises you put
> forward, and we can choose to debate your premises --- But, you won't
> need to support those premises (as in a "debate") because that would
> be an infinite regress. You never did grasp the difference between an
> internally consistent argument and a supported argument, perhaps this
> will illustrate the point:
>
>     A book (not to mention software) written by an author who doesn't
>     understand basic logic is a waste of money
>
>     George Reese does not understand basic logic
>
>     Therefore, one should not waste one's money on a book (not to
>     mention software) authored by George Reese.
>
> By your own reasoning, I have provided a "supported" argument why
> people should not waste their money buying your book. Now, you can
> go ahead and enter the infinite regress of debating my premises, but
> you may find that many people already notice the support (by example)
> I have provided above for my second premise (I leave the first
> premise entirely up to the buyer's discretion to accept or reject).
>
> andrew
>
> --
>       Doing linear scans over an associative array is like
>       trying to club someone to death with a loaded Uzi.
>           -- Larry Wall
>




------------------------------

Date: Tue, 07 Sep 1999 14:12:11 GMT
From: ljl_ljl@my-deja.com
Subject: Re: Unix Trouble
Message-Id: <7r36fg$hjo$1@nnrp1.deja.com>

may i know what's the role of a web server in my PC,like Apache, does??





In article <7r2m6l$61n$1@nnrp1.deja.com>,
  Jeremy Gurney <c4jgurney@my-deja.com> wrote:
> In article <7r2l89$5jc$1@nnrp1.deja.com>,
>   ljl_ljl@my-deja.com wrote:
> > there are some questions (very basic ones) that i want to know
> >
> > must i be using Unix as my os to be able to use perl??
> No, perl has been ported to numerous OSs. For a win32 version go to
> www.activestate.com
>
> > if no, how come i saw so many tutorials teaching people Perl using
> Unix?
> Unix is where perl started. You could also say that the unix people
are
> better at getting round to writing tutorials for new folk. For a
windows
> orientated tutorial go to
> http://www.free-ed.net/fr03/lfc/course%20030207_01/index.html
>
> > what other things do i need before i could learn to write perl
> scripts??
> A good text editor and a good book (the gecko book is a good place to
> start http://www.oreilly.com/catalog/lperlwin/index.html ). Also if
you
> want to do CGI programming then a you'll want a web server to run on
> your PC try apache from www.apache.org or PWS.
>
> > thanx in advance
>
> You're welcome.
>
> Jeremy Gurney
> SAS Programmer  |  Proteus Molecular Design Ltd.
> "Sometimes I think the so-called experts
>  actually are experts."
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 07 Sep 1999 14:43:05 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Unix Trouble
Message-Id: <7r3893$j1e$1@nnrp1.deja.com>

In article <7r36fg$hjo$1@nnrp1.deja.com>,
  ljl_ljl@my-deja.com wrote:
> may i know what's the role of a web server in my PC,like Apache,
does??
>

Here goes,

Perl itself is a scripting language. Many people new to perl have the
mistaken belief that perl is only for web programming which is not true,
it's just that it does CGI (web programming) very well.

In your original post you asked about servers, which led me to believe
that you might be trying to use perl to do some CGI programming. To be
able to test CGI scripts properly you need to run them in the
environment which they are designed for e.g. through a web server.

If you just want to use perl for normal programming then ignore all
this, you just need the package from ActiveState to get going. Either
way start off with a good book or tutorial and work your way up to the
complicated stuff. If you do want to do CGI programming then
comp.infosystems.www.authoring.cgi is a better place for help than here,
also if you have any problems setting up a web server then ask in
comp.infosystems.www.servers.ms-windows . Another good place for help is
the online documentation which is installed with the ActiveState perl
distribution (check here first).

HTH,

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.
"Sometimes I think the so-called experts
 actually are experts."


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 07 Sep 1999 14:15:23 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Re: using code written in C (anyone know about stemming?)
Message-Id: <7r36lf$hmt$1@nnrp1.deja.com>

In article <MPG.123df2e0ef59df0398970d@nntp1.ba.best.com>,
  moseley@best.com (Bill Moseley) wrote:
> The Glauber (theglauber@my-deja.com) seems to say...
> > Adding C code to Perl is NOT that hard. Look into the documentation
for
> > "perlxstut", "perlxs", "ExtUtils::MakeMaker" and "perlguts", in this
> > sequence. If you are lucky, "perlxstut" is all you need to know.
>
> Ok, I'm at the perlxstut stage.  The examples are not a problem so
far.
> Example 4 uses a library instead of just including the C code in the
 .xs
> file itself.  What I'm unclear on is when I need to use this library
> method vs just placing the code in the .xs file?
> I started in on perlxs to find the answer, but got a little lost.
>
> Can I just insert the my C function in the .xs file (just include the
> entire stemmer.c file, in this case)?  Or are there reasons that I
> missed in the tutorial that means I need to build a library first?
>



Either way works. You may want to keep the C code in a separate file if
that's a file someone else wrote; in this case, you don't need to
change it. Another reason is if you expect to get updated versions of
that C file from time to time. If you keep it separate you won't have
to change your .xs again.

If you have C code outside the .xs, you'll have to edit the Makefile.PL
so that's also compiled and linked in.



> And I'm a bit confused about argument passing.  The routine I'm
trying
> to build looks like:
>
> int
> Stem( word )
>    char *word;  /* in/out: the word stemmed */
>
> So Stem() returns an int, but also modifies word.
> It does an explicit return( 1 ) or return( 0 ).  Would I need to
modify
> the code and put in RETVAL = 1 or RETVAL = 0 above those statements,
and
> then
>
>   OUTPUT:
>   word
>   RETVAL
>
> To return both values?


Maybe something like:

bool_t
Stem( word )
     char * word
     OUTPUT:
     word
     RETVAL


This should call your Stem routine with the correct parameters, and
return a success/failure code (assuming Stem returns 1 on success and 0
on failure).

If Stem returns 0 on success and 1 on failure, you could do:

bool_t
stem( word )
    char * word
    CODE:
        RETVAL = (Stem(word) == 0);
    OUTPUT:
        RETVAL
        word


Good luck!

--
Glauber Ribeiro
theglauber@my-deja.com
"Opinions stated are my own and not representative of Experian"


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 07 Sep 1999 09:31:15 -0500
From: "Rogelio M. Ramos" <rmramos@aud.alcatel.com>
Subject: Writing to a file
Message-Id: <37D521B3.9BACB6AD@aud.alcatel.com>


This is probably an easy answer but I been puzzled why it doesn't work.
Can anyone tell why this is not working . It seems to create the file
when I run it from the command line.

But it never works via the browser.  It must be something simple I am
missing?



#!/apps/gnu/bin/perl

require("cgi-lib.pl");


print &PrintHeader;

print "<html>\n";
print "<head> <title> Testing </title></head>\n";
print "<body>\n";

print "hi";
       open( FILE,">/homes/rramos/tesdir");
       print  FILE "hello world";


print "</body>";
print "</html>";




------------------------------

Date: Tue, 07 Sep 1999 14:48:09 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Writing to a file
Message-Id: <JA9B3.82$xa4.1135@news.colt.net>

Rogelio M. Ramos <rmramos@aud.alcatel.com> wrote:

> This is probably an easy answer but I been puzzled why it doesn't work.
> Can anyone tell why this is not working . It seems to create the file
> when I run it from the command line.

> But it never works via the browser.  It must be something simple I am
> missing?

Yes. The web server doesn;t have permission to create the file. You should
always check the return values of open and then you'd know about this:

>        open( FILE,">/homes/rramos/tesdir");
         open( FILE,">/homes/rramos/tesdir") or die "Can't open file: $!";

The $! variable contains the error message. In CGI programming this error
mesage will be sent ot the web server error logs, so you'll have to look in 
there to see what's going wrong.



------------------------------

Date: 07 Sep 1999 09:04:17 -0400
From: Ben Pfaff <pfaffben@msu.edu>
Subject: Re: Y2K bugs on the Internet
Message-Id: <87k8q2an5a.fsf@pfaffben.user.msu.edu>

finsol@ts.co.nz writes:

   I have decided to respond to the feedback I have received regarding
   "Perl Y2K Bugs on the Internet" in one hit.  

WTF do you think that comp.lang.c, comp.lang.java.programmer, and
comp.lang.javascript would be interested in your Perl Y2k analysis?
We're not.  Go away.
-- 
"I ran it on my DeathStation 9000 and demons flew out of my nose." --Kaz


------------------------------

Date: Tue, 7 Sep 1999 15:03:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Y2K bugs on the Internet
Message-Id: <Pine.HPP.3.95a.990907145550.18282J-100000@hpplus03.cern.ch>

On Tue, 7 Sep 1999 finsol@ts.co.nz wrote expansively:

[...]
> What my research sample shows is that anyone can make Y2K errors 

I don't believe that was ever in dispute.

The problem does not lie with the individual programming _languages_,
that is where your stubbornness is wasting everyone's time, including
your own.

> Is it any surprise that there is such a lot of Y2K bugged code about
> when many prominent programmers do very little in informing their
> programming community on this subject 

Oh, please.  It's in every newspaper, on TV and radio, nobody can be
unaware there are problems.  Just now we're told if there isn't any
further delay then the UK income tax will have about thirty days to test
their new systems before they have to go live.

> and in some cases deny there is indeed any problem?

I've never seen any such claim.  Quite the contrary.

> I do not have any grudge against Perl, in fact the language appears to
> be very intriguing and maybe one day I'll be developing in it.  What I
> do have a problem with is programmers who are so besotted with their
> language of choice, they refuse to use logic. 

No, this is too much.  *plonk*



------------------------------

Date: Tue, 07 Sep 1999 13:31:56 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Y2K bugs on the Internet
Message-Id: <gt8B3.81$xa4.1114@news.colt.net>

In comp.lang.perl.misc finsol@ts.co.nz wrote:
[Followups removed, and not crossposted outside c.l.p.m.]

> Several responses indicated that the Y2K bugs found were only created by
> the incompetent and the inexperienced. This has prompted me to analyse
> the locations of the first 100 Y2K bugs listed in my research - these
> The results were as follows:

[snip lots of universities]

> So its not the incompetents, idiots or script-kiddies creating and/or
> reproducing these Y2K bugs as has been so often stated - unless you want
> to include some of the world's top brains in this category.  This code

At first I thought your conclusion here was completely wrong. The people 
who use these scripts at these august institutions, probably never read them.
They had a job to do, did a quick check to see if it had been done elsewhere
already, and used the pre-existing tool. Furthermore, the people maintaining
web sites at these places are possibly low paid tech support juniors, just as
dull and untrained as tech support juniors anywhere else - certainly less
well paid.

But then I thought - no, you are right. It is the top brains making these 
mistakes. They are assuming that if it appears to work, it does work. They
are behaving like the person who thinks that a 100 pound anchor is more secure
than a 50 pound anchor, because they are not a sailor, and they are unaware of
the affect of density on anchors. A 100 pound wooden anchor is not a useful bit
bit of nautical equipment.

> manual', it is clear that Perl is often learnt by example.  The
> following Perl book review makes this point.

> http://www.cuug.ab.ca/CUUGer/9711/proglernperl.html

This is an important point, and IMHO the main reason for the propagation of the
problem. People are quick to critise cargo cult programming, but it is the same
learning technique that we use in daily life. Knowledge is not linked strongly
to comprehension in normal life - I know what love is, but I don't comprehend
any mechanism associated with it, nor can I give a definition of it. Programmers
would do well to remember that we can use words meaningfully without being able
to define them. Likewise, I can use programming constructs meaningfully without
being able to define them. To be sure I'm not saying cargo cult programming is
OK, I'm saying that the area is a grey one, and it is a step on the ladder.


These y2k cultists speak a child's dialect of Perl. There is a script somewhere
that will break in four months time. Meanwhile, it has given two years of 
useful service, to someone with little or no programming ability, who would not
otherwise have been able to have their little web guest book at all. Sounds
like a bargain to me.  

> Any programming experts who would like to assist getting the message out
> there and help in fixing some of the problems, could:
> (a) Provide guidelines on what types of Y2K problems to look for in
> Perl, Java, C, C++, Javascript etc.
> (b) Write software to scan code for the more obvious errors and/or
> highlight where dates are manipulated in the code. To cover costs you
> could even (heaven forbid!) charge for the software
> (c) Acknowledge to readers in this forum that all mission critical code
> does need to be checked for Y2K problems, regardless of programming
> language.

Personally my concern here is simply the bad
press that Perl will get. I can do without more uninformed jibes and semi-
humours columns in magazines about 'duct tape' on the web.

We could write a script to sniff out classic localtime() horrors, but what's
the point? The poeople using Matt's Scripts do so because they haven't the
time/skill/interest of writing stuff themselves - will they have the time/skill
/interest in using such a tool? I doubt it.

> My principal motives for posting these messages re Y2K are:
> (a) A few more programmers may get the message
> (b) The feedback provides a barometer that I and others can use to
> measure just much the Y2K message has got through to the programming
> community. Feedback generated by my last post would indicate that Y2K
> awareness is still a very big problem.

Yes and no. How much of a problem is it if Joe Blogg's web feedback form
says 1/1/19100 ???

Less than catastrophic. And what will happen then? The net will briefly be
flooded with requests for how to fix this problem, rapidly followed by
answers, followed by a return to normal life. 



------------------------------

Date: 7 Sep 1999 14:39:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K bugs on the Internet
Message-Id: <37d5157d_2@newsread3.dircon.co.uk>

In comp.lang.perl.misc finsol@ts.co.nz wrote:
> 
> If anyone is tiring of this subject then they can either ignore the
> messages or use their 'kill file' facility.  Alternatively you may
> prefer a moderated newsgroup - eg. comp.lang.perl.moderated.  However, I
> would think that at this time Y2K should be a very relevant issue to
> everyone, programmers in particular.
> 

Ho Ho Ho.

*plonk*

/J\
-- 
"Malcolm, what have I told you about putting chocolate near your
crotch?" - Mrs Merton


------------------------------

Date: Tue, 07 Sep 1999 13:38:36 GMT
From: Jim@jibbering.com (Jim Ley)
Subject: Re: Y2K bugs on the Internet
Message-Id: <37d510f3.17996938@news.mistral.co.uk>

On Tue, 07 Sep 1999 12:40:22 GMT, finsol@ts.co.nz wrote:

>I have decided to respond to the feedback I have received regarding
>"Perl Y2K Bugs on the Internet" in one hit.  This feedback relates to my
>article at URL:
>http://www.y2kinfo.com/journal/features/0899_amon.html
>
>and the internet Y2K bugs collated at URL:
>http://www.ts.co.nz/~finsol/y2k_examples.htm
>
>So its not the incompetents, idiots or script-kiddies creating and/or
>reproducing these Y2K bugs as has been so often stated - unless you want
>to include some of the world's top brains in this category.  This code
>has, in many cases, been published at reputable web sites as examples of
>how to code or as tutorials.

Why shouldn't someone expert in Pharmacology or Radiology be a
script-kiddie after all, they are only experts in their field, I often
assist Professors to get elm and LaTeX working if they can't do that,
you wouldn't expect their webpages to be anything special would you?

>Any programming experts who would like to assist getting the message out
>there and help in fixing some of the problems, could:
>(a) Provide guidelines on what types of Y2K problems to look for in
>Perl, Java, C, C++, Javascript etc.

You're the expert, you've been looking for these Y2k issues on the
webpages, I'm reading in comp.lang.javascript and would appreciate a
guideline on what Y2k problems I should look out for, after all you
must know them, or how could you have spotted them?

>(c) Acknowledge to readers in this forum that all mission critical code
>does need to be checked for Y2K problems, regardless of programming
>language.

Please show me some mission critical javascript, the few people who
write mission critical javascript in situations where dates are
relevant (has anyone written such a javascript?) are I'm sure aware of
the issues and would use getFullYear()

If you wish to continue posting these messages in comp.lang.javascript
I would urge you to prove that they are on topic, nothing other than
your use of the word javascript has presented evidence of javascript
problems.

>My principal motives for posting these messages re Y2K are:
>(a) A few more programmers may get the message
>(b) The feedback provides a barometer that I and others can use to
>measure just much the Y2K message has got through to the programming
>community. Feedback generated by my last post would indicate that Y2K
>awareness is still a very big problem.

No, I think these groups have shown hostility to lengthy, irrelevent
barracking about Y2K issues by you, your research may be of use, if
you feel it's important to share it, a simple post pointing to a URL
would be sufficient, writing out lists of universities is not helpful
to anyone...

>If anyone is tiring of this subject then they can either ignore the
>messages or use their 'kill file' facility.  Alternatively you may
>prefer a moderated newsgroup - eg. comp.lang.perl.moderated.  However, I
>would think that at this time Y2K should be a very relevant issue to
>everyone, programmers in particular.

There are no comp.lang.javascript moderated groups.  Your own personal
opinions shouldn't effect whether you choose to post, the
justification above could be used in a cookery group, would that be
reasonable, usenet ettiquette should decide whether you post, have you
recieved large amounts of support for your views, do you think the
groups welcome the input or have the replies indicated that long posts
about this subject is excessive and not in any way constructive to the
group.

>And to the person who objected to my classifying C & C++ in the same
>category. Would making distinctions between C and C++ Y2K bugs make the
>issue any clearer?  I don't think so.

Yes distinctions between languages is important, I see little reason
for perl, c, java and javascript issues to be discussed in one group,
and feel it would be constructive of you to post constructive messages
hilighting the issues in the various different groups, either that of
course or you could post an explanation of why C and javascript can be
considered the same (and not more appropriately discussed in
comp.lang.algorithms..)

Jim.


------------------------------

Date: 7 Sep 1999 09:51:04 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Y2K bugs on the Internet
Message-Id: <7r3588$cbr$1@pilot.njin.net>

finsol@ts.co.nz writes:

>I have decided to respond to the feedback I have received regarding
>"Perl Y2K Bugs on the Internet" in one hit.  

I've never heard a news article referred to as a "hit".  Scary.

>Several responses indicated that the Y2K bugs found were only created by
>the incompetent and the inexperienced. This has prompted me to analyse
>the locations of the first 100 Y2K bugs listed in my research - these
>were listed by URL so were somewhat random.

>The results were as follows:

[lots of, like, waaaay impressive names of universities deleted]

>So its not the incompetents, idiots or script-kiddies creating and/or
>reproducing these Y2K bugs as has been so often stated - unless you want
>to include some of the world's top brains in this category.  

I noticed at least one Matt Wright script in your collection.  Move
over, Dr. Hawking!

Don't get me wrong - I've spent my whole life in and around universities.
Come to think of it, maybe that's why I find your remark so funny.
Naive, but funny.

>It was suggested I notify each of the transgressors of their guilt.

This is getting uncomfortably apocalyptic.  Shalt thou judge the
quick and the dead?  Or just the dumb?

>Is it any surprise that there is such a lot of Y2K bugged code about
>when many prominent programmers do very little in informing their
>programming community on this subject and in some cases deny there is
>indeed any problem?

Good point - thanks - we've got that covered.  Our best programmers
have done a ton in this area.  Thanks anyway.  Good-bye.

Oh, there's more?


>I do not have any grudge against Perl, in fact the language appears to
>be very intriguing and maybe one day I'll be developing in it.

It's more fun to wallow in it.  But either way - please, make it soon.
We need more postings about C++, Javascript, and trans-lingual
issues here.  We need more questions about CGI - or, better yet,
assertions that it's a programming language.


>My principal motives for posting these messages re Y2K are:
>(a) A few more programmers may get the message

Yeah, maybe there should be a newspaper article or TV news segment
about it.  It's such a well-kept secret.

>(b) The feedback provides a barometer that I and others can use to
>measure just much the Y2K message has got through to the programming
>community. Feedback generated by my last post would indicate that Y2K
>awareness is still a very big problem.

Really?  Did you get one single response that said, "I wasn't aware
of this problem"?

Oh lord, please deliver us into the millenium....


-- 
David Alan Black                 blackdav@shu.edu or dblack@pilot.njin.net
Associate Professor              Seton Hall University
Department of Communication      South Orange, NJ 07079
http://pirate.shu.edu/~blackdav  includes Syllabus Markup Language (SyML)


------------------------------

Date: Tue, 7 Sep 1999 07:04:02 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Y2K bugs on the Internet
Message-Id: <MPG.123ebb2b7c01bea2989710@nntp1.ba.best.com>

finsol@ts.co.nz (finsol@ts.co.nz) seems to say...
well, not much.

The "people in the know" about Y2K have already packed up and headed for 
the safety of the back country.  Why are you delaying?

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 730
*************************************


home help back first fref pref prev next nref lref last post