[12711] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 120 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 12 22:17:25 1999

Date: Mon, 12 Jul 1999 12:05:31 -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           Mon, 12 Jul 1999     Volume: 9 Number: 120

Today's topics:
        a CGI problem (Yang Zhong-Lan)
    Re: a CGI problem <yfang@bbn.com>
    Re: Calling C libs from C libs from Perl with XS <tobez@plab.ku.dk>
        Case of hash keys <clint@drtech.co.uk>
    Re: Case of hash keys <swiftkid@bigfoot.com>
    Re: Case of hash keys <swiftkid@bigfoot.com>
    Re: die or print (Tony Greenwood)
    Re: die or print (Tony Greenwood)
        export excel file <yfang@bbn.com>
    Re: export excel file <swiftkid@bigfoot.com>
    Re: export excel file <yfang@bbn.com>
    Re: Filter Websides Under WIN95/98/NT <swiftkid@bigfoot.com>
    Re: Getting very irregular single 'name' field into fir (Tad McClellan)
        Help with formmail script <heinens@ghsp.com>
        how to pass variables to system commands <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: how to pass variables to system commands <swiftkid@bigfoot.com>
    Re: Is it just me or....... <chris@inta.net.uk>
        Matching and printf <tlynch@cisco.com>
    Re: Modules and Perl2exe <ehpoole@ingress.com>
    Re: Need help : OO Perl (John Borwick)
        NTLM Authorization dafah@wmdata.com
    Re: Old database is erased when I add new information (brian d foy)
    Re: Old database is erased when I add new information (Jerome O'Neil)
    Re: Parsing Large Text File <swiftkid@bigfoot.com>
        perl system call problems n0jokeg@my-deja.com
    Re: Removing duplicate items (John Borwick)
    Re: Removing duplicate items (Jason Stapels)
    Re: Script question <swiftkid@bigfoot.com>
        The class is interfering with my script. (foo)
    Re: The class is interfering with my script. (John Klassa)
    Re: Unix Perl Script ported to NT problem <ehpoole@ingress.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 12 Jul 1999 18:48:19 GMT
From: venice@video.ee.ntu.edu.tw (Yang Zhong-Lan)
Subject: a CGI problem
Message-Id: <7mdd9j$o9e$1@gemini.ntu.edu.tw>

i want to tranfser a variable from a page written by CGI_program_A,
but i don't want the user to change its value
because its value is unknow to me, but CGI_program_B
needs this value.
can i make this variable invisible or unchangeable on the page,
and the CGI_program_B can still get this value.

example,
<input type="text" name="aaa" value="dontchange">
i hope aaa's value won't be changed by the user,
but still can be transferred to CGI_program_B.


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

Date: Mon, 12 Jul 1999 14:55:35 -0400
From: Yu Fang <yfang@bbn.com>
Subject: Re: a CGI problem
Message-Id: <378A3A27.7834AD72@bbn.com>

I think you need to use 'hidden' as input type.

Yang Zhong-Lan wrote:
> 
> i want to tranfser a variable from a page written by CGI_program_A,
> but i don't want the user to change its value
> because its value is unknow to me, but CGI_program_B
> needs this value.
> can i make this variable invisible or unchangeable on the page,
> and the CGI_program_B can still get this value.
> 
> example,
> <input type="text" name="aaa" value="dontchange">
> i hope aaa's value won't be changed by the user,
> but still can be transferred to CGI_program_B.

-- 
Frank Yu Fang 

GTE Internetworking
40 Sylvan Road
Waltham, MA 02451-1128

Phone: 781-262-7274  
Fax: 781-466-2650
Pager: 1-800-759-8888 PIN# 1619895 or 1619895@skytel.com


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

Date: Mon, 12 Jul 1999 20:07:30 +0200
From: Anton Berezin <tobez@plab.ku.dk>
Subject: Re: Calling C libs from C libs from Perl with XS
Message-Id: <19990712200730.P42941@lion.plab.ku.dk>

[You might consider to avoid quoting at the end of your post.  This will
save you from being put into many killfiles.  Thank you.]

On Mon, Jul 12, 1999 at 04:24:16PM +0000, Rob Sweet wrote:

> >> I have a perl module which calls a library compiled from C.
> >...
> >> However, the library itself calls another library, and this is
> >> where I'm failing.
 ...
> >> I expect the answer will be RTF-perldocs of some sort, which is ok
> >
> >You guessed right.  :-)  See either extra_libraries parameter in h2xs
> >manpage (you *are* using h2xs, aren't you?), or the LIBS attribute
> >for WriteMakefile() in ExtUtils::MakeMaker manpage.
> 
> Thanks, that helped!

> Now I'm dealing with the bug where _xstat doesn't get loaded.  When
> doing a regular link I know how to work around it by specifying both
> -lc and /usr/lib/libc.a, but I can't figure out how to tell MakeMaker
> that's what I want.

I am afraid I do not follow you this time.  What are you trying to
accomplish and what is the problem you have?  Can you provide us with a
piece of code which does not work (of a reasonable size)?

Cheers,
-- 
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen


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

Date: Mon, 12 Jul 1999 19:02:05 +0100
From: "Clinton Gormley" <clint@drtech.co.uk>
Subject: Case of hash keys
Message-Id: <7mda68$6il$1@taliesin.netcom.net.uk>

Is there any (neat, quick) way of making case irrelevant to key names in
hashes?

 ... ie other than $hash{lc($key)} =

Thanks

Clint





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

Date: Mon, 12 Jul 1999 23:13:34 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Case of hash keys
Message-Id: <7meehs$ldn6@news.cyber.net.pk>

Clinton Gormley <clint@drtech.co.uk> wrote in message
news:7mda68$6il$1@taliesin.netcom.net.uk...
: Is there any (neat, quick) way of making case irrelevant to key names in
: hashes?
:
: ... ie other than $hash{lc($key)} =


Check out Tie::* readmes on CPAN.... one of them allow that.




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

Date: Mon, 12 Jul 1999 23:18:16 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Case of hash keys
Message-Id: <7meeqj$kl13@news.cyber.net.pk>

: Check out Tie::* readmes on CPAN.... one of them allow that.
:

Its Tie::CPHash





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

Date: Mon, 12 Jul 1999 17:28:49 GMT
From: tony@webscripts.org (Tony Greenwood)
Subject: Re: die or print
Message-Id: <3791fcd4.25104615@news.freeserve.co.uk>

Hey!  Jonathan Stowe <gellyfish@gellyfish.com> 

>> I presume "die" is preferable to "print" but produces nothing for me.
>> My question is, Do I presume correctly ?

>use CGI::Carp qw(fatalsToBrowser);
>
>Or alter the flow of control in your program with something like:
>
>if(open(FILE,"blah"))
>  {
>    # thats ok
>  }
>else
>  {
>    # Ooh no file
>  }

The latter looks best for me..

Thank You! :)


