[17646] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5066 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 8 18:05:46 2000

Date: Fri, 8 Dec 2000 15:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976316717-v9-i5066@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Dec 2000     Volume: 9 Number: 5066

Today's topics:
        "open" and file cache <rs232@kerkerker.de>
    Re: ($fastest) ? "perl_on_Linux" : "perl_on_Windows" (Tim Hammerquist)
    Re: ActivePerl Problem <joelnelson@home.com>
        Algorithm::Diff -- why does diff() return LOLOL instead (Weston Cann)
        Anywhere to put my scripts? (Fryar386)
    Re: Anywhere to put my scripts? <thoren@southern-division.com>
    Re: Anywhere to put my scripts? <carvdawg@patriot.net>
    Re: Anywhere to put my scripts? (Richard Zilavec)
    Re: Apache on Linux - Error on scripts called thru brow (Tim Hammerquist)
    Re: Can anybody help ??? (David H. Adler)
    Re: Can anybody help ??? (Richard Zilavec)
        combining regexps into one <brondsem@my-deja.com>
    Re: combining regexps into one eggrock@my-deja.com
    Re: combining regexps into one (Tad McClellan)
        compiling scripts with Active State perl (Stephen Patterson)
    Re: compiling scripts with Active State perl (Tim Hammerquist)
        count number of occurrences in string <jdhunter@nitace.bsd.uchicago.edu>
    Re: count number of occurrences in string (Tad McClellan)
    Re: count number of occurrences in string <jdhunter@nitace.bsd.uchicago.edu>
    Re: CSS files in a cgi script (Richard Zilavec)
    Re: CSS files in a cgi script <tony_curtis32@yahoo.com>
    Re: default method nobull@mail.com
    Re: default method nobull@mail.com
    Re: default method <jeffp@crusoe.net>
    Re: Displaying an image (Richard Zilavec)
        Does it matter? (Fryar386)
    Re: Does it matter? (Richard Zilavec)
    Re: Does it matter? (Tim Hammerquist)
    Re: Execute perl code enterred at run time? (Craig Berry)
    Re: FTP question <olthoff@multiboard.com>
    Re: FTP question (Chris Fedde)
        How do I find out my own IP Address? <cvh@gmx.de>
    Re: How to get the filename??? nobull@mail.com
        How to install SWIG on NT <tjones@computer.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 6 Dec 2000 21:33:14 +0100
From: "rs232" <rs232@kerkerker.de>
Subject: "open" and file cache
Message-Id: <90rnl1$gbo$03$1@news.t-online.com>

Hi,

I noticed the following symptom under Linux Redhat 7.0:

My perlscript reads every 5 seconds a file
If I delete this file it reads it anyway.

Only if I restart the script it notices that the file doesn't extists.

I want to update the file through another program. But if the perl script
doesn't check the existenz of the file how can it read the file actual
contents ?

My config:
Linux Redhat 7.0
The File which should be read is on a Windows NT Server (mounted via
mount -t smbfs....)

Probably this has nothing do with perl rather than with the linux file cache
?

Any suggestions ?

Thankyou,

rs232






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

Date: Fri, 08 Dec 2000 19:35:46 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: ($fastest) ? "perl_on_Linux" : "perl_on_Windows"
Message-Id: <slrn932e4b.1v7.tim@degree.ath.cx>

theredviper@my-deja.com <theredviper@my-deja.com> wrote:
> This is sure to generate flame, but I have good intentions. <evil
> grin>.  I have just a general question that has probably already been
> answered 100 times.   I have my opinion on which is fastest (you
> probably guessed), but is there one of these that is generally faster on
> a certain platform with similiar hardware configurations or is it
> primarily dependant on the type of processes being done?  Just curious
> as to what other people have noticed.  And yes I realize that my
> description of the operating systems is vague.  tia.

Well, "redviper", not only is your question vague with way too many
variables, but your logic in your subject is faulty.

In any case: Linux is more stable, for organized, and takes better
advantage of the 32 bit processor instructions that Windoze ever has.
(Mandrake Linux 6.0-7.2)  Add to that the fact that Perl originated on
the Unix platforms;  More code is required in the Win32 ports of Perl to
interface Perl's unix-centric methods to Win32's backwards methods,
which means it takes slightly more time to do too many things.  This
difference may be insignificant in most cases, but it can add up in
large applications.

