[12758] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 168 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 16 15:17:18 1999

Date: Fri, 16 Jul 1999 12:05:12 -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           Fri, 16 Jul 1999     Volume: 9 Number: 168

Today's topics:
        "cutting" part of a file <dan@fearsome.net>
    Re: "cutting" part of a file <emschwar@rmi.net>
    Re: bogus "used only once" message? (I R A Aggie)
    Re: cant install WWW::Search on NT <mthurn@tasc.com>
    Re: CGI with Postscript? <kikim@cerc.utexas.edu>
        Closing Web Browser Connection on Lengthy Processes bane_dewitt@my-deja.com
        date_command in NT <elvar@tamula.edu.ee>
    Re: date_command in NT <hannak@kodak.com>
    Re: DBI - alternate row colors (brian d foy)
    Re: DBI - alternate row colors <uri@sysarch.com>
    Re: die ? <emschwar@rmi.net>
        Exclusive range operator ( ... ) (Phil Tomson)
    Re: Foreach on hash gives undefined value <iansmith@pepper.ncinter.net>
    Re: Help!: trying to compile my scripts <msoulier@americasm01.nt.com>
        Hex dump xdiv@hotmail.com
        London.pm First Anniversary (Dave Cross)
    Re: long explanations wearying (was Re: Top 10 response <emschwar@rmi.net>
    Re: My Foot Hurts <jcreed@cyclone.jprc.com>
    Re: Newbie requires help in Perl please <camerond@mail.uca.edu>
    Re: PDF-TXT <hiller@email.com>
    Re: PDF-TXT (Larry Rosler)
    Re: problem with WWW::Search <mthurn@tasc.com>
    Re: Problem: how can a CGI read files on another server <cs2400@hotmail.com>
    Re: Problem: how can a CGI read files on another server (Jerome O'Neil)
    Re: Problem: how can a CGI read files on another server (brian d foy)
        Q: passing array/hash from one subroutine to another su anne_fong9999@my-deja.com
        Q: passing array/hash from one subroutine to another su anna@water.ca.gov
        Reading user input on Win32 <hannak@kodak.com>
    Re: Remove leading zeros from a string (Larry Rosler)
        searching man pages, perldoc's, FAQ's, README's, HOWTO' <dchristensen@california.com>
    Re: Symbolic Link problem <uri@sysarch.com>
        trouble getting process ID's amidalla@my-deja.com
    Re: UPS Rate Calculator? Have you programmed for it? (brian d foy)
    Re: UPS Rate Calculator? Have you programmed for it? <will@cs.umb.edu>
    Re: What does this error message mean? (M)
    Re: Where to start with perl programming ? <martin@adoma.se>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 16 Jul 1999 18:30:35 +0100
From: "Dan Adams" <dan@fearsome.net>
Subject: "cutting" part of a file
Message-Id: <932147942.3466.0.nnrp-02.c2deb1c5@news.demon.co.uk>

Hi,

I am writing a perl script to be used as part of a CGI application. A
particular subroutine must read a text file into memory (I can do this) and
then cut a part of the file out and paste it into a second file.(I can't do
this)

The part intended for cutting is marked by a delimiter such as <start> at
the beginning and continues until the end of the file, no matter how long
the file is.

I know how to write the cut section to a second file once I have it, but I
am unsure how I (?-) assign a variable to the portion of the file from
<start> until the end of the file, and another varable to everything before
this. Can someone give me some handy pointers. I don't have Perl, and
therefore no manpages, on my local system, but I have downloaded a copy from
perl.com, and they don't seem to be too much help - no doubt they are if you
know what it is that you're looking for, but I don't. I know what I want to
do, but not what it is called or how to do it.

Can anyone help me please?

Thanks

Dan Adams
dan@fearsome.net




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

Date: 16 Jul 1999 12:36:12 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: "cutting" part of a file
Message-Id: <xkfd7xsjvc3.fsf@valdemar.col.hp.com>

"Dan Adams" <dan@fearsome.net> writes:
> Can someone give me some handy pointers. I don't have Perl, and
> therefore no manpages, on my local system, 

Since you appear to be on a PoB system, from your headers:

X-Newsreader: Microsoft Outlook Express 5.00.2615.200

You can go to <URL:http://www.activestate.com/ActivePerl/> and get Perl.

> but I have downloaded a copy from perl.com, and they don't seem to be
> too much help - no doubt they are if you know what it is that you're
> looking for, but I don't.

ActivePerl also comes with all the docs, not only available from perldoc, 
but with your favourite handy-dandy web browser.  The "perlfaq" entry has 
a list of all the questions in the FAQ, and the section you can find them 
in.

It appears the question in perlfaq5:

How do I change one line in a file/delete a line in a file/insert a
line in the middle of a file/append to the beginning of a file?

is probably relevant here.  Just to keep it fresh, your question
specifically is:

> I am writing a perl script to be used as part of a CGI application. A
> particular subroutine must read a text file into memory (I can do this)
> and then cut a part of the file out and paste it into a second file.(I
> can't do this)

Assuming you mean "remove from the file" when you say "cut", then you
want the "delete" part of the FAQ.  By "paste", I don't know what you
mean.  Are you trying to:

1) Append to the end of an existing file
2) Prepend to the beginning of an existing file
3) Insert somewhere in the middle of an existing file
4) Create an entirely new file, whose contents are what you removed from
   the first file.