--
Tony Greenwood
PORTFOLIO www.webscripts.org


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

Date: Mon, 12 Jul 1999 17:28:50 GMT
From: tony@webscripts.org (Tony Greenwood)
Subject: Re: die or print
Message-Id: <378a25bb.3605932@news.freeserve.co.uk>

Hey!  tadmc@metronet.com (Tad McClellan) 

>: I presume "die" is preferable to "print" but produces nothing for me.
>
>
>   I doubt that.

I only presumed the above because 90% of the answers or posts that I
read in this and other related newsgroups seem to quote "die" and not
"print".However I am here to learn so if you would like to illiterate
on the subject ?

>   Let's see a small and complete Perl program where die()
>   "produces nothing".


#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

$stuff="test.txt";

open(STUFF,$stuff) || print "Error with $stuff: $!\n";
@stuff = <STUFF>;
close STUFF;

exit;

The above will show the error message in the browser, If I replace
with "die" it shows nothing.

>   You are probably not looking in the right place to see the die()
>   output...

Yes that does sound logical as surely it produces something.



--
Tony Greenwood
PORTFOLIO www.webscripts.org


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

Date: Mon, 12 Jul 1999 14:05:57 -0400
From: Yu Fang <yfang@bbn.com>
Subject: export excel file
Message-Id: <378A2E85.5C5CFCC4@bbn.com>

Guys:
  Is there a module in perl that creates an MS excel file? Thanks.
--


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

