[17105] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4517 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 4 11:05:26 2000

Date: Wed, 4 Oct 2000 08:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970671909-v9-i4517@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 4 Oct 2000     Volume: 9 Number: 4517

Today's topics:
    Re: advise on how to set bugging on in perl file <bmb@ginger.libs.uga.edu>
    Re: advise on how to set bugging on in perl file (Gwyn Judd)
    Re: Case-insensitive Find (Gwyn Judd)
    Re: Cookie problem ghorghor@my-deja.com
    Re: Cookie problem <anders@wall.alweb.dk>
    Re: Get remote image info <flavell@mail.cern.ch>
    Re: how to split text by number of words? <tina@streetmail.com>
    Re: how to split text by number of words? (Clay Irving)
    Re: how to split text by number of words? <bmb@ginger.libs.uga.edu>
    Re: html embeded email (Gwyn Judd)
    Re: Module installation issues <bh_ent@my-deja.com>
    Re: moving a module (Anno Siegel)
        Need help with a Regular expression sternr03@popmail.med.nyu.edu
        Need help with Win32::EventLog tor@kmd.dk
    Re: Need the best Perl Tutorial -- bar none <erebus@hushmail.com>
        print in loop <ben_oit@my-deja.com>
    Re: print in loop (Rafael Garcia-Suarez)
    Re: problems to install perl module <bpan99@yahoo.com>
    Re: problems to install perl module <tony_curtis32@yahoo.com>
        require a file in IIS 4.0 jhardy@cins.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 4 Oct 2000 10:02:11 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: advise on how to set bugging on in perl file
Message-Id: <Pine.A41.4.21.0010040959030.12946-100000@ginger.libs.uga.edu>

On Wed, 4 Oct 2000, Gwyn Judd wrote:
> Who says? Nothing is a perfectly valid program. I intend to do my PhD
> thesis on the NULL programming language. I have already written dozens
> of self-printing programs in it (just before the decimal point in this
> sentence is the 37th).

Hmmm.  A language with no bugs.  Well, I guess you could have syntax
errors.  Unless you treat any non-nulls as comments.  Have you written an
interpreter yet?

Brad



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

Date: Wed, 04 Oct 2000 14:43:22 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: advise on how to set bugging on in perl file
Message-Id: <slrn8tmgg8.1a0.tjla@thislove.dyndns.org>

I was shocked! How could Brad Baxter <bmb@ginger.libs.uga.edu>
say such a terrible thing:
>On Wed, 4 Oct 2000, Gwyn Judd wrote:
>> Who says? Nothing is a perfectly valid program. I intend to do my PhD
>> thesis on the NULL programming language. I have already written dozens
>> of self-printing programs in it (just before the decimal point in this
>> sentence is the 37th).
>
>Hmmm.  A language with no bugs.  Well, I guess you could have syntax
>errors.  Unless you treat any non-nulls as comments.  Have you written an
>interpreter yet?

Thankfully one already exists. It's called "cat". I'm not sure that the
language is Turing Complete. I think it would suffice to emulate
Godzilla though.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Atilla The Hun's Maxim: If you're going to rape, pillage and burn,
be sure to do things in that order.
-P. J. Plauger, "Programming On Purpose"


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

Date: Wed, 04 Oct 2000 14:28:27 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Case-insensitive Find
Message-Id: <slrn8tmfk7.1a0.tjla@thislove.dyndns.org>

I was shocked! How could zihav@my-deja.com <zihav@my-deja.com>
say such a terrible thing:
>Greetings:
>
>I'm trying to do a case-insensitive find on a list of files. I'm
>using File::Find, but having a little trouble with the "sub wanted"
>portion. I simply want to push the found files on to one list and
>the not found on another. Here's my code:

I'm not sure I understand you. You don't explain what "a little trouble"
means" and you don't really explain that well what it is you are trying
to do.  Do you mean you want to do a find and then see which of the
files found match those in your list? If so then doing it the way you
are doing is a terribly inneficient way to do the wrong thing.  Rather
than go through your list one at a time (slow) and then do a search for
that file (really slow, especially since you do it repeatedly), it would
be better to do a search for all files (still slow but we only do it
once) and then see if each file found matches any of the files
in your "to-find" list (fast).

>#!/usr/local/bin/perl