You may also want to look at the -i switch in perlrun.

> I know what I want to do, but not what it is
> called or how to do it. 

Could you please enlighten us as to what you want to do?  The problem
with fuzzy specs is you get fuzzy answers.

-=Eric


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

Date: 16 Jul 1999 18:32:47 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: bogus "used only once" message?
Message-Id: <slrn7ouuqo.lpe.fl_aggie@thepentagon.com>

On 16 Jul 1999 16:28:48 GMT, Mark H. Wood <mwood@mhw.ULib.IUPUI.Edu>, in
<7mnmk0$66r$1@hercules.iupui.edu> wrote:

+ Here's a 1-liner example:

+   mhw:~$ head netset.pl
+   # data converted from NETSET.BAT
+   %jacks = (
+     "00:C0:4F:C5:F9:BE","ITGXMT",
+     "00:A0:24:29:AC:9C","0106-C2",
+     "00:A0:24:26:97:58","0106-D2",
+     "00:A0:24:29:B6:3D","0106-E1",
+     "00:A0:24:29:B6:45","0106-H2",
+     "00:A0:24:29:B0:A9","0106-I1",
+     "00:A0:24:29:B6:B8","0106-I2",
+     "00:A0:24:26:99:A9","0106-L1",

I used this as the file...

+   mhw:~$ perl -e 'do "netset.pl"; print $jacks{"00:C0:4F:B3:95:16"};'

and made these changes:

perl -e 'do "netset.pl"; print $jacks{"00:C0:4F:C5:F9:BE"},"\n";'

+   Name "main::jacks" used only once: possible typo at -e line 1.

My result:

ITGXMT

+   mhw:~$ perl --version
+   This is perl, version 5.005_03 built for i686-linux

Is this a package (rpm, deb, ???) or did you hand-build it?

	% perl -v
	This is perl, version 5.005_03 built for i686-linux

I hand-built mine. I get the same results under Solaris:

	> perl -v
	This is perl, version 5.005_02 built for sun4-solaris

Curious.

James


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

Date: 16 Jul 1999 13:06:07 -0400
From: Kingpin <mthurn@tasc.com>
Subject: Re: cant install WWW::Search on NT
Message-Id: <eun1ww8qyo.fsf@copper.dulles.tasc.com>

smnayeem7346@my-deja.com writes:
> I have been trying to install the WWW::Search

You should ask about it on comp.lang.perl.modules or better yet, the
WWW::Search mailing list as described in the README file.

> Ambiguous call resolved as CORE::warn(), qualify as such or use & at
> f:/Perl/site/lib/HTML/TreeBuilder.pm line 160.

This is a "bug" in HTML::TreeBuilder.  You can ignore it.

> Warning: prerequisite LWP 5.3 not found at (eval
> 1) line 220.

use PPM to install libwww-perl

-- 
 - - Martin "Kingpin" Thurn                    mthurn@tasc.com
     Research Software Engineer           (703) 793-3700 x2651
     The Information Refinery              http://tir.tasc.com
     TASC, Inc.                            http://www.tasc.com

I knew you were going to say that! -- Han, Star Wars


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

Date: Fri, 16 Jul 1999 13:02:03 -0500
From: Kyoil Kim <kikim@cerc.utexas.edu>
Subject: Re: CGI with Postscript?
Message-Id: <378F739B.7505906@cerc.utexas.edu>

Thanks a lot for your concern.

Anno Siegel wrote:

> Kyoil Kim  <kikim@cerc.utexas.edu> wrote in comp.lang.perl.misc:
> >I executed the following cgi program, which shows simple ps file in a
> >web browser, but I got an error message
> >"the document contains no data". I don't know why. The codes are exactly
> >same with the one in the O'Reilly &
>
> Probably too exactly the same.
>
> >Associates's book, CGI programming. Please let me know what the problem
> >is. Thanks.
> >The codes are as follows.
> >=====================================================================
> >
> >#!/usr/local/bin/perl
> >
> >$GS = "usr/local/bin/gs";
>
> [snip]
>
> You have checked that gs is in /usr/local/bin on your server, haven't
> you?
>

Sure!

> Anno



--
================================
Kyoil Kim
Student in Ph.D. Program
Electrical and Computer Engineering
University of Texas at Austin
kikim@cerc.utexas.edu
Office) 512-471-8012





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