Date: Mon, 12 Jul 1999 23:18:57 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: export excel file
Message-Id: <7meers$ldn7@news.cyber.net.pk>

Yu Fang <yfang@bbn.com> wrote in message news:378A2E85.5C5CFCC4@bbn.com...
: Guys:
:   Is there a module in perl that creates an MS excel file? Thanks.
: --

Win32::OLE




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

Date: Mon, 12 Jul 1999 15:04:48 -0400
From: Yu Fang <yfang@bbn.com>
Subject: Re: export excel file
Message-Id: <378A3C50.9BDC5AD3@bbn.com>

I have a database (Oracle) on a Unix box. One report I generate from
this database needs to be in an Excel file. Is there any perl module for
Unix can do this? Thanks.

Faisal Nasim wrote:
> 
> Yu Fang <yfang@bbn.com> wrote in message news:378A2E85.5C5CFCC4@bbn.com...
> : Guys:
> :   Is there a module in perl that creates an MS excel file? Thanks.
> : --
> 
> Win32::OLE

-- 
Frank Yu Fang 

GTE Internetworking
40 Sylvan Road
Waltham, MA 02451-1128

Phone: 781-262-7274  
Fax: 781-466-2650
Pager: 1-800-759-8888 PIN# 1619895 or 1619895@skytel.com


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

Date: Mon, 12 Jul 1999 23:08:23 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Filter Websides Under WIN95/98/NT
Message-Id: <7mee82$ldn4@news.cyber.net.pk>

: Who can help me?
: I should filter websides before they are displayed
: by the browser.
: For excample:
: URL:  www.yahoo.de
: filtering:   'shopping'
: if the webside contains -shopping- I should
: change the URL f.e. to 'www.wal-mart.com'
: Do you know a solution ?

Make your own browser.

Or the perl way:

use LWP::Simple;
my $content = get 'http://www.page.com';
print "Location: http://www.wal-mart.com\n\n"
    if $content =~ /shopping/i;





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

Date: Mon, 12 Jul 1999 05:33:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <eoccm7.eec.ln@magna.metronet.com>

Abigail (abigail@delanet.com) wrote:
: Stephen Benson (stephenb@scribendum.win-uk.net) wrote on MMCXLI September
: MCMXCIII in <URL:news:7mch3i$c4f$1@plutonium.compulink.co.uk>:
: `` 
: `` I've posted for years, whether to put the quoted mail top/bottom is
: `` unregulated, and in practice more people do it the way I do, so people
: `` instantly see the current message, and scroll down to the old if they need
: `` it. Matter of taste.


: *plonk*
   ^^^^^


   See?


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


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

Date: 12 Jul 1999 18:50:42 GMT
From: "Ebola" <heinens@ghsp.com>
Subject: Help with formmail script
Message-Id: <7mdde2$7gn$0@205.138.138.3>

Hey folks. I am having a heck of a time with a script. It is a fairly simple
one, but I must either be blind to the problem or I just don't know what the
hell is going on. Anyway, here is the script:

#!/usr/bin/perl5

# Each variable will have a name like: $input{'Name_Of_Input_Field'}
# For instance, if you have a "comments" input field on your webpage
# the variable might be $input{'comments'} or whatever you named the
# comments fields. Ie: <INPUT TYPE="text" NAME="comments">

# Setup Variables
$ADDR = <my email addy here, but i removed it for this post> ; # Leave
Single Quotes!
$MailSubject = "Feedback Form";
$Location = "index.html";

# Get Required Files and Get Input
require "/usr/lib/cgi-lib.pl";
&ReadParse(*input);

# Make Easy Variables
$FirstName = $input{'FirstName'};
$LastName = $input{'LastName'};
$Company = $input{'Company'};
$MessageType = $input{'MessageType'};
$Message = $input{'Message'};
$Subject = $input{'Subject'};
$Comments = $input{'Comments'};

$StreetAddress = $input{'StreetAddress'};
$City = $input{'City'};
$State = $input{'State'};
$Country = $input{'Country'};
$ZipCode = $input{'ZipCode'};
$Phone = $input{'Phone'};
$Fax = $input{'Fax'};
$Email = $input{'Email'};

$ContactRequested = $input{'ContactRequested'};

# Open SendMail program
open(MAIL, "| /usr/sbin/sendmail -t -oi");