One of the really important things to do when posting anything to this
list is to use all of the assistance that the perl compiler can give
you. One of these things is the use of warnings and the other is the
"strict" pragma. You can do it in this way:

#!/usr/bin/perl -w
use strict;

You may find the documentation for these "pragma's" in:

perldoc perlrun
perldoc strict

I suggest you read these carefully. You will find that some parts of
your code that worked will not work now. This is intentional, "strict"
is by nature, well, stricter than perl is by default. You will need to
figure out how to declare a variable for starters:

perldoc -f my

>use File::Find;
>
>$| = 1;
>$dir = "./";
>sub wanted {
>    eval '/\b$verilog\b/i';
>	if (exists $File::Find::name) {

Your first bug is here, I take it. One of the other important things to
do when posting here is to make sure your code compiles. This does not
compile. Even if it did do what I think you want to do it would make no
sense, since by definition 'wanted' is called for every file that is
found, ergo the file does exist. I think you really want to check if the
file that was found is in your "to-find" list. Your 'eval' statement is
eerily similar to something you might do if the variable $verilog
contained the name of a file in your "to-find" list, however since I
feel your algorithm is completely wrong we'll skip that and introduce a
better way to do it. Read the files:

perldoc perldata
perldoc perlop

concentrating on the thing known as a "hash". You seem to know a little
about arrays so it shouldn't be difficult. A hash is a bit like an array
in reverse, kind of.

Anyway if you read all that you'll find (maybe) that you can do
something like this to figure out if the file that was found is in your
list:

sub wanted {
    push @{$found{$_}}, $File::Find::name if exists $to_find{$_};
}

What this does is kind of complicated and a bit dense information wise
so I'll try to split it out. We have a hash called %found that will hold
the filenames that were found matching the ones in our "to_find" list.
Note that we might actually match them more than once if there are
several files with the same name, so what %found is, is a hash-of-arrays
which is a more advanced data structure. Simply put it contains a number
of arrays, each one containing one or more filenames that were found to
match a name in our "to_find" list. You can read about these data
structures in:

perldoc perldsc

This will only give us the files that *were* found. After the find()
call returns we need to figure out which files weren't found and put
them in the other list. We'll get back to that when we get there. Note
that this only does an exact match on the filenames. If you want to do a
"fuzzy" match then you will need to rewrite "wanted" to do a search over
the elements in %to_find and use a regex like you tried before. This is
because hashes don't do fuzzy matching. This will be slower (but still
relatively efficient).

You might want to check the documentation for "exists" now that we have
a correct usage of it:

perldoc -f exists

>}
>
>$filecnt = 0;

You will need to do something like:

my $filecount;

if you did "use strict" above. Note you don't need to initialise it to
zero as perl will do that for you.

>open (TO_FIND,"foo") || die "\nERROR: Couldn't Open foo $!\n\n";
>while(<TO_FIND>) {
>    chomp;
>    @x = $_;
>    @x = split;

ick. Why do you assign $_ to the array @x and then do a split on $_ and
assign *that* to @x? You can do just fine without the first assignment.
In any case, this is where I introduce hashes. I'd do something like:

     $to_find{(split /\s+/, lc, 2)[0]} = 0;

The hash %to_find holds the names of the files we want to find. We split
$_ into at most 2 fields on whitespace and then take the first one and
put it into our hash.

>	$filecnt++;
>}
>close (TO_FIND);
>
>print "$filecnt Files to look for...\n\n";

And then all we need to do is:

find \&wanted, $dir;

And the array @found will be filled with the files that were actually
found. Then we just need to extract from %to_find all the ones that
weren't:

%not_found = (keys %to_find);
delete @not_found{%found};

Here we use the concept of a "hash slice" to access several items in an
array at one time. Also the obligatory documentation reference:

perldoc -f delete

In case you are completely lost, the complete program follows:

#!/usr/local/bin/perl -w
use strict;
use File::Find;
use Data::Dumper;

$| = 1;
my $dir = "./";
my (%found, %not_found, %to_find);

sub wanted {
    push @{$found{$_}}, $File::Find::name if exists $to_find{$_};
}

my $filecnt;