Date: Fri, 16 Jul 1999 18:24:09 GMT
From: bane_dewitt@my-deja.com
Subject: Closing Web Browser Connection on Lengthy Processes
Message-Id: <7mntbp$n10$1@nnrp1.deja.com>

Is this a perl question or a CGI question? I am trying to perform a CGI task
using perl...

I am about to write a perl program that parses web hit logs and produces a
report. Sometimes the report generation takes up to 20 minutes, so I would
like for the program to print to the browser, "Report is running, check your
e-mail soon", and then close the browser connection, and continue to run the
report (e-mailing the result).

I have read the fork perldoc and the Boutell/Kew FAQs, and wrote the
following test code (below). This prints "Hello World" to the browser, closes
STDOUT, and attempts to fork a process that waits 2 minutes and writes to a
file (to simulate a long-running process).

The problem is, the browser remains connected to the app for the whole 2
minutes, so obviously I'm not understanding this close(STDOUT)/fork business
very well.

Would someone please tell me what I'm doing wrong?

Here is the test code I am using:
-------------------

#!/usr/local/bin/perl -w
use strict;
my $pid;
$|++;

# Print to the browser and close

print <<EOF;
Content-type: text/html

Hello World

EOF

close STDOUT;


# Now run the time-consuming code in its own process

unless ($pid = fork) {
  unless (fork) {

    # wait 2 minutes, simulating actual processing
    sleep 120;

    # Write something to a file, to indicate that something happened
    open (OUT, ">temp.txt") or die "Can't open temp.txt for output: $!";
    print OUT 'FOO';
    close(OUT);

    exit 0;
  }
  exit 0;
}
waitpid($pid,0);





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


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

Date: Fri, 16 Jul 1999 21:10:34 +0300
From: "Elvar Ojar" <elvar@tamula.edu.ee>
Subject: date_command in NT
Message-Id: <7mnskl$p0r$1@kadri.ut.ee>

Well, my english is not best but I try. I have guestbook that works well but
have some problems also. This guestbook was meant to use with Linux but I
have NT. So, where is command that puts date to the homepage with other
info. $date_command = /usr/bin/date"; It dosent work with NT, but is it
possible, and if it is then how?

Elvar Ojar






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

Date: Fri, 16 Jul 1999 14:38:30 -0400
From: Victor Hannak <hannak@kodak.com>
Subject: Re: date_command in NT
Message-Id: <378F7C26.6500D5E4@kodak.com>

There are lots o' ways:

Look into

Time::local

Or you can use the built-in "time()" function and then convert it to readable
format using

html::date "time2str()" command.



Elvar Ojar wrote:

> Well, my english is not best but I try. I have guestbook that works well but
> have some problems also. This guestbook was meant to use with Linux but I
> have NT. So, where is command that puts date to the homepage with other
> info. $date_command = /usr/bin/date"; It dosent work with NT, but is it
> possible, and if it is then how?
>
> Elvar Ojar



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

Date: Fri, 16 Jul 1999 12:20:40 -0500
From: brian@pm.org (brian d foy)
Subject: Re: DBI - alternate row colors
Message-Id: <brian-1607991220410001@16.chicago-01-02rs.il.dial-access.att.net>

In article <378F2B53.D000DC91@sergeant.org>, Matt Sergeant
<matt@sergeant.org> wrote:

>brian d foy wrote:
>> 
>>    $index++;
>>    $index = $index % $#colors;
>>    }
>
><pedantic>
>Why have separate lines?
>
>$index = ++$index % $#colors;
></pedantic>

separate lines so i don't have to answer a question about what the
one line does.  i guess that didn't work. ;)