So, in my admittedly biased opinion:

	$perl->speed('linux') > $perl->speed('win32')

-- 
-Tim Hammerquist <timmy@cpan.org>

Just because my fingers are in my ears doesn't mean I'm ignoring you.
	-- Larry Wall


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

Date: Fri, 08 Dec 2000 22:37:52 GMT
From: Joel Nelson <joelnelson@home.com>
Subject: Re: ActivePerl Problem
Message-Id: <3A316299.6C545ADA@home.com>

Csaba Raduly wrote:

> A million monkeys weren't enough! It took Joel Nelson
> <joelnelson@home.com> on 08 Dec 2000 to produce
> <3A307F69.138946D1@home.com>:
>
> >alazarev1981@my-deja.com wrote:
> >
> >> I've installed ActivePerl 5.6.0.620 on my windows NT. I can run my
> >> file (blah.cgi) from the command line and it works perfectly,
> >> spits out the html taged code with no errors. However, when I try
> >> to run that same script from an HTML form (action="blah.cgi") it
> >> doesn't work. All I get is the .cgi file literally printed into my
> >> browser.
> >
> >Your web server is misconfigured for running .cgi scripts.
> >
> >> I have the exact same files running and working on a unix server,
> >> so I think the error is not in my code.
> >
> >Quite possibly.
> >
> >> I suspect the problem is in the first line of the .cgi file:
> >> #!/usr/local/bin/perl
> >
> >Thats not the problem. However, when you get the web server
> >configured correctly you will get 'Internal Server Error' because
> >your shebang line '#!/usr/local/bin/perl' is indeed incorrect.  It
> >should point to your perl executable something like
> >'#!d:\perl\bin\perl'. Note the slashes are windows style but just
> >for that line.
> >
>
> That should either be #!d:\\perl\\bin\\perl or, more simply (gram?)
> #!d:/perl/bin/perl
>
> *My* perl.exe is d:/usr/bin/perl.exe
>
> If you have perl.exe in the path, the simplest is #!perl (but that
> wouldn't work on Unix, which is the system where the #! (shebang) line
> really has a meaning.
>
> Of course, none of this is a solution to the original problem (probably
> a server misconfiguration)
>
> --
> Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
> mailto:csaba.raduly@sophos.com      http://www.sophos.com/
> US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
> ... you'll be the first against the -pedantic -Wall -W

Guess it's been several versions since I tried it but it appears now to
work like:
#!d:/perl/bin/perl
or
#!d:\perl\bin\perl
but internal server error on
#!d:\\perl\\bin\\perl

Hmmm.



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

Date: Fri, 08 Dec 2000 20:06:04 GMT
From: iowa88_song88.remove_eights@hotmail.com (Weston Cann)
Subject: Algorithm::Diff -- why does diff() return LOLOL instead of LOL?
Message-Id: <iowa88_song88.remove_eights-0812001312100001@121.salt-lake-city-08-09rs.ut.dial-access.att.net>

I'm looking at the documentation about Algorithm::Diff, and I don't
quite get why the list returned from diff is a list of lists of lists,
rather than simply a list of lists. For the example:

 a b c e h j l m n p
 b c d e f j k l m r s t

if we use the included diff function on the two lists, the documentation
says we get:

[ 
   [ [ '-', 0, 'a' ] ],       

   [ [ '+', 2, 'd' ] ],

   [ [ '-', 4, 'h' ] , 
     [ '+', 4, 'f' ] ],

   [ [ '+', 6, 'k' ] ],

   [ [ '-', 8, 'n' ], 
     [ '-', 9, 'p' ], 
     [ '+', 9, 'r' ], 
     [ '+', 10, 's' ], 
     [ '+', 11, 't' ],
   ]
 ]


why couldn't we simply have:

[ 
   [ '-', 0, 'a' ],       
   [ '+', 2, 'd' ],
   [ '-', 4, 'h' ], 
   [ '+', 4, 'f' ],
   [ '+', 6, 'k' ],
   [ '-', 8, 'n' ], 
   [ '-', 9, 'p' ], 
   [ '+', 9, 'r' ], 
   [ '+', 10, 's' ], 
   [ '+', 11, 't' ]
]