open (TO_FIND,"foo") || die "\nERROR: Couldn't Open foo $!\n\n";
while(<TO_FIND>) {
    chomp;
    
    $to_find{(split /\s+/, $_, 2)[0]} = 0;
    $filecnt++;
}
close (TO_FIND);

print "$filecnt Files to look for...\n\n";

find(\&wanted, $dir);

%not_found = (keys %to_find);
delete @not_found{keys %found};

print "To Find:\n\n", Dumper \%to_find;
print "\n\nFound:\n\n", Dumper \%found;
print "\n\nNot Found:\n\n", Dumper \%not_found;
print "\n";

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"That must be wonderful!  I don't understand it at all."


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

Date: Wed, 04 Oct 2000 12:55:38 GMT
From: ghorghor@my-deja.com
Subject: Re: Cookie problem
Message-Id: <8rf9c7$pv7$1@nnrp1.deja.com>

In article <smFC5.940$UW.31081@news010.worldonline.dk>,
  Anders Lund <anders@wall.alweb.dk> wrote:
> ghorghor@my-deja.com wrote:
>
> > Can someone help me please
>
> You, by reading documentation.
> The CGI module comes with excellent documentation.
> Perl comes with excellent documentation.
>
> perldoc CGI, then search for cookie...
>
> -anders
>
> --
> [ the word wall - and the trailing dot - in my email address
> is my _fire_wall - protecting me from the criminals abusing usenet]
>

i know that
the exemple come to the perldoc CGI::Cookie
but even the exemple doesn't work so ...

and there isn't written anywhere that CGI::Cookie supporte IE so i m
not sure to use some that doesn't work with IE :)



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 4 Oct 2000 15:53:16 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Cookie problem
Message-Id: <eEGC5.425$u23.36301@news000.worldonline.dk>

ghorghor@my-deja.com wrote:

> In article <smFC5.940$UW.31081@news010.worldonline.dk>,
>   Anders Lund <anders@wall.alweb.dk> wrote:
> > ghorghor@my-deja.com wrote:
> >
> > > Can someone help me please
> >
> > You, by reading documentation.
> > The CGI module comes with excellent documentation.
> > Perl comes with excellent documentation.
> >
> > perldoc CGI, then search for cookie...

> 
> i know that
> the exemple come to the perldoc CGI::Cookie
> but even the exemple doesn't work so ...

Oh yes I see that. Then you have to figure out why not. First, why not try 
dumipng your result,

$cookies = fetch CGI::Cookie;
foreach (keys %$cookies) {
     print "$_: value: ", $cookies->{$_}->value,
                " name: ", $cookies->{$_}->name, "<br>";
}

and see if anything is present.
If nothing is printed, your server didn't get any cookies back, and you 
need to find out why. Maybe cookies is turned of in the client browser, 
maybe you did something wrong. Running the program from the terminal (DOS 
prompt in your case??) allows you to see the output, including the HTTP 
headers.

> and there isn't written anywhere that CGI::Cookie supporte IE so i m
> not sure to use some that doesn't work with IE :)

Sure. Cookies is a part of the HTTP 1.1 specs, and eventhough MS does their 
best to polute any standard when they can, they dosen't do it if it is too 
obvious a drawback for their users...

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Wed, 4 Oct 2000 14:46:10 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Get remote image info
Message-Id: <Pine.GHP.4.21.0010041428010.12836-100000@hpplus03.cern.ch>

On Wed, 4 Oct 2000, Wang Mu Shan wrote:

> How can I get width and height of remote images without retrieving and
> saving the whole image data to local disk first?

It's not clear why you would need the size if you're not going to do
anything with the whole image.  But let's assume that you do have some
reason for wanting that.

> ( I just want image header info).

This information is inside the image file.  Yes - in the sense that
the image file includes a header area, what you want is the "image
header".  Don't confuse this with the HTTP header, as could be
retrieved using a HEAD request with LWP.

If you know which part of the image file you need, then you can
retrieve it with a "partial GET" request in HTTP.  This is documented
in RFC2616 section 14.35, using a GET request in the presence of a
Range: header.

I've never tried this myself, but in principle it should be feasible.

I've really no idea whether Image::Size will give the right answer
if presented only with the first part of an image file, but it should
be easy enough to try it out first, by making some truncated image
files or by looking at the code...