notice a logic error in my original code though.  we'll never get to
access the last color in the list!

   $index = $index % ($#colors + 1)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 16 Jul 1999 13:41:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: DBI - alternate row colors
Message-Id: <x71ze8lcew.fsf@home.sysarch.com>

>>>>> "bdf" == brian d foy <brian@pm.org> writes:

  bdf> notice a logic error in my original code though.  we'll never get to
  bdf> access the last color in the list!

  bdf>    $index = $index % ($#colors + 1)


aw, come on brian, you did it again. try this:

	$index %= @colors ;

fairly obvious what it does and means.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 16 Jul 1999 11:20:05 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: die ?
Message-Id: <xkfhfn4jyuy.fsf@valdemar.col.hp.com>

Ian Mortimer <ianmorty@nortelnetworks.com> writes:
> open (CHANGED ,">$copy_file") || die "Couldn't open $copy_file \n";

Aside from reading the FAQs others have pointed you to, there's one thing
you forgot: $! 

Check out what it does-- it's practically made to order for this
instance.

-=Eric


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

Date: 16 Jul 1999 10:49:30 -0700
From: ptkwt@user2.teleport.com (Phil Tomson)
Subject: Exclusive range operator ( ... )
Message-Id: <7mnrba$g0j$1@user2.teleport.com>



I'm parsing a file which has a structure like:
------------------  File Start ------------------
stuff...
begin
   otherstuff
end
stuff...
------------------  File End   ------------------

When using the range operator as follows:

if( /^begin/ .. /^end/ ) { print $_; }

The following lines are printed:

begin
   otherstuff
end

That's to be expected, but I want to just print the 'otherstuff' lines
between begin and end, so I want to use the exclusive range operator
(...), but it does exactly the same thing.  So if I use:

if( /^begin/ ... /^end/ ) { print $_;}

I still get:

begin
   otherstuff
end

What is the difference between .. and ... ?

There doesn't seem to be anything about the exclusive range operator in
the Camel book.

Phil
-- 
Phil Tomson
FreeHDL Project
http://www.freehdl.seul.org/


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

Date: Fri, 16 Jul 1999 17:23:03 GMT
From: Ian Smith <iansmith@pepper.ncinter.net>
Subject: Re: Foreach on hash gives undefined value
Message-Id: <XTJj3.3911$8c3.159710@typ41.nn.bcandid.com>

In comp.lang.perl.misc Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Wed, 30 Jun 1999 13:30:46 +1000 Justin Wills wrote:
> > yes, yes, there's no code.   but back to the question, DON'T use foreach on a
> > hash, use each or keys or values
>
> Sorry you seem to have missed the point - how else do you think one is
> going to process each of the keys of a hash without using for or foreach
> like the original poster was - the problem that Tom was pointing out was
> that the posted code was unrunnable .

I doubt he meant don't use the foreach command at all for hashes.

What he said was do not use:  foreach $var (%hash) 
Use this instead:             foreach $var (keys %hash)

--
$p=3;do{print substr('tr"esec"h au
ok rat rnJl,Phe',$p-1,1);$p=27*$p%29;}until $p==3



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

Date: Fri, 16 Jul 1999 14:05:58 -0400
From: "Soulier, Michael [SKY:1Z22:EXCH]" <msoulier@americasm01.nt.com>
Subject: Re: Help!: trying to compile my scripts
Message-Id: <378F7486.30E70985@americasm01.nt.com>

Don Smith wrote:
> 
> Thank you for you enlightening response.  Didn't anyone wonder why my

	Hey Don. Yeah, some of these people aren't much help are they? There
are definitely good people left here, but general attitude of many is
getting quite elitist. It's not quite as bad in here as comp.lang.c, but
it's getting there. The person that responded was apparently annoyed in
their perception that you did not read the FAQ, and asked that they saw
as a stupid question. Apparently they don't have time for stupid
questions. Stupid responses, _that_ they have time for, but not stupid
questions. And of course, stupid responses are so much more useful and
benevolent than stupid questions. 
	Just ignore the vitamin deficient. I do. 

> 1.  WHERE MIGHT I FIND PERLCC?  THE LINKS FROM CPAN ARE BOGUS.

	I tried perlcc, and I believe that it was unstable at this point. I
can't remember where. I can try and find it for you, if that's still a
point after this. There are some other techniques though. 

	I recently read an article in TPJ about source pre-processing, which
would allow one to write their own obfuscator. This might help you out.

	I have to ask though, if you don't mind, why you need to hide your
source? If you really need to, why in this manner? Would it be possible
to only hide the sensitive components of your source by placing them in
external files? 

	Anyway, just a thought. 	

	Mike

P.S. My opinions in no way represent the opinions of Nortel Networks,
they mine alone. 

-- 
Michael P. Soulier, 1Z22, SKY  Tel: 613-765-4699 (ESN: 39-54699)
Carrier Packet Solutions, Nortel Networks 
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort."  -Harley Hahn, A Student's Guide to UNIX


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

Date: Fri, 16 Jul 1999 17:41:10 GMT
From: xdiv@hotmail.com
Subject: Hex dump
Message-Id: <7mnqrk$lt0$1@nnrp1.deja.com>

Is there a way in perl to get a hex dump of a binary string?

For example, suppose I did:

      $s = pack("cci", 0x9, 0xff, 399);

I want a routine that would take $s and return "09ff0000018f".

Thanks,

Adam


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


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

Date: Fri, 16 Jul 1999 18:53:47 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: London.pm First Anniversary
Message-Id: <378f7df8.2493744@news.demon.co.uk>

It really doesn't seem possible, but it's almost a year since a dozen
or so geeks wandered shyly into the cellar bar of a pub in Holborn and
looked sheepishly around for other people carrying the Camel.

London.pm has come a long way in that year. We now have 100+ people on
our mailing list, we've bought our own computer and we're planning to
adopt a camel at London Zoo.

We thought it would be appropriate to celebrate our first anniversary
in style. When looking for something interesting to do we decided that
it simply couldn't be just coincidence that the Great British Beer
Festival was taking place at the same time as our August meeting.

More details will follow later, but this is just a bit of advance
warning that on Thursday August 5th, London.pm will be visiting the
Great British Beer Festival at Olympia. Any other Perl Mongers that
can in be town (or even in the country) that night would be more than
welcome to join us.

Feel free to contact me for more information.

Dave...

--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: 16 Jul 1999 11:16:55 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: long explanations wearying (was Re: Top 10 responses)
Message-Id: <xkfk8s0jz08.fsf@valdemar.col.hp.com>

Mats Pettersson <mats.pettersson@falukuriren.se> writes:
> It really didn't occur to me that this would be a FAQ.

That's what DejaNews is for-- checking if your questions have already
been asked!  <URL:http://www.deja.com/>.  Live it, love it, use it!

> > To answer your question Mats, it's because many newbies will never use
> > .newbie, because they want the real answers from the folks in
> > .professional.
> 
> Is this a proven fact?

Yep.  See the demise of comp.unix.wizards, just to name one.

> I see a lot of subjectlines sayin "newbiee question" around here. They
> seem to actually know where the question belongs.

Yeah, usually in the FAQs.  Any post with "newbie" in the subject stands 
a great deal less chance of being answered by anyone with a clue, because 
9 times out of 10, it's a FAQ, or in the documentation.

> Not that much traffic at all right now, but i've seen questions asked
> there get the answer "your should ask this in perl, this is not a cgi
> question" and here it's the other way around. There obviously seems that
> cgi and perl are close connected in peoples mind and many use perl to
> write cgi apps.

Many use python and C.  Should we ask CGI questions in comp.lang.c?

> >..., then feel free to take on its creation yourself.
> 
> I might would if i could.

Sure, you can.  You're likely to get laughed out of news.groups, but
nobody's stopping you.  Read the relevant RFCs, put out an RFD and a
CFV.  See how popular your idea is-- if people like it, they'll vote for
it.

> Technically you are right, but as i said many cgi scripts seems to be
> written in perl and sometimes it is annoying asking questions in
> two/three different newsgroups when the answers is used in the same app
> (if you understand what i mean).

Er, no, I don't.  What application is this the answers is used in?  If
your question has to do with CGI, you ask it in a CGI group.  If it's
Perl, you ask in in a Perl group.  In both cases, you check the
documentation and FAQs first, to avoid wasting people's time.  What's so
hard about this?

-=Eric


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

Date: 16 Jul 1999 12:51:43 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: My Foot Hurts
Message-Id: <a1lncgh71c.fsf@cyclone.jprc.com>

"Chris Denman" <chris@inta.net.uk> writes:

> It could be something to do with posture.  I find that going to sleep
> relieves pain.  But there is more than one way to solve this problem.  Maybe
> if you unstrap that attached boulder, relief could shortly follow.
Yes, Remove the Stone of Shame...

(Woohoo!)

And attatch the Stone of Triumph!

(D'oh!)

---Jason



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

Date: Fri, 16 Jul 1999 12:05:07 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: arpith@hotmail.com
Subject: Re: Newbie requires help in Perl please
Message-Id: <378F6643.6AF8FBEC@mail.uca.edu>

[cc'd to a]

arpith@hotmail.com wrote:
> 
> Phew,
> 
> atlast I'm getting somewhere :)
> 

Okay, slow down here. Take a deep breath. In, out... in, out. Now...

Yes, get the book, the one specifically for Win32 systems (the "Gecko,"
once you have it, you'll understand). Also, read the FAQ from your
ActiveState documentation, probably the Win32-specific FAQ first, then
the core Perl FAQ. Then start reading the book and doing the exercises.
Don't even think of skipping a chapter or an exercise until you're at
least through Chapter 6 (Chap 7 is on regular expressions, and, IMHO,
you don't need to know too much about these when you're first starting
out -  I know: "Heresy"). Chapter 18 specifically covers issues in CGI.

Subscribe to one or more of the mailing lists at Activestate, and do a
lot of listening to the questions people ask and the answers others
give, and learn who the knowlegable answerers are. Dig into the archives
on the Activestate website, there's a lot of information there.

You do not need *nix to do CGI, but you will need webserver software,
several programs of which are avalable over the Web for free for testing
on your machine. Web/CGI stuff is generally independent of the operating
system, if you write your program well (the exceptions to this are a
couple of commands which *nix has that Windows doesn't, especially
Win9x, but your ISP will be running its own webserver software, under
its own OS, so you're stuck there, anyway).

For details on CGI programming, read the docs which come with CGI.pm
(included in your distribution), or, if you want more help, get "The
Official Guide to CGI.pm," by Lincoln Stein. 

Don't rely on "free programs from the web," they're often worth what you
pay for them... Don't get me wrong, some are very good, but before you
can figure out which are which, you'll need to know some Perl. If you
find a program which you got from "Matt's Script Archive," delete it.

Have fun.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Fri, 16 Jul 1999 17:50:24 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: PDF-TXT
Message-Id: <378F70E4.4A77D122@email.com>

Try running this simple code.

#!/usr/bin/perl

$c="54686973206973206E6F742061205065726C207175657374696F6E2E20536" .
"565206120504446206E65777367726F75702E";
$c=~s/[^A-F\d-]//g;
for($c=~/(..?)/g){($d.=chr hex)or($d=chr hex);}
print "\n$d\n";

Pawel Szymanski wrote:
> 
> do you know the programs able to convert PDF files into TXT files?


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

Date: Fri, 16 Jul 1999 11:12:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PDF-TXT
Message-Id: <MPG.11f915e980681237989ce5@nntp.hpl.hp.com>

In article <378F70E4.4A77D122@email.com> on Fri, 16 Jul 1999 17:50:24 
GMT, Jordan Hiller <hiller@email.com> says...
> Try running this simple code.
> 
> #!/usr/bin/perl
> 
> $c="54686973206973206E6F742061205065726C207175657374696F6E2E20536" .
> "565206120504446206E65777367726F75702E";
> $c=~s/[^A-F\d-]//g;
> for($c=~/(..?)/g){($d.=chr hex)or($d=chr hex);}
> print "\n$d\n";

Even simpler:

$c="54686973206973206E6F742061205065726C207175657374696F6E2E20536" .
"565206120504446206E65777367726F75702E";
print pack 'H*', $c;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 16 Jul 1999 13:12:42 -0400
From: Kingpin <mthurn@tasc.com>
Subject: Re: problem with WWW::Search
Message-Id: <eulncg8qnp.fsf@copper.dulles.tasc.com>

smnayeem7346@my-deja.com writes:

> I am trying to install the WWW::Search module onto my computer. I am

Please get the latest release, version 2.01 .  It now installs on NT
with the normal 'perl Makefile.PL ; nmake install'.

BUT be warned, in my experience this only works in ActivePerl 517.
When I used 518, nmake could not parse the Makefile.

-- 
 - - Martin "Kingpin" Thurn                    mthurn@tasc.com
     Research Software Engineer           (703) 793-3700 x2651
     The Information Refinery              http://tir.tasc.com
     TASC, Inc.                            http://www.tasc.com

He's the brains, sweetheart. -- Han, Star Wars


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

Date: Fri, 16 Jul 1999 13:03:49 -0400
From: "c.s." <cs2400@hotmail.com>
Subject: Re: Problem: how can a CGI read files on another server?
Message-Id: <932144708.516.12@news.remarQ.com>


>open (INFILE, "directory/subdir/namefile.txt")  does work
>but
>open (INFILE, "http://www.otherdomain.net/directory/subdir/file.txt")
>does not work!
>

The "open" command is for a file, not for a URL.

If you need to fetch a URL via http, look on CPAN for a module.






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

Date: 16 Jul 1999 16:49:41 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
To: Scientia <scientia@XXXtechnologist.com>
Subject: Re: Problem: how can a CGI read files on another server?
Message-Id: <7mnnr5$rqg$1@brokaw.wa.com>

[Posted and mailed]

In article <378FB1C0.4058@xxxtechnologist.com>,
	Scientia <scientia@XXXtechnologist.com> writes:
> For example:
> open (INFILE, "http://www.otherdomain.net/directory/subdir/file.txt")
> does not work!

Whatever gave you the idea you could pass a URL to open()?

> I need a technical solution that allows my CGI to read also
> files on other domains.

If you need to use open(), NFS mount the filesytem to your host.
I suspect that LWP is realy what you are looking for, though.

Good Luck!

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: Fri, 16 Jul 1999 12:22:20 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Problem: how can a CGI read files on another server?
Message-Id: <brian-1607991222210001@16.chicago-01-02rs.il.dial-access.att.net>

In article <378FB1C0.4058@XXXtechnologist.com>, Scientia
<scientia@XXXtechnologist.com> wrote:

>Problem: how can a CGI read files on another server?
>
>Hello
>
>I have this problem.
>
>I have different domains on different servers.
>Different files with different informations are on each domain.
>
>Now, I would like to use a single CGI on one domain to check
>if specific files exist also on the other domains, but I am not able
>to do that:
>as far as I know, a CGI that is running on one server is able
>to read files only in its own domain.
>For example:
>open (INFILE, "directory/subdir/namefile.txt")  does work
>but
>open (INFILE, "http://www.otherdomain.net/directory/subdir/file.txt")
>does not work!

of course it doesn't work.  use the LWP module, as noted in the FAQs.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Fri, 16 Jul 1999 18:03:11 GMT
From: anne_fong9999@my-deja.com
Subject: Q: passing array/hash from one subroutine to another subroutine
Message-Id: <7mns4m$mf7$1@nnrp1.deja.com>

Hi,

I have an array and hash in one subroutine that
i want to pass to another subroutine.  But I can't
figure how to do it.  Can you help?

These are the items I want to pass:
-----------------------------------

$sensor_list{$sensor_num} = $sensor_name;
push (@sensors,$sensor_num);

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

Thanks in advance for your reply,
Anna



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


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

Date: Fri, 16 Jul 1999 18:10:27 GMT
From: anna@water.ca.gov
Subject: Q: passing array/hash from one subroutine to another subroutine
Message-Id: <7mnsi8$mmf$1@nnrp1.deja.com>

Hi,
I have an array and hash that I want to pass from one subroutine to
another subroutine.  But I don't know how to do it.  Can you help?

Here's what I want to pass:
--------------------------
$sensor_list{$sensor_num} = $sensor_name;
push (@sensors,$sensor_num);

----------------------------
Thanks in advance for your reply,
Anna


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


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

Date: Fri, 16 Jul 1999 14:33:18 -0400
From: Victor Hannak <hannak@kodak.com>
Subject: Reading user input on Win32
Message-Id: <378F7AEE.5A405B23@kodak.com>

Is this possible with Perl for Win32?


Core FAQ 8 describes a method for:

How do I check whether input is ready on the keyboard?

as follows:

The easiest way to do this is to read a key in nonblocking mode with the
Term::ReadKey module from CPAN, passing it an argument of -1 to indicate
not to block:

    use Term::ReadKey;

    ReadMode('cbreak');

    if (defined ($char = ReadKey(-1)) ) {
        # input was waiting and it was $char
    } else {
        # no input was waiting
    }

    ReadMode('normal');                  # restore normal tty settings




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

Date: Fri, 16 Jul 1999 10:06:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Remove leading zeros from a string
Message-Id: <MPG.11f9067af3f0363989ce4@nntp.hpl.hp.com>

In article <378f4a1f.1902623868@newshost.unx.sas.com> on Fri, 16 Jul 
1999 15:09:25 GMT, Bill Cox <bilcox@unx.sas.com> says...
> 
> Why not just use a reg exp to remove zeros.
> 
> $n = '000001234';
> $n =~ s/^0+//g;
               ^
               |

How many times do you expect this regex to match?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 16 Jul 1999 12:05:21 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: searching man pages, perldoc's, FAQ's, README's, HOWTO's, etc.
Message-Id: <378f8083@news5.newsfeeds.com>

Hello, World!

Is there a way to search man pages, perldoc's, FAQ's, README's,
HOWTO's, etc.?


--
David Christensen
dchristensen@california.com





  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 16 Jul 1999 13:30:31 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Symbolic Link problem
Message-Id: <x7673klcy0.fsf@home.sysarch.com>

>>>>> "A" == Aaron  <arodde@my-deja.com> writes:

  A> Problem:
  A> Let's say a 'testdir' link exists in /usr/local/userx/ and links
  A> to /u05/sectionX/test :

  A> % pwd
  A> /usr/local/userx

  A> the link is like this:
  A> testdir -> /u05/sectionX/test

  A> Currently in the userx dir and chdir testdir.
  A> pwd results in /usr/local/userx/testdir

that is a from a builtin pwd provided by your shell that is lying to
you. it knows (by spying on your eystrokes) that you went down a symlink
so it keeps mungs the internal pwd that way. your real physcial pwd (as
/bin/pwd should return). never confuse the shell pwd (which is nice to
use interactively) from a real pwd.

  A> If I run a Perl script in that directory and try to get the current
  A> working directory I get /u05/sectionX/test.  I lost my link info!!!
  A> and it's the link path that I need.  Is there a way around this?

not directly. make perl do the chdir and that will allow it to know
where the virtual parent dir was and use it. but it can't do a getcwd
(use Cwd) after that without returning the physcial path.

  A> I believe this is caused by Perl creating it's own "shell" when it's
  A> executed.  The same scenario will happen if you chdir into a link dir
  A> and start a new shell - the current working directory becomes the
  A> actual hard path and the link path is lost.

you are confusing a shell with a process. all processes have a private
current working dir which is altered by system calls to chdir. the path
is not stored there, just an inode. getting the path of that inode is
search upwards for parent dirs and the virtual parent is lost after the
chdir down a symlink.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Fri, 16 Jul 1999 17:22:56 GMT
From: amidalla@my-deja.com
Subject: trouble getting process ID's
Message-Id: <7mnpp1$lbn$1@nnrp1.deja.com>

on NT this does not return the process ID:

$pID = open(FH, "file.exe |");

it returns a "1" or "0" depending on its success.

how do I get process ID's without using Win32::Spawn, or the NT
resource kit function "tlist"??

thanks in advance...


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


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

Date: Fri, 16 Jul 1999 12:17:57 -0500
From: brian@pm.org (brian d foy)
Subject: Re: UPS Rate Calculator? Have you programmed for it?
Message-Id: <brian-1607991217580001@16.chicago-01-02rs.il.dial-access.att.net>

In article <378f6230@discussions>, "will Hannigan" <willidog@hotmail.com> wrote:

>If anyone has had any success writing the cgi code to interface 
>with the UPS Quick Cost Calculator, please let me know.

i have.

>..I can 
>connect to and open the scoket no problem, but the datareturned 
>is not what is expected...

make sure you are sending the data that it expects.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Fri, 16 Jul 1999 14:57:56 -0400
From: Will Hannigan <will@cs.umb.edu>
Subject: Re: UPS Rate Calculator? Have you programmed for it?
Message-Id: <378F80B3.96240FA0@cs.umb.edu>

Brian,
  Thanks For your response. All help is greatly appreciated since I have been
working on this for three days. ( With less  than when I started! )

  Did the code provided by UPS in the "UPS Internet Tolls Release Noted and Product
Docs" work for you?  That Code did nothing on this end.

   What it seems to be retuning is the length of the string I pass to it.

   Was this a trivial project for you? Perhaps it is my Inexperience in Perl that
has caused the problem...not to say I havent been scouring my books and resources..

Anyways...thanks again...


brian d foy wrote:

> In article <378f6230@discussions>, "will Hannigan" <willidog@hotmail.com> wrote:
>
> >If anyone has had any success writing the cgi code to interface
> >with the UPS Quick Cost Calculator, please let me know.
>
> i have.
>
> >..I can
> >connect to and open the scoket no problem, but the datareturned
> >is not what is expected...
>
> make sure you are sending the data that it expects.
>
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>



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

Date: Fri, 16 Jul 1999 17:51:15 GMT
From: maggelet@earthlink.net (M)
Subject: Re: What does this error message mean?
Message-Id: <378f6ea6.5328983@news.earthlink.net>

1+2+3) kill both makefiles and run configure again
then run make.
if there's still 2 files run diff on them to see whats different
usually there's just Makefile.  I think possibly there was already a
makefile and you didn't notice it, then when you ran configure it
generated another one.
also try just plain ./configure without args, it should know which
compiler to use.

4) try moving math.h into /usr/local/include

hope that helps.

- M
 
On Fri, 16 Jul 1999 11:12:11 -0400, Eric Williams
<eric@astro.wesleyan.edu> wrote:

>I am trying to compile Perl 5.005.03 on Solaris 2.4. I have GCC 2.8.1
>installed and ran Configure -d -Dcc=gcc. 
>All seems fine but when I next run make it crashes during the miniperl
>stage with this error:
>
>make: Warning: Both `makefile' and `Makefile' exist
>`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
>          CCCMD =  gcc -DPERL_CORE -c -I/usr/local/include -O   
>In file included from perl.h:1531,
>                 from miniperlmain.c:11:
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.4/2.8.1/include/math.h:5:
>math.h: No such file or directory
>*** Error code 1
>make: Fatal error: Command failed for target `miniperlmain.o'
>
>1) Are there really supposed to be a makefile and a Makefile?
>2) If not which should I get rid of and why did they get created?
>3) If so why is there a warning about it?
>4) The file
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.4/2.8.1/include/math.h DOES
>exist on my system?! Why the error and the crash?
>
>Thanks for any help and/or suggestion! 
>------------
>Eric Williams                             Van Vleck Observatory
>eric@astro.wesleyan.edu                   Wesleyan University
>(860) 685-3664                            Middletown, CT 06459
>http://www.astro.wesleyan.edu
>------------
>What the Microsoft slogan really means to say is: 
>"Where do you want to go today? 
>It doesn't matter...your coming with us." - as seen on the web.
>




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

Date: Fri, 16 Jul 1999 18:55:48 +0100
From: Martin Quensel <martin@adoma.se>
Subject: Re: Where to start with perl programming ?
Message-Id: <378F7224.15605121@adoma.se>



arpith@hotmail.com wrote:
> 
> Hi,
> 
> Hopefully you can help.. I am new to perl and I want to learn it,
> I am right now learning by examples, but I need some sort of server
> to run the scripts.
> 
[cut..]

You dont need a webserver to run scripts, for that you only need perl
(www.activestate.com i take it that your OS is Win95) . But a webserver
can help if you plan to develop CGI scripts and want to try them in your
browser, and look at the formatted HTML...but you dont need to (for a
nice free server go to  www.apache.org) 

Best Regards
Martin Quensel


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

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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


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


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