# Write to SendMail
print MAIL "TO: $ADDR\n";
print MAIL "FROM: $input{'Email'}\n";
print MAIL "SUBJECT: $MailSubject\n\n";
print MAIL "\n\n";
print MAIL "Name: $input{'FirstName'}\n";
print MAIL "E-mail: $input{'Email'}\n\n";

print MAIL "Message Type: $MessageType\n\n";

print MAIL "Commenting on: $Subject\n\n";

print MAIL "Comments: $Comments\n\n";

print MAIL "$FirstName $Lastname from $Company\n\n";

print MAIL "Address\n";
print MAIL "-------------\n";
print MAIL "$StreetAddress\n";
print MAIL "$City, $State\n";
print MAIL "$Country\n";
print MAIL "$ZipCode\n\n";

print MAIL "Contact Info:\n";
print MAIL "---------------\n";
print MAIL "Phone : $Phone\n";
print MAIL "Fax   : $Fax\n";
print MAIL "E-mail: $Email\n\n";

if ($ContactRequested = "ContactRequested"){
 print MAIL "Contact is requested\n\n";
 }

# Close SendMail
close(MAIL);

# Send to "output" page
print "location: $Location\n\n";



I am putting the script on a UNIX machine and calling it from an NT machine
running IIS 4.0. Right now the script 'appears' to be working just fine. To
an outsider it would seem that way. What happens is that you press the
submit button on the web page and then you are taken to the proper html
document. However the email is never sent. I talked to the ISP where this
script is running at and their CGI guy told me its working fine. Hehe, I
even told him that something is wrong because i did not get the email from
it. But he told me its working. So, does anyone see anything peculiar in the
script, or perhaps can think of something elsewhere that might be a problem?
Please let me know, your help is hugely appreciated.

Thanks...

Scott Heinen
heinens@ghsp.com




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

Date: Mon, 12 Jul 1999 14:00:36 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: how to pass variables to system commands
Message-Id: <378A2D44.8C9D4350@ccrs.nrcanDOTgc.ca>

Is there a way to do this? Eg.

$block=<STDIN>;
system("cp /home/tom/$block .");

 ..gets me no such file or directory.

Is there a better way to copy files from arguments on the command line?

Any advice would be appreciated

Thanks

 ..Tom

-----------------------------------------------------------------------------------------
Tom Kralidis                                  Geo-Spatial Technologist 
Canada Centre for Remote Sensing              Tel: (613) 947-1828
Data Acquisition Division                     Fax: (613) 947-1408
User Systems Development Section              email:
tom.kralidis@ccrs.nrcanDotgc.ca 
588 Booth Street , Room 241                  
http://www.ccrs.nrcan.gc.ca
Ottawa , Ontario K1A 0Y7                     
http://www.algonquinc.on.ca/~kral0003                           
-----------------------------------------------------------------------------------------


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

Date: Mon, 12 Jul 1999 23:20:06 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: how to pass variables to system commands
Message-Id: <7meeu2$ldn8@news.cyber.net.pk>

: Is there a way to do this? Eg.
:
: $block=<STDIN>;
: system("cp /home/tom/$block .");

chomp ( $block = <> ); # as it has the newline too!
system ( "cp /home/tom/$block ." );

:
: ..gets me no such file or directory.
:
: Is there a better way to copy files from arguments on the command line?

File::Copy





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

Date: Mon, 12 Jul 1999 19:04:21 +0100
From: "Chris Denman" <chris@inta.net.uk>
Subject: Re: Is it just me or.......
Message-Id: <7mdatj$1vs9$1@news2.vas-net.net>

$line is the record number

so

$DATA[1020]{'Name'} would be the Name field of record number 1020

I know there are betters ways of storing and/or extracting data, but we are
stuck with the current system at the moment as so many of our clients use
it.  We would have to re-write everyones data structures.

Ta,

Chris