But if you're finally going to use the images anyway, you might as
well just fetch the whole thing, no?  If you do your WWW-ing via a
cache proxy (as one normally should IMNSHO when accessing a remote
server), then the images which you fetched for sizing should still be
hanging around in the cache when you want to actually use them, so
they wouldn't need to be fetched from the remote server again.



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

Date: 4 Oct 2000 14:01:08 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: how to split text by number of words?
Message-Id: <8rfd74$h9tc7$1@ID-24002.news.cis.dfn.de>

hi,
In comp.lang.perl.misc Clay Irving <clay@panix.com> wrote:
> On 4 Oct 2000 03:50:02 GMT, Tina Mueller <tina@streetmail.com> wrote:

>>In comp.lang.perl.misc Firestar <theebh@yahoo.com> wrote:
>>> Hi, i need to break a long chunk of text into a few paragraphs, each
>>> paragraph not more than 300 characters, for example. can i use regexp
>>> for this? TIA.
>>
>>use Text::Wrap;

> How is Text::Wrap going to break a "long chunk" of text into paragraphs of
> no more than 300 characters? -- It allows you to set margins, but I didn't
> notice any functionality to construction paragraphs from a glob of text.

well, you can rewrite it for your needs. i would do that
instead of beginning to implement it all from the
beginning.
am i right, instead of breaking a text into several
lines with x characters you want to break it
into lines with 300 characters, but with two
newlines instead of one? that would produce
paragraphs. easy change in Text::Wrap.

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: 4 Oct 2000 14:46:22 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: how to split text by number of words?
Message-Id: <slrn8tmglm.ltq.clay@panix3.panix.com>

On 4 Oct 2000 14:01:08 GMT, Tina Mueller <tina@streetmail.com> wrote:
>In comp.lang.perl.misc Clay Irving <clay@panix.com> wrote:
>> On 4 Oct 2000 03:50:02 GMT, Tina Mueller <tina@streetmail.com> wrote:
>>>In comp.lang.perl.misc Firestar <theebh@yahoo.com> wrote:

>>>> Hi, i need to break a long chunk of text into a few paragraphs, each
>>>> paragraph not more than 300 characters, for example. can i use regexp
>>>> for this? TIA.
>>>
>>>use Text::Wrap;
>
>> How is Text::Wrap going to break a "long chunk" of text into paragraphs of
>> no more than 300 characters? -- It allows you to set margins, but I didn't
>> notice any functionality to construction paragraphs from a glob of text.
>
>well, you can rewrite it for your needs. i would do that
>instead of beginning to implement it all from the
>beginning.
>am i right, instead of breaking a text into several
>lines with x characters you want to break it
>into lines with 300 characters, but with two
>newlines instead of one? that would produce
>paragraphs. easy change in Text::Wrap.

I suppose it depends on the point of view -- For a 600 character chuck of 
text, I thought the original poster was looking for something like four
lines of 75 (or so) characters, a newline, and another four lines of 75
characters. Your approach prints a line of 300 characters, a newline, and
another 300 characters. I can see both equally wrong or right...

-- 
Clay Irving <clay@panix.com>
On applause: They named it Ovation from the Latin _ovis_, a sheep. 
- Plutarch 


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

Date: Wed, 4 Oct 2000 10:58:55 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: how to split text by number of words?
Message-Id: <Pine.A41.4.21.0010041057540.12946-100000@ginger.libs.uga.edu>

> >>>In comp.lang.perl.misc Firestar <theebh@yahoo.com> wrote:
> 
> >>>> Hi, i need to break a long chunk of text into a few paragraphs, each
> >>>> paragraph not more than 300 characters, for example. can i use regexp
> >>>> for this? TIA.

Define paragraph.

Brad



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

Date: Wed, 04 Oct 2000 14:36:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: html embeded email
Message-Id: <slrn8tmg30.1a0.tjla@thislove.dyndns.org>

I was shocked! How could Sunil Dua <sunil@solutionsny.com>
say such a terrible thing:
>Dear List members

This is not a list. This is a newsgroup.

>I want to send html pages as the body of my mail through perl on linux
>plateform. does anybody have any idea as to how to achieve this. I
>shall be very greatful to you.

This is a relatively frequently asked question. I recall at least one
person asking this question not very long ago.

>Sent via Deja.com http://www.deja.com/
>Before you buy.

