[10602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4194 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 10 23:07:27 1998

Date: Tue, 10 Nov 98 20:00:47 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 10 Nov 1998     Volume: 8 Number: 4194

Today's topics:
        ActiveState Sockets non-blocking by default? <hargrave@concentric.net>
    Re: arranging form input in ascending order (Tad McClellan)
        Backtick blocking problem <campb@think.ucdavis.edu>
    Re: Can A Perl/CGI Script prevent robots? (Tad McClellan)
        Can I return a hash from Perl to C? <perl_writer@hotmail.com>
    Re: Command Line Parameters? <aichner@ecf.teradyne.com>
        File handels to a variable? <toto@javanet.com>
    Re: File handels to a variable? (Sean McAfee)
        gethostbyaddr alarm signal not reset (Ken Alexander)
        Hash help <jhunter@igg-tx.net>
    Re: Hash help <uri@fastengines.com>
    Re: Hash help <jhunter@igg-tx.net>
    Re: HELP , I just can figure this out (John Hardy)
        How do I sort this list by "port" number? munn@bigfoot.com
        How to turn off Auto-HTML header (Perl under NT)? <topper@virginia.edu>
    Re: Linked perl source files (Alastair)
    Re: Linked perl source files (Martien Verbruggen)
        Net::FTP Help me please. <sethnjen@megahertz.net>
    Re: ODBC Resource? <tpot@acsys.anu.edu.au>
        passing hidden form fields <jrue@gte.net>
        passing hidden form fields <jrue@gte.net>
    Re: percentages (Martien Verbruggen)
        Perl and Btrieve Support <lrouman@definity.com>
    Re: PERL is TOO flexible <jay@rgrs.com>
        perl5.005_02 + Solaris x86 + gcc ?? <phil@bts.com>
    Re: pod2html and <BR> and L<text> tags <crism@oreilly.com>
    Re: Q: XSubs and variables (Dave Steiner)
    Re: Reading binary data from HTTP body (Smith and O'Halloran)
    Re: Running perl scripts inside perl scripts (TIA) (Sam Holden)
        some help with a script . . <jiyeung@cisco.com>
    Re: some help with a script . . (Alastair)
    Re: some help with a script . . (Martien Verbruggen)
        String Split Help bigcheese@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 10 Nov 1998 18:31:54 PST
From: Vic Hargrave <hargrave@concentric.net>
Subject: ActiveState Sockets non-blocking by default?
Message-Id: <3648F715.B883B528@concentric.net>

I have just installed the latest ActiveState Perl distribution for Win95.
I'm having a problem with a small network server I'm writing with the
Sockets library. Specifically the code makes a call to accept() to
passively establish a connection with a client, which should block until a
connection request is received.  However, in my program the accept() is
returning immediately before a connection is established.  Does anyone know
if the ActiveState Perl Socket calls are non-blocking by default, and if
so, how to put them in blocking mode? Any advice would be greatly
appreciated. Thanks in advance...

-- Vic Hargrave


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

Date: Tue, 10 Nov 1998 19:14:35 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: arranging form input in ascending order
Message-Id: <rdoa27.ooe.ln@flash.net>

shienh gurpreet (gss2@roogna.eng.wayne.edu) wrote:
: I'm trying to take in some data from the user through a form field and,
: depending on the choices he/she makes, I'll have this info appended to
: an existing web page or a new one if it doesn't exist. Here's the
: problem. Say, I have 4 name=value pairs coming from the form.
: e.g.         name=john&url=http://test&age=25&sex=male
: When I add this info to the web page, I want to arrange it in ascending
: or decending order using age so that if I already have
: age=18
: age=39
: age=47
: on the web page, this new info should go in at no. 2 in the list.


   That shouldn't be too hard.

   Show us the code you have so far, and we'll help you fix it.



   If you can arrange to get the ages into an array, then
   you might want to have a look at the Perl FAQ, part 4:

      "How do I sort an array by (anything)?"


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


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

Date: 11 Nov 1998 00:56:16 GMT
From: Blaise Camp <campb@think.ucdavis.edu>
Subject: Backtick blocking problem
Message-Id: <72anbg$75f$1@mark.ucdavis.edu>

Hi all.  I have a bourne shell script that looks like this(running this out
of my perl script):

PROG_PATH=/usr/sbin/cron

 . /etc/init.d/simple 

This script will execute whatever is in PROG_PATH.  The script exits almost
immediately when run on the command line, but when I run it in backticks, it
stalls indefinitely.

@return_info = `$start_script start 2>&1`;

system() returns immediately, but the script outputs info that I want, which
I can't snag using system().  Can you give me pointers?

Thanks,
Blaise


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

Date: Tue, 10 Nov 1998 19:09:39 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Can A Perl/CGI Script prevent robots?
Message-Id: <j4oa27.ooe.ln@flash.net>

Vikram Pant (nospam@wam.umd.edu) wrote:

: I have a simple script which is passed a wav file and returns the sound 
: to be played by the browser.

: My question is can a web robot get this file?
: <a href="sounds.cgi?Heat+deniro.wav">Deniro</a>

: I implemented this small script thinking it would stop robots, only to 
: realize that it is still a link and can be grabbed.


   This is the Perl newsgroup.

   If you have a question about Perl, this is the place to ask it.



   Do you have a question about Perl?
   

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


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

Date: Wed, 11 Nov 1998 11:12:58 +0800
From: "Perl Writer" <perl_writer@hotmail.com>
Subject: Can I return a hash from Perl to C?
Message-Id: <72av9j$j1v$1@imsp009a.netvigator.com>

Can anyone tell me whether I can return an hv from a Perl subroutine which
is invoked in a C function?  If it can be done, which call flag should I use
G_SCALAR or G_ARRAY?  When I used G_SCALAR, the SV* returned is not a HV*.
When I used G_ARRAY, I get back a list of keys and values but not a hash.
Any help is appreciated.




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

Date: 10 Nov 1998 20:53:40 +0100
From: Adrian Aichner <aichner@ecf.teradyne.com>
Subject: Re: Command Line Parameters?
Message-Id: <u67cntjcr.fsf@ecf.teradyne.com>

>>>>> "Koos" == Koos Pol <koos_pol@nl.compuware.com.NO_JUNK_MAIL> writes:

    Koos> On Sun, 08 Nov 1998 12:04:38 -0500, Ken Timlin <ktimlin@erols.com> wrote:
    Koos> |      do I pass parameters from the command line to my Perl
    Koos> |      script? I want to pass it two strings in the following
    Koos> |      manner:
    Koos> | 
    Koos> |            /usr/bin/myprogram string1 string2
    Koos> | 


    Koos> man perlrun

Or even

perldoc Getopt::Long

for a general way to pass arguments and options according to POSIX
convention with GNU extensions.

Adrian

    Koos> -- 
    Koos> Koos Pol
    Koos> ----------------------------------------------------------------------
    Koos> S.C. Pol - Systems Administrator - Compuware Europe B.V. - Amsterdam
    Koos> T:+31 20 3116122   F:+31 20 3116200   E:koos_pol@nl.compuware.com

    Koos> Check my email address when you hit "Reply".


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

Date: Tue, 10 Nov 1998 21:28:31 -0500
From: "Josh Feinblum" <toto@javanet.com>
Subject: File handels to a variable?
Message-Id: <72aspd$4iu$1@as4100c.javanet.com>

I am working on a program that needs to take a file handle an place it to a
variable (more specifically I need to re-route all the print statments to a
variable).  I have it working with a file that I write to and the re-read
but with the full version of the program that will be to slow.  Are there
any recomendations?

Thanks in advance,
Josh




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

Date: Wed, 11 Nov 1998 03:50:43 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: File handels to a variable?
Message-Id: <nQ722.6036$fS.19960628@news.itd.umich.edu>

In article <72aspd$4iu$1@as4100c.javanet.com>,
Josh Feinblum <toto@javanet.com> wrote:
>I am working on a program that needs to take a file handle an place it to a
>variable (more specifically I need to re-route all the print statments to a
>variable).  I have it working with a file that I write to and the re-read
>but with the full version of the program that will be to slow.  Are there
>any recomendations?

IO::Scalar, part of the IO-stringy package at CPAN.  Used thusly:

use IO::Scalar;
tie *OUT, 'IO::Scalar', \$var;
print OUT "Bite me, it's fun!\n";
# $var now contains the string "Bite me, it's fun!\n";

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 11 Nov 1998 02:55:51 GMT
From: kalex@quip.eecs.umich.edu (Ken Alexander)
Subject: gethostbyaddr alarm signal not reset
Message-Id: <72aubn$pi1$1@news.eecs.umich.edu>

I have a problem with an alarm signal handler only working once.
After the first time, it doesn't work again.  
I'm hoping that someone can point out what silly thing I'm missing.

I'm trying to gethostbyaddr() a large number of IP addresses.
Sometimes gethostbyaddr() will hang for a long time if the remote
DNS server is slow, so I want to time it out sooner and go on 
to the next one.  But this only works once.

My routine looks something like this:

sub ip2hname {
    my($hostip) = @_;
    my($ip, $hname);
 
    if (not already cached in my lookup table) {
        $ip = pack('C4', split(/\./, $hostip));
        eval {
            local $SIG{ALRM} = sub { die "dns timeout\n" };
            alarm(10);
            $hname = (gethostbyaddr($ip, 2))[0];
            alarm(0);
        };
        warn "DNS timeout on $hostip\n" if ($@ && $@ =~ /dns/);
    }
    return($hname);
}

I call this routine for each IP address in a logfile.
The first time that it takes more than 10 seconds to resolve a name,
the timeout works (it prints the "DNS timeout" and goes on to the next).
After that, however, DNS can hang for a longer time, and it never prints
that "DNS timeout" message ever again during the same run of the program.

Why is my 10-second alarm not getting set again after the first time?
(Perl 5.002 under Solaris 2.5.1.)

Thanks a lot,
kalex@umich.edu



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

Date: Tue, 10 Nov 1998 18:15:10 -0600
From: Jeff Hunter <jhunter@igg-tx.net>
Subject: Hash help
Message-Id: <3648D70E.FA003188@igg-tx.net>

I have two questions:

I created the following program on my Linux laptop w/perl v5.004, then
moved it to a Solaris 2.4 box w/perl v5.000. The referencing doesn't
seem to work on the older perl. Is this easy to rewrite?

<snip>
while (<UNL>){

# Check for and ignore header line in unl file
if ($_ =~ /\[/) { next;}

	chomp;
	my( $cell,$ip,$router,$shorthost,$role,$hostname,$mailalias,$or_name,
$a_urn,$r_urn,$uic,$cs_flag,@other_fields) = split /\|/;

	$hosts{ $shorthost } = {
		cell		=> $cell,
		ip		=> $ip,
		router		=> $router,
		shorthost	=> $shorthost,
		role		=> $role,
		hostname	=> $hostname,
		mailalias	=> $mailalias,
		or_name		=> $or_name,
		a_urn		=> $a_urn,
		r_urn		=> $r_urn,
		uic		=> $uic,
		cs_flag		=> $cs_flag,
		other_fields	=> \@other_fields,
	};

	push @{ $cells{ $cell }}, $hosts{ $shorthost };
}
<snip>
for my $long_name (sort keys %hosts) {
	open(COM3,">>./commproc.ini#mvr1help");
	printf COM3 "%-25s", map $_->{hostname}, $hosts{$long_name};
	printf COM3 "%-9s", map $_->{mailalias}, $hosts{$long_name};
	$type = "P";
	printf COM3 "%-2s", $type;
	printf COM3 "%-25s", map $_->{cell}, $hosts{$long_name};
	printf COM3 "%-8s\n", map $_->{shorthost}, $hosts{$long_name};
	close(COM3);
}

the compile on Solaris perl complains that the cell, ip, etc might be
reserved words, then demands a $ for the map $_->{hostname} line.

Q2 - on the mapped variables, how can I use them in a match type
statement? 
	if ($_ =~ /mvr/){

	doesn't seem to be correct, what is the correct syntax?

					Thanks,
					Jeff


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

Date: 10 Nov 1998 19:45:53 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Hash help
Message-Id: <sarww5383b2.fsf@camel.fastserv.com>

>>>>> "JH" == Jeff Hunter <jhunter@igg-tx.net> writes:

  JH> I have two questions:
  JH> I created the following program on my Linux laptop w/perl v5.004, then
  JH> moved it to a Solaris 2.4 box w/perl v5.000. The referencing doesn't
  JH> seem to work on the older perl. Is this easy to rewrite?

  JH> 	$hosts{ $shorthost } = {
  JH> 		cell		=> $cell,
  JH> 		ip		=> $ip,
  JH> 		hostname	=> $hostname,
  JH> 	};

  JH> 	printf COM3 "%-25s", map $_->{hostname}, $hosts{$long_name};

  JH> the compile on Solaris perl complains that the cell, ip, etc might be
  JH> reserved words, then demands a $ for the map $_->{hostname} line.

use quotes around the bare tokens. => in later versions of perl5 quoted
the word to the left (if it looked like a word). 5.000 probably didn't
do that, hence the compile warnings. i think you should quote tokens all
the time anyway.

and you should upgrade to at least 5.004_04. 5.000 had many bugs and was
unstable. and many features have been added (think =>) since then.

  JH> Q2 - on the mapped variables, how can I use them in a match type
  JH> statement? 
  JH> 	if ($_ =~ /mvr/){

  JH> 	doesn't seem to be correct, what is the correct syntax?

i don't understand the question. do you mean in the map operation? or
are you thinking about grep? this may be close to what you want:

@changed = map s/from/to/, @input ;

hth,

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Tue, 10 Nov 1998 20:06:16 -0600
From: Jeff Hunter <jhunter@igg-tx.net>
Subject: Re: Hash help
Message-Id: <3648F118.D8665EE8@igg-tx.net>

I was hoping to match the value of the mapped variable, ie:

printf COM3 "%-25s", map $_->{hostname}, $hosts{$long_name};
if($_ =~ /mvr/){
	#do something with it.
}
				Jeff

Uri Guttman wrote:

>   JH>   if ($_ =~ /mvr/){
> 
>   JH>   doesn't seem to be correct, what is the correct syntax?
> 
> i don't understand the question. do you mean in the map operation? or
> are you thinking about grep? this may be close to what you want:
> 
> @changed = map s/from/to/, @input ;
> 
> hth,
> 
> uri


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

Date: Wed, 11 Nov 1998 03:49:35 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: HELP , I just can figure this out
Message-Id: <jP722.151$M%3.220627@198.235.216.4>


Now I get [Microsoft][ODBC Service Driver] COUNT field incorrect ?? Im sending 
15 fields and 15 parameters ?? What else could it be??



use diagnostics;						## Use 
Diagnostics module for debugging
use OLE;                                                        ## Call OLE 
module 
use Win32::ADO;							## Call ADO 
module


$Conn = CreateObject OLE "ADODB.Connection";		## Create connection 
Object
$CMD = CreateObject OLE  "ADODB.Command";

 
$Conn->Open("DSN=iHRS;UID=sa;PWD="); 			## Use the connection 
Object to Connect to the Database
$Conn or die "Cannot Connect";
  


my ($LOCK_EX);
$LOCK_EX = 2;

$file = 'VVarin';          						# Name 
the file
open(INFO, $file) or die "Couldn't open INFO file";  			# Open 
the file
flock (INFO, $LOCK_EX) || bail ("cannot flock $file: $!");

while ( <INFO> ) {
    chomp;
    ( $key, $value ) = split /:/;
    $linesin{$key}=$value;
};
close(INFO);   
foreach $key (sort keys %linesin ) {
$value=$linesin{$key};

}



$CMD->{CommandType} = adCmdStoredProc;

$CMD->{CommandText} = "{ ?=call CandidateINS (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";

$CMD->Parameters->Append($CMD->CreateParameter("$linesin{fname}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{lname}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{address}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{po_box}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{province}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{postal_code}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{city}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{country}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{telephone}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{email}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{ext}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{fax}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{citizen_ship}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{citizen_status}"));
$CMD->Parameters->Append($CMD->CreateParameter("$linesin{comment}"));



$CMD->{ActiveConnection} = $Conn;

$RS=$CMD->Execute;



if(!$RS) {
	$Errors = $Conn->Errors();
	print "Errors:\n";
	foreach $error (keys %$Errors) {
		print $error->{Description}, "\n";
	}
	die;

}



$RS->Close;
$Conn->Close;


$id= ($RS->CID->value);						### Not sure 
about this? 

print $id;



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

Date: Wed, 11 Nov 1998 03:20:00 GMT
From: munn@bigfoot.com
Subject: How do I sort this list by "port" number?
Message-Id: <72avp0$n0j$1@nnrp1.dejanews.com>

All:

I have an array with the following elements:

(for this context, assume that each entry is in the order presented assigned
sequentially to the array, so $a[0] is the first line and so on)

25 Simple Mail Transfer tcp 101.1.48.26 101.1.49.36 Nov 6 00:04:33
25 Simple Mail Transfer tcp 198.108.149.2 200.36.131.36 Nov 6 00:04:33
25 Simple Mail Transfer tcp 198.108.149.2 198.81.17.2 Nov 6 00:04:33
43424 not assigned tcp 198.108.149.2 207.82.90.10 Nov 6 00:04:33
43235 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:04:33
123 Network Time Protocol udp 101.1.48.26 101.1.48.67 Nov 6 00:04:33
41535 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:29
42816 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30
41754 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30
33156 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30
33717 not assigned tcp 198.108.149.2 198.111.253.37 Nov 6 00:43:56
33942 not assigned tcp 198.108.149.2 198.111.253.37 Nov 6 00:50:29
33973 not assigned tcp 198.108.149.2 203.111.81.111 Nov 6 00:51:26
39332 not assigned tcp 101.1.48.26 101.1.49.36 Nov 6 00:59:52

I am wanting to sort ONLY by the first numbers in the "line", in this case,
the number is the "port", and I want to sort based on this.  any way to do it?
I can't figure it out, sort doesn't work very well at all...

so the "sorted" list would look like:

25 Simple Mail Transfer tcp 101.1.48.26 101.1.49.36 Nov 6 00:04:33
25 Simple Mail Transfer tcp 198.108.149.2 200.36.131.36 Nov 6 00:04:33
25 Simple Mail Transfer tcp 198.108.149.2 198.81.17.2 Nov 6 00:04:33
123 Network Time Protocol udp 101.1.48.26 101.1.48.67 Nov 6 00:04:33
33156 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30
39332 not assigned tcp 101.1.48.26 101.1.49.36 Nov 6 00:59:52
33717 not assigned tcp 198.108.149.2 198.111.253.37 Nov 6 00:43:56
33942 not assigned tcp 198.108.149.2 198.111.253.37 Nov 6 00:50:29
33973 not assigned tcp 198.108.149.2 203.111.81.111 Nov 6 00:51:26
41535 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:29
41754 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30
43424 not assigned tcp 198.108.149.2 207.82.90.10 Nov 6 00:04:33
43235 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:04:33
42816 not assigned tcp 198.108.149.2 203.18.38.243 Nov 6 00:05:30

Any help is greatly appreciated.

Thomas Munn
munn@bigfoot.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 10 Nov 1998 19:24:01 -0500
From: "David J. Topper" <topper@virginia.edu>
Subject: How to turn off Auto-HTML header (Perl under NT)?
Message-Id: <3648D921.AE293BB6@virginia.edu>

Hey there folks,

I'm running ActivePerl 5.006.  I can't for the life of me find:

HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\PerlIS\EnableCGIHeader

I actually ended up just creating it and setting it to 0.  No dice.
This makes it impossible to set cookies, right?  Since I always get the
"Content-type" string output automatically by Perl.  What a pain.  Grrr
 ...

Thanks,

DT
--
David Topper
Technical Director - Virginia Center for Computer Music
Programmer Analyst - School of Arts and Sciences
http://www.panix.com/~topper
(804) 924-6887




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

Date: Wed, 11 Nov 1998 01:15:49 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Linked perl source files
Message-Id: <slrn74hp8g.85.alastair@calliope.demon.co.uk>

Paul Wood <john.wood@diamond.co.uk> wrote:
>Is it possible for a Perl script to take it's main body from another linked
>file? Similar to .js files for JavaScript?
> Sorry if it's a bit of a newbie question...

You might be thinking of Perl's 'require' command.

perldoc -f require

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Wed, 11 Nov 1998 02:04:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Linked perl source files
Message-Id: <tg622.87$AG.240165@nsw.nnrp.telstra.net>

In article <72ajp1$gr2$1@nclient3-gui.server.ntli.net>,
	"Paul Wood" <john.wood@diamond.co.uk> writes:
> Is it possible for a Perl script to take it's main body from another linked
> file? Similar to .js files for JavaScript?

# perldoc -f require
# perldoc -f use
# perldoc -f do

It's not similar to .js files though. And there are no such things as
links in perl. But I believe that the above is what you mean.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Advertising:  The science of arresting
Commercial Dynamics Pty. Ltd.       | the human intelligence long enough to
NSW, Australia                      | get money from it.


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

Date: Wed, 11 Nov 1998 03:18:57 GMT
From: "sethnjen" <sethnjen@megahertz.net>
Subject: Net::FTP Help me please.
Message-Id: <F28MrK.L88@news2.new-york.net>

I am a perl beginner and I am trying to use get and/or getstore to get a
file through ftp:

getstore('ftp://some.site/some.file', 'some.file');

If i use http this works, yet using ftp gives many headaches.  The first
thing I figured out is that I don't have Net::FTP but I got it.  Then the
files for Net::FTP contained compiler errors!  I fixed, I believe, all of
them but I still cant retrieve files over ftp...if i try to get the
directory listing (ftp://some.site) it gives me a html back that would
represent that but if i want a file (ftp://some.site/some.file) it returns
ftp error 500.

I also tried a little with using the ua object oriented approach but it
resulted in the same errors.  I was not sure what to use as an object so I
used the HTTP::Request, the same as if i wanted an html page.

All I want to be able to do is retrieve a plain text file through a ftp
command.

Please email me if you can provide help, thanks a lot.




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

Date: 11 Nov 1998 13:01:19 +1100
From: Tim Potter <tpot@acsys.anu.edu.au>
Subject: Re: ODBC Resource?
Message-Id: <6yd86v3s40.fsf@acronym.anu.edu.au>

Terry Gliedt <tpg@cls.uob.com.sg> writes:

> I'll send you directly a couple of Perl programs I've developed and use with
> ODBC. I came up with these as part of my learning process with Perl ODBC and
> to test that it was working. Hope you find them of use.

How about posting them so we can all see how they work?


Tim.

> 
> --
> ================================================================
> Terry Gliedt     tpg@cls.uob.com.sg    http://www.hps.com/~tpg/
> United Overseas Bank               Personal Email:  tpg@hps.com
> 
> 


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

Date: Tue, 10 Nov 1998 19:25:18 -0800
From: "Jon D. Rue" <jrue@gte.net>
Subject: passing hidden form fields
Message-Id: <72b00d$kog$1@news-1.news.gte.net>

I've been trying to make a generic sub to pass all hidden html fields
down the line without reading and writing to a state file. The problem
is that when bouncing back and forth between pages I keep collecting 
duplicate fields or multiple fields with the same name and differing
values. I need a good way to pass only one name value pair. 

Originally tried: foreach ($querry->param) {$querry->hidden($_) };
It worked but kept passing duplicates.

foreach ($quarry->param) {
   print "<input type=hidden name=\" $_\" value=\"" .
$querry->param($_), "\">";
  }

This removed the duplicates problem but now when there is say a
textfield
and hidden field with the same name in a form the passed hidden value's 
argument is a concatenated string containing both previous values.

Any ideas?
-- 
Jon D. Rue <jrue@GTE.net>		"Do. Or do not.
					 There is no try."
					-- Yoda


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

Date: Tue, 10 Nov 1998 19:26:53 -0800
From: "Jon D. Rue" <jrue@gte.net>
Subject: passing hidden form fields
Message-Id: <72b03a$80b$1@news-1.news.gte.net>

I've been trying to make a generic sub to pass all hidden html fields
down the line without reading and writing to a state file. The problem
is that when bouncing back and forth between pages I keep collecting 
duplicate fields or multiple fields with the same name and differing
values. I need a good way to pass only one name value pair. 

Originally tried: foreach ($querry->param) {$querry->hidden($_) };
It worked but kept passing duplicates.

foreach ($quarry->param) {
   print "<input type=hidden name=\" $_\" value=\"" .
$querry->param($_), "\">";
  }

This removed the duplicates problem but now when there is say a
textfield
and hidden field with the same name in a form the passed hidden value's 
argument is a concatenated string containing both previous values.

Any ideas?
-- 
Jon D. Rue <jrue@GTE.net>		"Do. Or do not.
					 There is no try."
					-- Yoda


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

Date: Wed, 11 Nov 1998 02:01:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: percentages
Message-Id: <Cd622.86$AG.240165@nsw.nnrp.telstra.net>

In article <cO222.34$5v3.217390@news.optonline.net>,
	"News" <dixonmat@pouch.com> writes:
> here is what I have I know the formula is correct but in my shopping cart
> what am I missing?

Please reread your sentence/combination of sentences above. You seem
to be missing punctuation, and a bunch of words around 'shopping
cart'.

> if ($gtot < 1000) { $gtot * .025; }

Maybe you meant:

$gtot *= .025;

Your code doesn't do anything. Aren't you using the -w flag for perl?

>    $gtot = &Monify ($gtot);

You should really tell us what Monify does.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


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

Date: Tue, 10 Nov 1998 17:19:38 -0800
From: Lee Rouman <lrouman@definity.com>
Subject: Perl and Btrieve Support
Message-Id: <3648E629.3EBA4E19@definity.com>

Anyone completed (or working on) a database interface for Btrieve?  I don't see one on http://reference.perl.com/query.cgi?database but I'm hopeful that this is a problem that has already been solved.

Lee Rouman



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

Date: 10 Nov 1998 22:44:12 -0500
From: Jay Rogers <jay@rgrs.com>
Subject: Re: PERL is TOO flexible
Message-Id: <82hfw6lwqb.fsf@shell2.shore.net>

amw@world.std.com (Anita M Wilcox) writes:
> In article <82k91b1dlp.fsf@shell2.shore.net>, Jay Rogers  <jay@rgrs.com> wrote:
> >Brent Michalski <perlguy@technologist.com> writes:
> >
> >>  In article <3638676E.F980FC4A@harris.com>,
> >>  PERL ROCKS! <emills@harris.com> wrote:
> >>  > "Although the Perl Slogan is There's More Than One Way to Do It, I
> >>  > hesitate to make 10 ways to do something. :-) "
> >>  >     --Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>
> >>  >
> >>  >is along these lines- why make more than ONE? What did it add, Larry?
> >> 
> >> Wow, I *HAD* to comment on this "ONE" (pun intended)
> >> 
> >> Why on earth would you want only ONE way to do something in a
> >> language?!??!
> >
> >Maintainability.
> >
> >Unfortunately, because of Perl's expressive power, code that may seem
> >elegant to an implementor, can look like serial line noise to you the
> >maintainer.  This is why one Unix luminary has called Perl a
> >write-only language.
> 
> This isn't a language problem, it is a programmer problem.  You can
> write ugly, unmaintainable code in *any* language.

If the ability to write maintainable code is *only* a function of the
programmer and not the language then according to that logic, assembly
language is just as easy to maintain as perl.


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

Date: 10 Nov 1998 20:49:17 -0500
From: Phil Eschallier <phil@bts.com>
Subject: perl5.005_02 + Solaris x86 + gcc ??
Message-Id: <x6af1z0zj6.fsf@spider.bts.com>

Folks;

Has anyone been able to compile that latest perl5 on a Solaris 2.6 x86 
system [with -Dusethreads] using gcc 2.8.1 or egcs 1.1b?

Such a configuration works fine without threads enabled ...

 ... however, when I try to compile this software with threads enabled, 
the build gets to the point where it invokes miniperl, which just
hangs.  And according to 'truss', the miniperl program is stuck in
setcontext().

And yes, things work as expected on the SPARC equivalent.

Any thoughts?

Phil Eschallier    | Bux Technical Services | Systems, software, security
 inet phil@bts.com | 131 Wells Road         | and Inter-networking for
  tel 215 348 9721 | Doylestown, PA  18901  | your business!
  fax 215 348 2567 | http://www.bts.com     |


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

Date: 10 Nov 1998 20:53:37 -0500
From: Chris Maden <crism@oreilly.com>
Subject: Re: pod2html and <BR> and L<text> tags
Message-Id: <kevhknj8pq.fsf@rosetta.ora.com>

snowhare@devilbunnies.org (Snowhare) writes:

>       # WRONG WRONG WRONG!!!!! <STRONG> is illegal in <DT>.

Eh what?

<!--
    Typical usage: 

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
            "http://www.w3.org/TR/REC-html40/strict.dtd">
-->
[...]
<!ENTITY % phrase "EM | STRONG | DFN | CODE |
                   SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >  
[...]
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
[...]
<!ELEMENT DT - O (%inline;)*           -- definition term -->
[...]

HTH,
Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


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

Date: 10 Nov 1998 21:12:30 -0500
From: steiner@bakerst.rutgers.edu (Dave Steiner)
Subject: Re: Q: XSubs and variables
Message-Id: <72arqe$s4t$1@bakerst.rutgers.edu>
Keywords: XSub, variables between C and perl

After some further searching I think I've answered most of my
questions.  I found some very useful examples in the CPAN files
authors/id/DMR/CookBook[AB]-19960430.tar.gz.  Devel::Peek was also
very useful to make sure I really understood what was going on.  I
still have a question though (down near the end)...

On 7Nov98, steiner@bakerst.rutgers.edu (Dave Steiner) writes:
>First, some background.  We have a local C library that has functions
>similar to the normal crypt but has some extra arguments and does
>additional processing.  After finding people (and myself) writing C
>wrappers (that load and call the library) and then calling those C
>programs via system or a pipe from within their perl script, I decided
>this would be a good place to learn about XSubs.

>There are 4 functions in the library:
>ru_crypt(p, salt, uid)
>ru_crypt_cf(p, salt, uid, confname)
>ru_crypt_cf_time(p, salt, uid, confname, time)
>ru_crypt_cf_time_err(p, salt, uid, confname, time, reterr)

>Instead of having 4 separate functions, I decided to have a single
>function where the last three arguments were optional.  So my XS code
>looked like:

>char*
>ru_crypt(p, salt, uid, confname=NULL, time=0, reterr="")
>	char *	p
>	char *	salt
>	int	uid
>	char *	confname
>	int	time
>	char *	reterr
>	CODE:
>	RETVAL = ru_crypt_cf_time_err(p, salt, uid, confname,
>				      time, &reterr);
>	OUTPUT:
>	reterr
>	RETVAL


>This worked fine.  Now someone suggested using perl variables
>(conf_file & timeout) that could be set; generally people don't need
>to set those arguments but if they do, they probably want them
>consistant throughout their program.  That made sense.

>So I started looking into how variables would be done.  Unfortunately,
>their not mentioned in perlxs or perlxstut.  I'm working my way
>through perlguts and obviously need some of the code mentioned in
>there but I'm still not sure how to put it all together.  I also
>looked at some existing modules; the only one that used variables was
>DynaLoader.  So after trying and failing, my questions are (besides
>the general "how do I do this" :-)

>1. I have to declare these vars in the xs file; should they be
>   SV*, etc?  (The dl_debug var from Dynaloader is just an int but
>   arrays are AV*.  They also are initialized when declared but I'm
>   not sure if that's necessary if you use perl_get_sv()?)

Declaring this as 'static SV *' works fine.  I'm still not quite sure
why the variables in DynaLoader were initialized when declared since
perl_get_sv was called later; just to make sure they had some
reasonable value?

>2. I would then set them up in an init() function which gets called
>   via "BOOT:". Modulo how things are declared, is this code correct?

>    conf_file = perl_get_sv("conf_file", TRUE);  /* add to symbol table */
>    (void)sv_setpv(conf_file, Nullch);           /* initialize */
>    timeout  = perl_get_sv("timeout", TRUE);
>    (void)sv_setiv(timeout, (IV)0);

So I'm now doing:

static SV *conf_file;
static SV *timeout;
static void
private_init()
{
  conf_file = perl_get_sv("Authen::RU::conf_file", TRUE); /* value is undef */
  timeout  = perl_get_sv("Authen::RU::timeout", TRUE);
  (void)sv_setiv(timeout, (IV)0);
}

and later have:

BOOT:
        (void)private_init();
 

>3. Can I then use these directly as defaults in the XS declaration or
>   do I have to write the "if (items < N)" type code myself?  From
>   what the perlxs and perlxstut say, the defaults can only be strings
>   or numbers.  Would something like '..., time="SvIV(timeout)"' work;
>   I haven't tried that.

>Am I on the right track here?  I've tried a few variations on this and
>haven't gotten things to work.  I could just do all this in the .pm
>file but now that I've started this I want to find out how it works!

Ok, here's where I have the question.  I still can't use these
variables for the defaults.  I'd like to declare the XSub something
like:

char*
ru_crypt(p, salt, uid, confname=SvPV(conf_file,na), time=SvIV(timeout), reterr="")

but the SvPV confuses xsubpp (I believe the "SvIV(timeout)" does work
though).  Since I also need to keep the confname arg optional I ended
up with the following which seems to work but is a real hack:

char*
ru_crypt(p, salt, uid, confname="", time=SvIV(timeout), reterr="")
        char *  p
        char *  salt
        int     uid
        char *  confname = NO_INIT
        int     time
        char *  reterr
        INIT:
        if (items < 4)
            if (SvOK(conf_file)) {
                confname = SvPV(conf_file,na);
            } else {
                confname = NULL;
            }
        else {
            confname = (char *)SvPV(ST(3),na);
        }


I suspect that I should just have a completely different interface but
I'm curious if there's a proper way to do this in this design.

>One last question: I tried passing a NULL (actually $POSIX::NULL) for
>the confname arg but I think the library is seeing that as "0" and
>then not finding that file.  Is there a way I can pass a NULL correctly
>from perl?

After some expermentation with Devel::Peek, I've found that using
$POSIX::NULL or more reasonably 'undef', works fine.  You just have to
compare using 'SvOK(conf_file)' instead of something like
'SvPV(conf_file,na) != NULL'.  Made sense after another read of
perlguts.

>thanks,
>ds

Thanks,
ds
-- 

Dave Steiner
Associate Director of Network Services, Rutgers University Computing Services
steiner@bakerst.rutgers.edu or steiner@nbcs-ns.rutgers.edu


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

Date: 10 Nov 1998 18:55:09 -0800
From: inwap@best.com (Smith and O'Halloran)
Subject: Re: Reading binary data from HTTP body
Message-Id: <72auad$1kj$1@shell3.ba.best.com>

In article <01be0cc1$00450fa0$c1040a0a@rkatz.ilndc.com>,
Ron Katz <rkatz@ndsisrael.com> wrote:
>Any ideas how I can read the HTTP binary data ?

binmode(STDIN);

	-Joe
-- 
INWAP.COM is Joe and Sally Smith, John and Chris O'Halloran and our cats
See http://www.inwap.com/ for PDP-10, "ReBoot", "Shadow Raiders"/"War Planets"


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

Date: 11 Nov 1998 00:56:03 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Running perl scripts inside perl scripts (TIA)
Message-Id: <slrn74ho53.55m.sholden@pgrad.cs.usyd.edu.au>

On Mon, 9 Nov 1998 18:00:40 -0500, Christian M. Aranda
	<christian.aranda@iiginc.com> wrote:
>Hello all -

posting lots of times won't get you more useful responses...
It'll probably get you more useless ones like this though.

-- 
Sam

There's no such thing as a simple cache bug.
	--Rob Pike


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

Date: Tue, 10 Nov 1998 16:41:32 -0800
From: Jimmy Yeung <jiyeung@cisco.com>
Subject: some help with a script . .
Message-Id: <3648DD3C.49205D73@cisco.com>

I have been having trouble coming up with a CGI related script.  Lets
just start out with what I am trying to do . . I need a way for people
to attach thier files/reports on to forms on the web and send them . .
the script would then take those files/documents and store them in the
correct directory . . and lastly the script would generate a html page
with the listings of the files in that directory . . I just wanted to
know if there was a way to do this in Perl, and if there is . . can
anyone give me some ideas? Thanks!!  <:] <:]


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

Date: Wed, 11 Nov 1998 01:14:14 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: some help with a script . .
Message-Id: <slrn74hp5h.85.alastair@calliope.demon.co.uk>

Jimmy Yeung <jiyeung@cisco.com> wrote:
>I have been having trouble coming up with a CGI related script.

If you want to write Perl CGI, you should check out the CGI.pm module and start
hacking - CGI.pm ;

http://www.genome.wi.mit.edu/~lstein/

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Wed, 11 Nov 1998 02:08:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: some help with a script . .
Message-Id: <6k622.88$AG.240165@nsw.nnrp.telstra.net>

In article <3648DD3C.49205D73@cisco.com>,
	Jimmy Yeung <jiyeung@cisco.com> writes:
>I need a way for people
> to attach thier files/reports on to forms on the web and send them . .
> the script would then take those files/documents and store them in the
> correct directory . . and lastly the script would generate a html page
> with the listings of the files in that directory . . I just wanted to
> know if there was a way to do this in Perl, and if there is . . can
> anyone give me some ideas?

Yes, it is possible.

use the CGI module for your CGI related stuff. Use its filefield
method to allow people to upload files. Use some stuff you wrote to
put that file in the right place. Use opendir/readdir/closedir to get
the contents of that directory. Write code that formats that up in
HTML. Write that HTML to STDOUT.

There is no ready made solution that I know of. Maybe you can find
some stuff at www.cgi-resources.com

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd.       | thing but mean your mother.
NSW, Australia                      | 


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

Date: Wed, 11 Nov 1998 03:21:24 GMT
From: bigcheese@my-dejanews.com
Subject: String Split Help
Message-Id: <72avrk$n3r$1@nnrp1.dejanews.com>

I have this split command...

@kana = split(/([aeiou ])/,"$ENV{'QUERY_STRING'}'}");

and it splits the a,e,i,o,u's and spaces on both sides
(ie: cow (w/space) splits to "c" "o" "w" and " ")

Is it possible to make it split "cow "(w/ space) to "co" and "w "?

Thanks a bunch!
-Dan

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 V8 Issue 4194
**************************************

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