John Borwick wrote in message <378d0e5e.14389741@newshost.unx.sas.com>...
>On Mon, 12 Jul 1999 15:13:23 +0100, "Chris Denman" <chris@inta.net.uk>
>wrote:
>
>>Is it just me, or is the split command slow?
>
>[snip]
>
>>What I do is open up each record and create an associative array using the
>>split command.  Later I can then access any record by using
>>$DATA[$loop]{'Name'}.  All of the code is fine, but I have pinpointed the
>>bottleneck to the split command.
>>
>>There are about 3000 records, and the results take many seconds to appear.
>>The server is fast, and the files load in fast.
>
>If $loop stands for the line number you're reading, then your program
>might be slowing down because you are creating 3000 individual hashes.
>
>You could create fewer hashes, like
>
>$DATA{'Name'}[$loop];
>$DATA{'Whatever'}[$loop];
>
>This might speed up your performance.
>
>--
>John Borwick




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

Date: Mon, 12 Jul 1999 13:16:01 -0400
From: Tom Lynch <tlynch@cisco.com>
Subject: Matching and printf
Message-Id: <378A22D1.AB06741E@cisco.com>

Greetings:

	I have the following code:

foreach $sig (@signal) {
print "$line[1] $sig\n";
if (/$sig/) {
   printf " Here -> %30s %20s %18s %5s %2.2f\n", $sig, $pinname, $line[1], $line[2], $line[4];
   }
}

	$sig will contain strings like such:

 	io\/U_sd_dq_63/A
 	io\/U_sd_dq_62/A
 	io\/U_sd_dq_61/A

	The file currently being worked on contains 
	that string on the line, however it is always
	matching and printing everything out, which of
	course it shouldn't. Could the "/" in the string
	be causing me this trouble? How do I get around it?
	The other problem is the printf statement never
	prints anything out for "sig" which seems very strange
	since the print statement above that prints "$sig"
	out just fine???

	Thanks very much for any help in advance!

	Tom
	   
	
-- 
#-----------------------+--------------------------+
# Tom Lynch             | Email: tlynch@cisco.com  |
# Cisco Systems         | Phone: 978-244-8765      | 
# 250 Apollo Drive      | FAX:   978-244-8039      |
# Chelmsford MA 01824   | MS:    CH1-2LF           |
#-----------------------+--------------------------+


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

Date: Mon, 12 Jul 1999 14:06:25 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: Modules and Perl2exe
Message-Id: <378A2EA1.62225287@ingress.com>

Frederic Descamps wrote:
> 
> Hi,
> 
> When I want to use Perl2exe with a script (this script works fine with perl
> name_name_of_script) using a module, it gives me this following message :
> 
> Warning: module [name_of_module] not found
> Make sure that the perl\bin directory is in your path
> 
> Could somebody help me ?

Have you tried specifying the modules (including their paths) on the
command line for Perl2Exe in addition to your file containing the Perl
code you wish 'compiled'?

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: Mon, 12 Jul 1999 17:11:24 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Need help : OO Perl
Message-Id: <378f1fae.18822425@newshost.unx.sas.com>

On Mon, 12 Jul 1999 15:56:40 GMT, John.Borwick@sas.com (John Borwick)
wrote:

>rewrite as:
>sub add
>{
> my($object) = shift; # the @_ was unnecessary
> my($i); # ADDITIONAL LINE
> $object->[$i++] = "titi";
>}

It just occured to me that this is probably not what you want.  Your
original object you created was, I believe, an anonymous array.

You need a place in your object to store this counter, $i.  Maybe you
could try creating your object like so:

sub new
# This code was copied from yr original post
{
 my($myref) = {};  # Changed, s/[]/{}/
 $myref->{'counter'} = 0; # added: initalize counter element
 $myref->{'array'} = [];  # added: create anonymous array
 bless($myref);
 return ($myref);
}

sub add
{
 my($object) = shift;
 ${ $object->{'array'} }[ $object->{'counter'}++ ] = "titi";
}

When you want the counter, use $object->{'counter'}
and when you want the array, use $object->{'array'}

I think object is now an "anonymous thingy," but hopefully someone
will correct me if I'm wrong.

Hope this helps,

-- 
John Borwick


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

Date: Mon, 12 Jul 1999 17:50:36 GMT
From: dafah@wmdata.com
Subject: NTLM Authorization
Message-Id: <7md9t4$phi$1@nnrp1.deja.com>

Are there any documentation about how the NT Challenge Response / NTLM
Authorization headers interact? It seemes as Microsoft does not publish
this information. But would need this to build a proxy server. When I
look at the headers it looks something like this:

Server:
   401 Access denied
   WWW-Authenticate: NTLM

Browser:
   Authorization: NTLM
TlIDOSNTUAABAAAAA7IAAAYABgAsAAAADAAMACAAAABXTVNUTzZMSTAwMjBXTVNUTzY=

Server:
   401 Access denied
   WWW-Authenticate: NTLM
TlRMTVNTUAACAAAAAAAAACgAAAABwgAAUVxfjcAl7IEAAAAAQHwXAA==

Browser:
   Authorization: NTLM
TlRMTVOEHFADAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAA
AABAAAAAAcIAAA==

/David Fahlander


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


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

Date: Mon, 12 Jul 1999 13:24:57 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Old database is erased when I add new information
Message-Id: <brian-1207991324590001@40.bloominton-01rs13-14rt.il.dial-access.att.net>

In article <19990712083038.07296.00011669@ng34.aol.com>, perulinks@aol.com
(Perulinks) wrote:

> I REALLY would appreciate if somebody helps me here.  I bought some very nice
> search scrips for my search engine, and the author is unable/uwilling to help
> me with an installation problem--it is VERY DIFFICULT to get good tech support
> these days.  I tried to contact him many times, but he won't just answer.
> 
> The problem I have is that everytime I tried to submit a new URL to my search
> engine (that works like Yahoo!), the old database is erased!!!!

it doesn't sound like it works at all, much less like anything else.

perhaps you should find different software.  unsupported software is
dead software, and it's ludicrous to think that anyone will want to 
support if if the author of it has such low regard for it that he won't
support it himself.

so who wrote this script that doesn't work properly?

-- 
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: 12 Jul 1999 18:38:55 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: Old database is erased when I add new information
Message-Id: <7mdcnv$6di$3@brokaw.wa.com>

In article <brian-1207991324590001@40.bloominton-01rs13-14rt.il.dial-access.att.net>,

> so who wrote this script that doesn't work properly?

I have a short list, if anyone wants odds.

-- 
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: Mon, 12 Jul 1999 23:04:22 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Parsing Large Text File
Message-Id: <7mee0h$ldn3@news.cyber.net.pk>

: $inline=<maindata>;
:
: while($inline ne "")
:    {
:    $key++;
:    $PNDB{"$key"} = "$inline";
:    $inline = <maindata>;
:    }


try

while ( <maindata> )
{ $PNDB { ++$key } = $inline } # you don't need $key++



:
: When I run this script I get the following error:
:
: ndbm store returned -2, errno 28, key "41515" at map_test.pl line 11,
: <maindata> chunk 41515.

Thats why there is DB_File.... check it out on CPAN, I have create files
about 4GB with it, and it works quite nice.

I think, when you use dbmopen() after installing DB_File, it should allow
you to store/retreive to/from huge databases.

:
: If anyone knows what this means and how to overcome or get around this
: problem please let me know.

Try DB_File.

Win32:

ppm
install DB_File


 .*n[ui]x:

perl -MCPAN -e shell
install DB_File

Or download it from CPAN and install yourself, the traditional way.

:
: Thanks in advance
: Asad.





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

Date: Mon, 12 Jul 1999 18:26:58 GMT
From: n0jokeg@my-deja.com
Subject: perl system call problems
Message-Id: <7mdc0t$qm1$1@nnrp1.deja.com>

Hi, I'm adding taint checking to a program and one thing I need to do is
get rid of the backticks and use system() so that I dont use the shell.
However, I need the output of the command to be saved in a variable.
How can I do this with system?

Here's what I've got
(probably not too useful as I guess it's all wrong):

my $cmd = "some_command file -option1 -option2";
my @cmd = split(/\s/,$cmd);
open(BTOUT,system @cmd) or die "Couldn't run [@cmd] $!\n";
my @btout = <BTOUT>;
my @btout = system(@cmd);
close BTOUT;

what this does is it runs the command and prints the output (I dont
print it, it just prints itself for some reason) and then it prints the
"Couldn't run..." but it doesnt die and goes on to the rest of the
program.

Thanks for any help.
Konrad


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


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

Date: Mon, 12 Jul 1999 17:16:24 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Removing duplicate items
Message-Id: <37902272.19530072@newshost.unx.sas.com>

On 12 Jul 1999 16:16:25 GMT, jmstapel_n0spam@mtu.edu (Jason Stapels)
wrote:

>I was wondering what a quick way of going through a list and
>removing duplicate entries would be. I came up with ...

Try perlfaq4: "How can I extract just the unique elements of an
array?"

== quoting from the FAQ ==
b) If you don't know whether @in is sorted: 

         undef %saw;
         @out = grep(!$saw{$_}++, @in);