Since you use deja to post, why not use it to search too? I think if you
do a search on MIME, HTML, email and such keywords you will find
something useful.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I have already given two cousins to the war and I stand ready to sacrifice
my wife's brother.
		-- Artemus Ward


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

Date: Wed, 04 Oct 2000 13:07:12 GMT
From: bh <bh_ent@my-deja.com>
Subject: Re: Module installation issues
Message-Id: <8rfa1r$qgh$1@nnrp1.deja.com>

In article <8rddvg$bck$1@nnrp1.deja.com>,
  bh <bh_ent@my-deja.com> wrote:
> While trying to install Bundle::DBI on an HP machine running 11.00
with
> perl 5.005 I have encountered a problem with the Net::Daemon
> RPC::PlServer portion.
>
> The installation reports that the syntax error is found in
> _h2ph_pre.ph.  The exact line mentions: ".1)" as the problem on line 2
> of the .ph file.  Sound familiar to anyone?
>
> --
>
> bh
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Does anyone have any suggestions here?  Am I in the wrong newsgroup?
--

bh


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 4 Oct 2000 14:08:51 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: moving a module
Message-Id: <8rfdlj$9jf$1@lublin.zrz.tu-berlin.de>

 <nlymbo@my-deja.com> wrote in comp.lang.perl.misc:
>I have a perl module (*.pm) that i want to modify, but i don't want to
>tamper with the original yet so i made a copy in the present working
>directory. The package name of the module is Stnet::UserInput.pm...so
>in the pwd i changed it to UserInput.pm. Then i modified the contents
>and "used" it like so:
> 
>use UserInput;

Now the name you give to use ("UserInput") and the package declaration
in the module (should be "Stnet::UserInput") don't agree.  If UserInput
is an exporting module this usually means trouble (though apparently
you haven't got far enough to experience this particular trouble
yet).  With an OO module it may not matter.

You should actually duplicate the directory structure, down from
the point where the module is usually found in @INC, in your working
directory.  In this case, this would mean that the module is
 ./Stnet/UserInput.pm, and the use statement is "use Stnet::UserInput".

But now you have the problem that the current directory comes last
in @INC, so the use-statement above would still load the un-modified
module from where-ever it lives, not the one you're mung^Wworking on.
Give it a "use lib '.'" before you use the module to change that.
Myself, I cringe at the thought of '.' early on @INC, but if you know
what you are doing it doesn't automatically mean trouble.

>@INC does include "." (pwd) so it should find the module but it does
>not. Is there some other reason it would not be found. The message i
>get is:
>
>Can't locate auto/fk/UseInput/parse_billk.al in @INC (@INC
>contains: /usr/local/
>lib/perl5/5.00502/sun4-
>solaris /usr/local/lib/perl5/5.00502 /usr/local/lib/perl5
>/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 .)

It finds the module alright, but apparently, Stnet::UserInput.pm
brings along other stuff to use.  If you follow the method sketched
above, Perl should find these components in their original places.
This is usually okay, since you don't want to mess with those parts
anyhow.  If you want to change them too, you will have to duplicate
more of the directory structure in the Perl library to your current
directory, down to the files you need.  "find /your/perl/lib -name
'UserInput*' -print" should give you an idea which files and directories
to consider.

Let me note that this is some general advice about how to move a
module.  All modules are different and it's very much up to the
author how to arrange things, so the procedure may vary.  The idea
that a module is a single *.pm file with some Perl code in it is wrong
in many cases.

>at steve.p line 17

Of course!

Anno.


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

Date: Wed, 04 Oct 2000 14:20:32 GMT
From: sternr03@popmail.med.nyu.edu
Subject: Need help with a Regular expression
Message-Id: <8rfeb7$u6d$1@nnrp1.deja.com>

I have a program which gets in a field from a database
A typical field would be:
Columbia,Harvard
or it could be:
Columbia,NYU[New York,NY],Harvard[Boston],Yale
or
Columbia[NY]

now my problem is that I need extract each college as a whole unit and
if the town is included put that in another variable (which I can
associate with the matching college) with commas if the town has them