wondering....

=================================================================
"The best laid plans of mice and men are about equal."
iowa_so8ng@hot8mail.com 
Address is spam repelant. Remove eights to reach me.


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

Date: 08 Dec 2000 21:04:20 GMT
From: fryar386@aol.com (Fryar386)
Subject: Anywhere to put my scripts?
Message-Id: <20001208160420.23148.00004451@ng-fv1.aol.com>

Does anyone know of a good place to put my scripts?


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

Date: Fri, 8 Dec 2000 22:33:45 +0100
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: Anywhere to put my scripts?
Message-Id: <MPG.149b7225a9802cbd9896f2@news.btx.dtag.de>

In article <20001208160420.23148.00004451@ng-fv1.aol.com>, Fryar386 aka 
fryar386@aol.com says...

> Does anyone know of a good place to put my scripts?

/dev/null

SCNR

gruß
thoren
8#X

-- 
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com


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

Date: Fri, 08 Dec 2000 17:38:26 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Anywhere to put my scripts?
Message-Id: <3A3162E1.C5259854@patriot.net>

yourscripts | /dev/null ?

Fryar386 wrote:

> Does anyone know of a good place to put my scripts?

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: Fri, 08 Dec 2000 22:22:24 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Anywhere to put my scripts?
Message-Id: <3a415ebf.372343329@news.tcn.net>

On Fri, 08 Dec 2000 17:38:26 -0500, H C <carvdawg@patriot.net> wrote:

>yourscripts | /dev/null ?
>
Data written on a null or zero special file is discarded.

 ./program.pl > /tmp/gooddata.txt 2> /dev/null

Just don't fill it all the way up!

--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Fri, 08 Dec 2000 19:26:35 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Apache on Linux - Error on scripts called thru browser
Message-Id: <slrn932dj3.1v7.tim@degree.ath.cx>

> However when I call them thru the browser I get these *two* messages on
> the error_log .
>
> [Thu Dec  7 04:42:31 2000] [error] (2)No such file or directory: exec
> of /home/httpd/cgi-bin/test.pl failed
>
> [Thu Dec  7 04:42:31 2000] [error] [client 192.168.100.132] Premature
> end of script headers: /home/httpd/cgi-bin/test.pl
>
> To clarify

> For the first error--> the file *does* exist in the specified directory.
> Forthe second error--> The Perl file does start with #!/usr/bin/perl.

Your interpretation of the second error is incorrect.  "Premature end of
script headers" means that the script didn't produce the correct HTTP
headers to create a valid HTTP response.  At the bare minimum, a script
must create a 'Content-type' header, followed by one line consisting
solely of a newline.  This is usually accomplished by:

	print "Content-type: text/html\n\n";
or:
	use CGI;
	my $q = new CGI;
	print $q->header;

The post stating that your second error is related to your first is
correct; a script that can't run can't produce a correct header.

Standard solution:
	1. Check that perl is in the correct location (usually /usr/bin/perl
	or /usr/local/bin/perl )
	2. Check that the script has permissions set correctly and that the
	script is visible through Apache's virtual directory structure (ie,
	through Alias or ScriptAlias.
	3. Make sure the script is producing the correct headers.

If you post on this topic again, you'd do well to post your script.
Though you still run the risk of being flamed for OT posting.  =)
-- 
-Tim Hammerquist <timmy@cpan.org>
Love is like racing across the frozen tundra on a
snowmobile which flips over, trapping you underneath.
At night, the ice-weasels come.


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

Date: 8 Dec 2000 21:43:59 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Can anybody help ???
Message-Id: <slrn932lgv.sn8.dha@panix2.panix.com>

On Fri, 8 Dec 2000 13:17:26 +1300, Kelvin Sim <kjs404@hotmail.com>
wrote:

>chop $an;

You didn't actually ask about this, but I imagine you want to use
chomp() here, rather than chop().  Of course, I could be mistaken...

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Mysticism has no place in programming.
	  - Larry Rosler


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

Date: Fri, 08 Dec 2000 21:34:40 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Can anybody help ???
Message-Id: <3a3f53ba.369521030@news.tcn.net>

On Fri, 8 Dec 2000 13:17:26 +1300, "Kelvin Sim" <kjs404@hotmail.com>
wrote:

>Hi All
>
>Sorry for being a pain, as I'm learning as I go along....
>
>What is wrong with this statement
>
>print ("Do you wish to continue ? y / n ");
>$an = <STDIN>;
>chop $an;
>if ($an eq "N") {
	print "OK Have a good one\n";
	exit;
>} else { print ("Still running... ");
>}
>


--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Fri, 08 Dec 2000 19:14:57 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: combining regexps into one
Message-Id: <90rbv9$vs7$1@nnrp1.deja.com>



In a loop to find links from a webpage, I have:
if ($source =~ /href="(.*?)"/gi)

I would like to expand on this to find more links.
$source =~ /href=(.*?)>/gi
$source =~ /href='(.*?)'/gi
$source =~ /href=(.*?)[\s]/gi

Can I combine these 4 regexps into one?  I know that /ALPHA/ || /BETA/
can be expressed as /ALPHA|BETA/.  However, I tried that and it didn't
work:

$source =~ /href="(.*?)"|href=(.*?)>|href='(.*?)'|href=(.*?)[\s]/gi

Any help will be appreciated.  Thanks.

--
Dave Brondsema


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


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

Date: Fri, 08 Dec 2000 19:59:03 GMT
From: eggrock@my-deja.com
Subject: Re: combining regexps into one
Message-Id: <90rei3$23n$1@nnrp1.deja.com>

In article <90rbv9$vs7$1@nnrp1.deja.com>,
  Dave Brondsema <brondsem@my-deja.com> wrote:
>
>
> In a loop to find links from a webpage, I have:
> if ($source =~ /href="(.*?)"/gi)
>
> I would like to expand on this to find more links.
> $source =~ /href=(.*?)>/gi
> $source =~ /href='(.*?)'/gi
> $source =~ /href=(.*?)[\s]/gi
>
> Can I combine these 4 regexps into one?