==      end quote       ==

-- 
John Borwick


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

Date: 12 Jul 1999 18:03:08 GMT
From: jmstapel_n0spam@mtu.edu (Jason Stapels)
Subject: Re: Removing duplicate items
Message-Id: <7mdaks$90a$1@campus1.mtu.edu>

Thanks!

Jason

John Borwick (John.Borwick@sas.com) wrote:
: On 12 Jul 1999 16:16:25 GMT, jmstapel_n0spam@mtu.edu (Jason Stapels)
: wrote:

: >I was wondering what a quick way of going through a list and
: >removing duplicate entries would be. I came up with ...

: Try perlfaq4: "How can I extract just the unique elements of an
: array?"

: == quoting from the FAQ ==
: b) If you don't know whether @in is sorted: 

:          undef %saw;
:          @out = grep(!$saw{$_}++, @in);
: ==      end quote       ==

: -- 
: John Borwick


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

Date: Mon, 12 Jul 1999 23:12:10 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Script question
Message-Id: <7meef7$ldn5@news.cyber.net.pk>

: :Does anyone know of a PERL script that could accomplish this without
: :system calls?
:
: It's quite impossible, because if you do not consult the operating
: system about its files, you cannot know what your operating system
: thinks its files are!

Doesn't glob()/readdir work on all systems?

The sample shell script also uses 'find' call.

--
Use the force, read the source!





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

Date: Mon, 12 Jul 1999 17:44:47 GMT
From: agon@unm.edu (foo)
Subject: The class is interfering with my script.
Message-Id: <378a27c5.264329506@news.sandia.gov>

# I get a compilation error for the open(F,">$edit_file"); which
# says "Global symbol "rtgredit_file" requires explicit package name 
# at Splash.pl line 49." 
# when I take out "use Letter" the script works just fine.   

# My program looks something like this:

########### The program ############
use strict 'vars';

# A class I created.
use Letter

my $edit_file = "foo.d";

open(F,">$edit_file");

########### The Letter class ###########
package Letter;
use strict;

sub new{
  my $self = {};
  # shift the class name out of @_
  shift;

  bless($self);
  return $self;
}

1;

# I have tried open(F,">$::edit_file"), but then I get "print on   
# closed filehandle at ..." errors.
# I have tried open(F, "foo.d"), which works fine, but I'm still 
# interested to know why I'm having this problem. 


# Thanks.


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

Date: 12 Jul 1999 18:46:42 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: Re: The class is interfering with my script.
Message-Id: <7mdd6i$55m$1@aurwww.aur.alcatel.com>

On Mon, 12 Jul 1999 17:44:47 GMT, foo <agon@unm.edu> wrote:
  > # A class I created.
  > use Letter
  > 
  > my $edit_file = "foo.d";

Try putting a semicolon after "use Letter"...

-- 
John Klassa / Alcatel USA / Raleigh, NC, USA


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

Date: Mon, 12 Jul 1999 14:18:30 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: Unix Perl Script ported to NT problem
Message-Id: <378A3176.7593ED0@ingress.com>

Greg Marler wrote:
> 
> I am having a difficult time getting a script ported from Unix to NT, I have
> placed a description of the problem and downloadable versions of the scripts
> in question on a website for anyone who may have a few minutes to look at
> them. Thanks in advance.
> The URL is::
> 
> http://www.ieo.com/webadverts/webadverts.html
> 
> Greg Marler

You have already asked this question (and I have answered it) in another
newsgroup (comp.infosystems.www.authoring.cgi).  Do not crosspost in this
manner as it wastes *everyones* time when different people invest their
valuable time answering a question that may have already been answered
elsewhere.

Followups set to: compe.infosystems.www.authoring.cgi

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

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


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