I've tried many different things, including parsing the text to see if
the [ is before or after the comma, but nothing seems to work. I
figured that there must be a way to do this with regular expressions
but I can't figure out how

Any ideas?

Ricki Stern


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 04 Oct 2000 13:21:44 GMT
From: tor@kmd.dk
Subject: Need help with Win32::EventLog
Message-Id: <39db2d54.194975059@news.kmd.dk>

Hi
I'm using the following example code to genereate a entry in the
EventLog.
When I open up the EventLog, the entry is there, but
when i try to get details it says: 
The system can not find the file specified.

Why is that

Torfinn -- > tor@kmd.dk

------------  The Code -------------
use strict;
use Win32::EventLog;

# create a new EventLog object
my $logfile = "Application";
my $log = Win32::EventLog->new($logfile);
die "Can't open $logfile: $!" unless $log;

# populate our event with data
my $info = {
            'Category' => 1,
            'EventType' => EVENTLOG_INFORMATION_TYPE,
            'EventID' => 1,
            'Strings' => "A Perl Event",
            'Data' => 'Perl',
           };

$log->Report($info) || warn "Unable to report event: $!";
$log->CloseEventLog;





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

Date: Wed, 4 Oct 2000 15:20:00 +0100
From: "Alex Gough" <erebus@hushmail.com>
Subject: Re: Need the best Perl Tutorial -- bar none
Message-Id: <8rfeag$i7l$1@news.ox.ac.uk>

"Jim Wright" <jim@inatos.com> wrote in message
news:pfmC5.1749$RB1.14124@NewsReader...
> Buy a book - I picked up Perl through web tutorials and asking people on
> here, I spent more time doing that than if I bought a good book (like the
> Camel (one)), if your time is worth anything to you, its cheaper to buy a
> book! Otherwise, if you insist, I started at cgi101.com, it gets you on
the
> road and using netpedia.com/coding/cgi as a refernce manual.
>
> Jim
>
> PS if you get to any advanced level you'll, need a good book anyway!

Far too true... I spent quite a while trying to learn from online tutorials
but soon found that they were essentially all the same and mostly catered
for the simple CGI side of perl which, although useful, leaves you missing
much that you should know.

Most online tutorials are also geared towards systems where you will not
have access to any modules, which can often leave you ill prepared to
write anything more complex (or useful) than a guestbook.

The online tutorials were enough to get me to like perl though, and see
how easy it was to do most things.  The next thing I did was to install
Activestate perl, which (for Windows at least) comes with all the docs
in a nice, easy to browse, htmled package.  Wading through these wasn't
easy, but it did eventually give me a good idea of what was happening
and, more importantly, encouraged me to experiment with using modules.

After that I embarked on numerous self-chosen projects as you can only
learn by doing.  Whenever I hit an error I'd dive into the docs to work
out why.  Rather than posting to c.l.p.misc or IRC with my troubles I
sorted them out myself.  In the long term that's really the only way to
go.

After I while I got myself the CD bookshelf from O'Reilly and soon
wished that I had brought it much earlier as it would be much easier to
learn from such well written books than from the somewhat terse docs.
One of the more useful things I have done is to look over some of my
earlier scripts to work out what I was doing wrong then, rewriting them
to be simpler.  Of course I'm still learning, and always discovering
weird, wonderful or just plain cryptic ways of doing things.

Anyway, the moral of the story is to:

1 - Keep at it, and remember that only by working at it yourself can you
    really get anywhere.

2 - Go and buy some books, and read the perl docs, rinse, then repeat.

3 - Try to have fun, make your computers have shouting matches with each
    other, draw pretty things on the screen, annoy your friends with
    JAPHs or golf shots and never give up.

--
Alex Gough




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

Date: Wed, 04 Oct 2000 14:31:57 GMT
From: benoit <ben_oit@my-deja.com>
Subject: print in loop
Message-Id: <8rff0t$uns$1@nnrp1.deja.com>

Hello,

I'd like to make a progress indicator for some stuff however, It looks
like I can't print a character at a time in the loop unless I specified
the STDERR exit.

It workd with STDERR but it's not very elgant ;-)

Any help welcome :

========= progress.pl ================
#!/usr/bin/perl -w
use strict;
my $nb_fichiers = 56;

my $avancement=0;

print STDOUT ("0%                     50%                     100%\n");

for my $numfich ( 0 ..  $nb_fichiers)
{
        $avancement+=1;
        if (($avancement/$nb_fichiers)>=0.02)
                {
                $avancement-=(0.02*$nb_fichiers);
                # Work with STDERR
                # print STDERR "=";
                # But not with STDOUT !!
                print STDOUT "=";
                }
        # Some operations on the files
        for (my $i=0;$i<25000;$i++) {;}
        }
print("\n");
================= END progress.pl ===================

Benoit


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 04 Oct 2000 14:52:56 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: print in loop
Message-Id: <slrn8tmhf1.4ar.rgarciasuarez@rafael.kazibao.net>

benoit wrote in comp.lang.perl.misc:
>Hello,
>
>I'd like to make a progress indicator for some stuff however, It looks
>like I can't print a character at a time in the loop unless I specified
>the STDERR exit.

Probably because output to STDOUT is buffered.

Put the line
  $| = 1;
before your loop, and lookup $| in the perlvar documentation to know why.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Wed, 4 Oct 2000 09:31:34 -0500
From: "Bo Pan" <bpan99@yahoo.com>
Subject: Re: problems to install perl module
Message-Id: <i8HC5.30$6Z.334@client>

It won't. I tried and got error message of unkown flags and flag
combination.

Bo

"Thorbjørn Ravn Andersen" <thunderbear@bigfoot.com> wrote in message
news:39DB1962.DE5C68B3@bigfoot.com...
> Stig Palmquist wrote:
> >
> > "Bo Pan" <bpan99@yahoo.com> writes:
> >
> > > Hello,
> > > I am trying to install XML:Parser on my SGI machine, (IRIX 6.5).
As I
> > > do not have cc compiler,
> > > I installed gcc. But when ever I try 'perl Makefile.PL', makefile
> > > generated still uses cc as
> > > compiler, and CFlag includes -n32, mip3, etc.
> > > What should I do to make the Makefile use gcc?
> > > Thanks in advance.
> >
> > ln -s /usr/bin/gcc /usr/bin/cc
>
> I am not sure that gcc understands the SGI cc flags stated above.
>
> --
>   Thorbjørn Ravn Andersen         "...plus...Tubular Bells!"
>   http://bigfoot.com/~thunderbear




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

Date: 04 Oct 2000 09:48:06 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: problems to install perl module
Message-Id: <8766n84q8p.fsf@limey.hpcc.uh.edu>

>> On 04 Oct 2000 10:37:34 +0200,
>> Stig Palmquist <stig@palmquist.org> said:

> "Bo Pan" <bpan99@yahoo.com> writes:
>> Hello, I am trying to install XML:Parser on my SGI
>> machine, (IRIX 6.5).  As I do not have cc compiler, I
>> installed gcc. But when ever I try 'perl Makefile.PL',
>> makefile generated still uses cc as compiler, and CFlag
>> includes -n32, mip3, etc.  What should I do to make the
>> Makefile use gcc?  Thanks in advance.

> ln -s /usr/bin/gcc /usr/bin/cc

That won't work unfortunately because the flag/option set
is different.

If you really want to edit the installation on the fly,
try playing with the compiler settings in, e.g.

    /usr/lib/perl5/5.6.0/i686-linux/Config.pm

Season accordingly for the proper locations for your
installation and platform.

Run "perl -V" before and after making the changes to see
the effect (make a backup of Config.pm!).



Personally I would make sure that the core of perl and any
subsequent modules are compiled with the same compiler,
e.g. by reinstalling perl from source.

hth
t
-- 
Namaste!
And an "oogabooga" to you too!
                                         -- Homer Simpson


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

Date: Wed, 04 Oct 2000 13:53:42 GMT
From: jhardy@cins.com
Subject: require a file in IIS 4.0
Message-Id: <8rfcp4$skt$1@nnrp1.deja.com>



I seem to be having a problem with "require" in IIS 4.0

I get the following error message no matter what script I run:

I am sorry but I was unable to require
 ./Librarys/web_store.setup.db.table at line 75 in
C:\InetPub\wwwroot\artfind\public_html\cgi\Web_store\web_store.pl. Would
you please make sure that you have the path
correct and that the permissions are set so that I have read access?
Thank you.

I have checked the paths and permissions?

I am using PERL 5.6.0 build 618

is there another command to be used under WIN32

I have searched the PERL MAN with no success.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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


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


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