while(/href=['|"]?(+)/gi) {
   $addy = $1;
}

There's probably a better way to match the actual hyperlink than
[a-z_0-9\-\.:\/\#]

You could play around with $' as well, I don't know if it's more
efficient than a while loop with /g..

That'll grab all instances on a

Happy hacking,
eggrock


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


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

Date: Fri, 8 Dec 2000 16:18:52 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: combining regexps into one
Message-Id: <slrn932k1s.1th.tadmc@magna.metronet.com>

eggrock@my-deja.com <eggrock@my-deja.com> wrote:
>In article <90rbv9$vs7$1@nnrp1.deja.com>,
>  Dave Brondsema <brondsem@my-deja.com> wrote:
>>
>>
>> In a loop to find links from a webpage, I have:
>> if ($source =~ /href="(.*?)"/gi)
>>
>> I would like to expand on this to find more links.
>> $source =~ /href=(.*?)>/gi
>> $source =~ /href='(.*?)'/gi
>> $source =~ /href=(.*?)[\s]/gi
>>
>> Can I combine these 4 regexps into one?
>
>while(/href=['|"]?(+)/gi) {
>   $addy = $1;
>}


Oh puhhlease.

It is nice that you are trying to help, but your "help" has
multiple problems itself, requiring that someone give yet
more help to straighten out the mess.

Please be sure that your code will work (which implies that
it also compiles) before you post it.

If you can't be bothered to test it, don't post it.


Your code does not compile.

Your code allows vertical bars as the quote char,

   href=|foo.com

will match your pattern (assuming you first fix it so that it
will compile).

You should find out how character classes work if you want to
use character classes.


>You could play around with $' as well, I don't know if it's more
                            ^^                               ^^^^
>efficient than a while loop with /g..
 ^^^^^^^^^


Using $' (or $` or $&) slows down every single pattern match
throughout your entire program. Mentioning it once can make
your program 10 times slower.

Mentioning it in connection with efficiency is just plain silly.


>That'll grab all instances on a


Did your post get truncated?


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 08 Dec 2000 19:21:15 GMT
From: spam@s.patterson.freeuk.com (Stephen Patterson)
Subject: compiling scripts with Active State perl
Message-Id: <LwaY5.26452$eT4.2132404@nnrp3.clara.net>

I need to compile a perl script on windows 95, which compiler would you 
recommend (free/GPL only please).

-- 
To craunch a marmoset.
		-- Pedro Carolino, "English as She is Spoke"
--	--	--	--	--	--	--	--	--	--
Stephen Patterson	s.patterson@SPAMOFFfreeuk.com (Remove SPAMOFF to reply)


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

Date: Fri, 08 Dec 2000 19:39:28 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: compiling scripts with Active State perl
Message-Id: <slrn932eb8.1v7.tim@degree.ath.cx>

Stephen Patterson <spam@s.patterson.freeuk.com> wrote:
> I need to compile a perl script on windows 95, which compiler would you 
> recommend (free/GPL only please).

I'd just like to wish you luck in finding a free/GPL Perl compiler on the
Win32 platform.  All the solutions I've heard about involve changing
either your price range or your platform.

-- 
-Tim Hammerquist <timmy@cpan.org>
I respectfully decline the invitation
to join your hallucination.
	-- Dilbert


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

Date: 08 Dec 2000 13:45:39 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: count number of occurrences in string
Message-Id: <1rg0jyd7do.fsf@video.bsd.uchicago.edu>

What is the best way to count the number of times a specific character
occurs in a string.

Specifically, I would like to count the number of recipients in a CC:
field of an email address which I have as a string.  I thought one easy
way would be to count the number of '@' symbols.  Right now I am using

@lines = split /\@/, $recipients if $recipients;
$num = scalar(@lines) - 1;

#then readjust $num=-1 to $num=0.

Seems like there will be a better way in perl.

Thanks,
John 


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

Date: Fri, 8 Dec 2000 14:15:54 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: count number of occurrences in string
Message-Id: <slrn932cra.1nk.tadmc@magna.metronet.com>

John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
>What is the best way to count the number of times a specific character
>occurs in a string.


   $count = $addr =~ tr/@//;


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 08 Dec 2000 14:33:38 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: count number of occurrences in string
Message-Id: <1r4s0ed55p.fsf@video.bsd.uchicago.edu>

>>>>> "Tad" == Tad McClellan <tadmc@metronet.com> writes:

    Tad> John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
    >> What is the best way to count the number of times a specific
    >> character occurs in a string.


    Tad>    $count = $addr =~ tr/@//;

Perfect, thanks.

JDH


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

Date: Fri, 08 Dec 2000 21:54:40 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: CSS files in a cgi script
Message-Id: <3a405826.370653454@news.tcn.net>

On Fri, 8 Dec 2000 01:12:22 -0000, "Virgin News"
<c.darlington@virgin.net> wrote:

>Is it possible to link a .css file in a cgi script to format the html output
>of the script?

print <<EOF;
<html>
 .....
open(IN, "$somepath/text.css");
for(<IN>) { print $_; }
close(IN);
 ....
# the rest of the html

--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: 08 Dec 2000 16:11:45 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: CSS files in a cgi script
Message-Id: <87hf4eimvy.fsf@limey.hpcc.uh.edu>

>> On Fri, 8 Dec 2000 01:12:22 -0000,
>> "Virgin News" <c.darlington@virgin.net> said:

> Is it possible to link a .css file in a cgi script to
> format the html output of the script?

There's an example in:

perldoc CGI

       CREATING THE HTML DOCUMENT HEADER

              -style=>{'src'=>'/styles/style1.css'},

hth
t
-- 
Eih bennek, eih blavek.


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

Date: 08 Dec 2000 18:59:15 +0000
From: nobull@mail.com
Subject: Re: default method
Message-Id: <u9itoueo3g.fsf@wcl-l.bham.ac.uk>

"Jason Holland" <jasonh_/dev/null_autonomy.com> writes upside down
which should be taken as a warning to disregard his advice:

> Operator overloading?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 08 Dec 2000 19:01:09 +0000
From: nobull@mail.com
Subject: Re: default method
Message-Id: <u9hf4eeo0a.fsf@wcl-l.bham.ac.uk>

nobull@mail.com writes:

> "Jason Holland" <jasonh_/dev/null_autonomy.com> writes upside down
> which should be taken as a warning to disregard his advice:
> 
> > Operator overloading?

Scratch that, I'm talking rubbish.  _I_ missread the question.  Jason
was talking sense despite is jeopary posting.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 8 Dec 2000 14:32:09 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: default method
Message-Id: <Pine.GSO.4.21.0012081431570.19543-100000@crusoe.crusoe.net>

On Dec 8, nobull@mail.com said:

>nobull@mail.com writes:
>
>> "Jason Holland" <jasonh_/dev/null_autonomy.com> writes upside down
>> which should be taken as a warning to disregard his advice:
>> 
>> > Operator overloading?
>
>Scratch that, I'm talking rubbish.  _I_ missread the question.  Jason
>was talking sense despite is jeopary posting.

Yay prejudice.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: Fri, 08 Dec 2000 21:29:28 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Displaying an image
Message-Id: <3a3c5276.369197197@news.tcn.net>

>
>I have tried using the following line but it doesnt work.
>
>print "<img src='footie.jpg'>";
>
>Can anyone help please?
>

print qq{<img src="footie.jpg">};

Make sure your path to footie.jpg is correct, maybe check your
error_log.


--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: 08 Dec 2000 21:00:15 GMT
From: fryar386@aol.com (Fryar386)
Subject: Does it matter?
Message-Id: <20001208160015.23148.00004448@ng-fv1.aol.com>

Do you have to chmod Text files?  I have a PERL file that saves to a text file,
but it never saves the file.  I asked one of my friends what was wrong, but he
said it saved the data fine

Thanx


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

Date: Fri, 08 Dec 2000 20:56:33 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Does it matter?
Message-Id: <3a3a4a3a.367088929@news.tcn.net>

On 08 Dec 2000 21:00:15 GMT, fryar386@aol.com (Fryar386) wrote:

>Do you have to chmod Text files?  I have a PERL file that saves to a text file,

This would only be required on UNIX, I'm assuming you new that but
just incase.  Your server will have a default mode for file creation,
most times 0644, which is everybody can read only the owner can write.

If this mode is not acceptable use chmod to override it.

perldoc -f chmod


--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Fri, 08 Dec 2000 21:16:17 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Does it matter?
Message-Id: <slrn932k0q.2qi.tim@degree.ath.cx>

Fryar386 <fryar386@aol.com> wrote:
> Do you have to chmod Text files?  I have a PERL file that saves to a text file
> but it never saves the file.  I asked one of my friends what was wrong, but he
> said it saved the data fine

Um, so which of you is right? You or your friend?  Does the file exist?
Does it contain the information it should?

Are you checking the return value of your open() command?  eg:

: open OUT, ">$filename" or die "Can't open $filename for writing: $!\n";
: print OUT $data_for_file;
: close OUT or die "Can't close $filename: $!\n";

If the open() statement is creating the file, you need write permissions
to the directory in which it's created.  If it's just modifying or
appending to the file, you need write permissions for the file itself.

You might want to check the value of `umask` to find out what
permissions the file is being created with.

-- 
-Tim Hammerquist <timmy@cpan.org>
Dozens of people spontaneously combust each year,
it's just not really widely reported.
	-- David St. Hubbins, "This is Spinal Tap"


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

Date: Fri, 08 Dec 2000 22:06:16 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Execute perl code enterred at run time?
Message-Id: <t32mqoptu3bp77@corp.supernews.com>

Dominic Hibbs (mtx064@coventry.ac.uk) wrote:
: Is it possible to execute perl code in a program which has received the
: code from the user at run time.

perldoc -f eval

You must of course be extremely careful about blindly executing input from
untrusted users.  One eval of `rm -rf /` can ruin your whole day.  Taint
checking is extremely helpful in this regard, at least to the extent that
it forces you to think about the issue.

[snip]
: If the user types 30 PRINT "Hello World!"
: Line 30 will be added to the program and Hello World! will be printed.  
: Without the line number, Hello World! will be printed but not added to 
: the program.

It's unclear what adding a line to the text of a perl script dynamically
would mean or do, but fortunately you can't do it.  Your eval'd code is
executed at the place and in the context where/when the eval occurs.

: Less trivial you can write programs which will allow mathematical 
: functions to be enterred by the user and evaluated.

You can do a one-liner perl shell like this:

  perl -ne 'print eval, "\n"'

This will take each line you type and eval it, printing the results.  The
full range of perl math operators and functions (and everything else) is
available.  But again, evil evals will be executed blindly, so be careful.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "The hills are burning, and the wind is raging; and the clock
   |   strikes midnight in the Garden of Allah." - Don Henley


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

Date: Fri, 8 Dec 2000 15:06:35 -0500
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: FTP question
Message-Id: <90rf0b$4s1$1@panther.uwo.ca>

> #!/u/l/b/p
>
> my $file = "path/dir/file";
> my $N = someNumber #number of lines to read;
>
> open (LOG, "tail -$Nl $file|") || die "errStr";
> my @lines=<LOG>;

This of course requires that the entire log file is ftp'd across...




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

Date: Fri, 08 Dec 2000 22:46:03 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: FTP question
Message-Id: <LwdY5.67$B9.170900480@news.frii.net>

In article <90qolq$78r$1@panther.uwo.ca>,
Darryl Olthoff <olthoff@multiboard.com> wrote:
>
>use strict;
>use Net::FTP;
>
>my ($FTP, $File, $Size, $RecordLength);
>$RecordLength = 95;
>$File = 'this.log');
>
>$FTP = Net::FTP->new('host') || die("Unable to connect to host\n");
>$FTP->login('username', 'password') || die("Unable to login to server\n");
>$FTP->cwd('/pathtofile/') || die("Unable to change to path\n");
>$Size = $FTP->size($File);
>$Size = $Size - (400 * $RecordLength);
>if ($Size < 0) { $Size = 0; };
>$FTP->get($File, '/localpath/' . $File, $Size) || die("Unable to get the
>last 400 records of the file\n");
>$FTP->quit;
>

My testing of this indicated that I needed to add

    $FTP->binary;

before doing the get.  My testing code appears below:

Good Luck
chris

use strict;
use warnings;
use Net::FTP;

my $ftp = Net::FTP->new('ftp.cdrom.com') or die "$0: can't connect";
$ftp->login('anonymous', 'cfedde@bigi.com') or die "$0: can't login";

$ftp->cwd('/pub/doom/') or die "$0: cant chdir to doom";
$ftp->binary or die "$0: cant set binary mode";
$ftp->get('ls-laR.gz', 'test', 400) or die "$0: can't get ls file";
-- 
    This space intentionally left blank


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

Date: Fri, 08 Dec 2000 23:51:43 +0100
From: Christoph <cvh@gmx.de>
Subject: How do I find out my own IP Address?
Message-Id: <3A3165FF.A1434D27@gmx.de>

Hello,

could anybody tell me how to find out the IP-address that my
internet-provider gives me at dial-up?
I allready searched CPAN but I couldn't find anything that looks like a
solution.

Thank you,
  Christoph


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

Date: 08 Dec 2000 18:52:05 +0000
From: nobull@mail.com
Subject: Re: How to get the filename???
Message-Id: <u9lmtqeofe.fsf@wcl-l.bham.ac.uk>

<vidulats@yahoo.co.uk> writes:

> Is there any way by which I can get the file name of the currently 
> executing process. (I don’t want to use $0)

Can you explain why you don't want to use $0?  What information do you
want?  

"The file name of the currently executing process" doesn't really mean
anything because processes are not files.

The secial variable $^X contains a reaonable guess at the name of the
file contain the Perl executable itself.

The constant __FILE__ contains the name of the current source file.

> I have the process ID with me. 
> How can I get the file name by using this process ID?

Are you asking about getting the filename of the binary executable
associated with a given process? 

There's no portable way - go ask in an OS-specific group.

For example in Linux it's readlink("/proc/$pid/exe").

I notice you also started a different thread in which you wanted to
ask "How do I find the name on the source file from which a subroutine
was called?", but couldn't actually bring yourself to ask the question.

Also for some unfathomable reason you entitled that thread "Process_ID
stuff???" and this one "How to get the filename???" would I be right
in concluding you managed to get the message bodies and subjects
transposed?  Or perhaps this is an even more obfuscated attempt to ask
the same question.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 08 Dec 2000 14:41:14 -0800
From: "Thomas C. Jones" <tjones@computer.org>
Subject: How to install SWIG on NT
Message-Id: <3A316388.5EE928DE@computer.org>

I have stupid newbie question.  Do I have to do the full
configure->make, etc. procedure to install the NT SWIG package?  If so
why is there already a swig.exe.  If not what is the install procedure?

Thanks, T



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

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 5066
**************************************


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