[11586] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5186 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 20 12:07:28 1999

Date: Sat, 20 Mar 99 09:00:24 -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           Sat, 20 Mar 1999     Volume: 8 Number: 5186

Today's topics:
    Re: $var$i or what? <sawyer@ibm.net>
    Re: @ARGV is not working <gellyfish@btinternet.com>
    Re: Can an unchecked checkbox input pass a different va <gwynne@utkux.utk.edu>
    Re: Can't read a text file with weird characters in it. (M.J.T. Guy)
    Re: CPAN <gellyfish@btinternet.com>
    Re: Crypt problems <gellyfish@btinternet.com>
        DB Variable <gaving@enter.net>
    Re: deleting an array of words from a string (Larry Rosler)
    Re: File test operator for modification/access time. (Tad McClellan)
    Re: Files in perl/lib directory: help needed <gellyfish@btinternet.com>
    Re: foo bar (Larry Rosler)
        Forwarding to home directory using Net::FTP (xS)
        FTP Recursive Directory Listing (xS)
    Re: help with perl and win98 <atipson@wesleyan.edu>
        HELP: Script would not execute but rather "save as" whe (KEhlar)
    Re: How  to receive string from cgi to HTML ? <gellyfish@btinternet.com>
    Re: Need a one liner... <uri@home.sysarch.com>
    Re: Need Faster Approach (Benjamin Franz)
    Re: not my server! <gellyfish@btinternet.com>
    Re: Perl 5.00404 installation in Solaris2.6 <gellyfish@btinternet.com>
    Re: PERl and Server Side Includes dragnovich@my-dejanews.com
    Re: Perl executable <gellyfish@btinternet.com>
    Re: Please Help I'm an Idiot <gwynne@utkux.utk.edu>
    Re: pls/help with anonymous nested data structures <gellyfish@btinternet.com>
    Re: Problems with IIS3 <gellyfish@btinternet.com>
    Re: rand() Performance <gellyfish@btinternet.com>
    Re: Remove HTML codes <gellyfish@btinternet.com>
    Re: Remove HTML codes (Tad McClellan)
    Re: Remove HTML codes (Tad McClellan)
    Re: Text Wrapping without Text::Wrap <All@n.due.net>
    Re: The truth about the Pentium III chip and ID --- **b <dave@northnet.com.au>
    Re: Very simple question <gellyfish@btinternet.com>
    Re: Web Server Automation <gellyfish@btinternet.com>
    Re: Web Server Automation <jcokos@ccs.net>
        Win32::NetResource::NetSharegetInfo does not work <gehring@politik.uni-mainz.de>
    Re: writing thumnails (Benjamin Franz)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 20 Mar 1999 06:55:42 -0800
From: Tim Sawyer <sawyer@ibm.net>
Subject: Re: $var$i or what?
Message-Id: <36F3B6EE.D416D54@ibm.net>

Greg Bacon wrote:

> Errr.. s/a hash/an array/

saw that

>     for ($query->param) {
>         if (/^var(\d+)$/) {
>             $var[$i] = $query->param($_);
>         }
>     }

saw that too.

> Sorry for any confusion I may have caused.  No soup for me.

No confusion caused. Have some crackers with your soup.

--
 - Tim -
 http://www.wd6awp.org




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

Date: 20 Mar 1999 13:53:22 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: @ARGV is not working
Message-Id: <7d098i$ld$1@gellyfish.btinternet.com>

On Mon, 15 Mar 1999 12:57:40 -0800 Scott Selberg wrote:
> Eric Bohlman wrote
>> 
>> On NT, there can be problems passing arguments to "commands" created by
>> file associations.  Try "perl argvtest1.pl one two three" and see if that
>> works.
> 
> Eric, you are right on the money.  Thanks.  My problem has been due to the
> use of file associations.  I guess I'll just need to get used to typing
> an extra 5 characters.
> 

Alternatively you might try using the pl2bat utility that comes with Perl
for Win32 that wraps your script in a .bat file that can be run by name.

I dont think the ARGV problem happens with that.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 09:50:50 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Can an unchecked checkbox input pass a different value?
Message-Id: <7d0cj8$kom$1@gaia.ns.utk.edu>

How about:

use CGI qw/:standard :html3/;
$q = new CGI;

print $q->checkbox(-name=>'my_box',
        -checked=>1,   #this sets the box to checked, 0 for unchecked
       -value=>'Checked');

Then use something such as

if (param('my_box') ne 'Checked'){
    $value = "something_else";
}

I haven't tested it, but it should work. You might also try:

$value = "something_else   if (!param('mybox'));

---------------------------
Bob Gwynne
gwynne@utkux.utk.edu
Speech Comm
University of Tennessee, Knoxville

JAPN (Just Another Perl Newbie)

Greg <greg@nospam.com> wrote in message
news:Y7BI2.1687$256.15597@news20.ispnews.com...
>Hello,
>
>Can un unchecked checkbox input still pass a value (i.e. it passes a value
>if checked, but can it pass a different value if unchecked)?  Perhaps I
need
>to be looking to javascript to do this?
>
>Any help is greatly appreciated! :^)
>
>Greg
>
>




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

Date: 20 Mar 1999 14:00:10 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Can't read a text file with weird characters in it.  Help.
Message-Id: <7d09la$b2s$1@pegasus.csx.cam.ac.uk>

Jason Stanley <jstanley@mmm.com> wrote:
>I am trying to read through the text file below, but when it hits the odd
>(ascii?) characters it won't read the rest of the file.  How do I get it to
>ignore all the strange characters and read all the words.

I'd guess it's barfing on the ^Z which is interpreted as end of file.

perldoc -f binmode


Mike Guy


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

Date: 20 Mar 1999 15:48:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: CPAN
Message-Id: <7d0g04$uf$1@gellyfish.btinternet.com>

On Wed, 17 Mar 1999 23:39:42 GMT Fernando Ariel Gont wrote:
> Hullo All , hope you are having a nice day!!
> 
> Hi, I was looking for CPAN, but couldn't find it all in a file.
> 
> Is the CPAN available in *only* *one* large file anyware?
> 

Why would you *want* all of CPAN in one large file ?  There are literally
thousands of files and many of these are various revisions of the same
Modules.  The tar file of the entire contents of CPAN would certainly
be in the tens of Megabytes if not more.

If you really *must* have it all as one file then you are probably going
to have to find some friendly person that has a mirror of CPAN and get
them to tar it up for you - however be warned this will be out of date
within a day or two ....

/J\


-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 15:15:29 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Crypt problems
Message-Id: <7d0e2h$sh$1@gellyfish.btinternet.com>

On Fri, 19 Mar 1999 09:45:16 GMT dccobb@yahoo.com wrote:
> Am I right in saying that Apache uses "Cd" as its encrytion key (salt) or does
> it use a random key?
> 

I dont know but you could look in the source code for htpasswd or ask in
an appropriate newsgroup.

> As I cannot use htpasswd I have created a Perl program which uses crypt()
> will this do the same job as htpasswd?
> 


I dont know but you could look in the source code for htpasswd or ask in
an appropriate newsgroup.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 11:00:39 -0500
From: "Gavin" <gaving@enter.net>
Subject: DB Variable
Message-Id: <36f3c55c@news3.enter.net>

I am currently trying to store a graphic image into a DB File which is using
the MLDBM module.  The program is storing it properly, but when I try and
stream it to a web browser it appears the browser does not see the end of
the file.  I have already taken the value of $db{temp} and saved it to a
file.  It is storing the image perfectly into the DB.  It just wont send it
to the web browser.  If I cat the file and send that variable out it works.
I am wondering if there is some kind of buffering issue or something to that
effect.  Any help would be appreciated.  Please email me back

Program:

#!/usr/bin/perl5
$| = 1;
use DB_File;
use MLDBM qw (DB_File);
use Fcntl;
$dbfile = 'ads.db';


&opendb;

print "Content-Length: 15680\n";
print "Content-type: image/gif\n\n";
print $db{temp};
print "Connection: close\n";

## If I use this code it works properly
#
# $temp = `cat imagename`;
# print "Content-Length: 15680\n";
# print "Content-type: image/gif\n\n";
# print $temp;
# print "Connection: close\n";

&closedb;

sub opendb {
        tie (%db, 'MLDBM', $dbfile, O_CREAT|O_RDWR, 0666 || die $!);
}

sub closedb {
        untie %db;
}







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

Date: Thu, 18 Mar 1999 17:24:36 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: deleting an array of words from a string
Message-Id: <MPG.115b472e63627943989785@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36f39796.714848@news.skynet.be> on Fri, 19 Mar 1999 00:21:38 
GMT, Bart Lateur <bart.lateur@skynet.be> says...
+ Larry Rosler wrote:
+ 
+ >@ignore = qw(i am a);
+ >
+ >> $string = "a boy am i";
+ ..
+ >  $string =~ s/\b(?:i|am|a)\b//g;
+ 
+ Indeed. And if you're interested, it's quite easy to build the regex
+ on the fly from the list of words. Somebody once suggested:
+ 
+ 	{
+ 		local $" = '|';
+ 		s/\b(@ignore)\b//o;
+ 	}
+ 
+ which will probably work alright, provided that the "words" are
+ garanteed to be constructed properly. Otherwise, if any contain non-
+ word characters, not only should those be quoted, (backslash), but
+ "\b" will no longer do what was desired, either.

It will work if the first and last characters of every "word" are word 
characters.

I posted this in another thread this afternoon:

  my $regex = '\b(?:' . join('|' => map { quotemeta } @terms) . ')\b';

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 20 Mar 1999 04:41:51 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File test operator for modification/access time.
Message-Id: <vgqvc7.j02.ln@magna.metronet.com>

miedo (latorre69@arrakis.es) wrote:

: I want to know how many days a file was modificated/accessed ago, but

: $date = -M "$file";
             ^     ^   quotes are unnecessary and misleading there

: What is the problem?


   s/M/A/;


: Please reply to my email.

   Ask it here, get the answer here.


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


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

Date: 20 Mar 1999 15:18:35 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Files in perl/lib directory: help needed
Message-Id: <7d0e8b$sk$1@gellyfish.btinternet.com>

On Fri, 19 Mar 1999 10:06:19 GMT saching@my-dejanews.com wrote:
> Hello guys,
> 
> I use a unixware 1.1.2 machine. I have	perl, version 5.001 installed in
> it..but i don't have all the files in perl/lib directory...no CGI, IPC, NET,
> POSIX libraries.....my question is can i copy these files from a Sun-Solarsis
> perl-5.004 version...if not where to find it (Unixware 1.1.2, perl 5.001)
> 

No I wouldnt recommend you copying the files from another server with
another OS and another version of Perl.

However 5.001 is a very old version of Perl now and  the best thing that 
you could do would be to install the latest version.

/J\

-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 18 Mar 1999 17:34:58 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: foo bar
Message-Id: <MPG.115b49a06f9d8b35989786@nntp.hpl.hp.com>

In article <36f19cd0.2007155@news.visi.com> on Fri, 19 Mar 1999 00:43:25 
GMT, Laurence Leider <lleider@tiny.net> says...
 ...
> On Mon, 14 Dec 1998 09:34:50 -0800, Marc <metalmd@earthlink.net>
> wrote:

You have a very slow and/or a very retentive newsfeed, especially for a 
post with no Perl content.  :-)

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sat, 20 Mar 1999 16:30:02 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Forwarding to home directory using Net::FTP
Message-Id: <e2QI2.399$P7.8947@typhoon.mbnet.mb.ca>

Hey,

I have had success with Net::FTP on most ftps, yet for some reason it does
not seem to work on ftps where your home directory is not the root dir.
Unlike other ftp clients, Net::FTP does not automatically forward you there,
and it does not seem to set a variable as to what the home dir is. I have
read the FTP RFC's yet they didn't provide much help.

Anyone who can show me perl code, or just the ftp command to use would be of
extreme help.

Thanks in advance,

'xS
xs AT dmusic DOT com




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

Date: Sat, 20 Mar 1999 16:26:34 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: FTP Recursive Directory Listing
Message-Id: <__PI2.396$P7.9080@typhoon.mbnet.mb.ca>

Does anyone know how to get the a recursive listing off all the files and
dirs on an ftp using Net::FTP? I have created a program to add all entries
to a mysql database, which is also used by a php3 search script for my page.
Currently I am am able to get a listing of all the files in the root dir
through the following code, yet it does not list all files.

@list = $ftp->ls
foreach $entry (@list) {
    print $entry
}

I have heard nlst can list all directorys and files w/ their path info but I
have not had any success with it. Any help would be appreciated.

'xS
xs AT dmusic DOT com





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

Date: Sat, 20 Mar 1999 11:39:17 -0500
From: Andrew Tipson <atipson@wesleyan.edu>
Subject: Re: help with perl and win98
Message-Id: <36F3CF35.D03356D2@wesleyan.edu>

I mean I'd like to be able to run the script independently of the command
line, simply from a link on a webpage, and it's not completely clear to me
where "slashdot.org" or "ultramode.txt" would fit into the script you
displayed.  Part of the reason I don't think my perl is configured properly
is that I can't seem to get any response from the command line- I've tried
every modifier every script- no response- just another empty line.  But
scripts that I run normally, calling them from a webpage, work great.

Sean Phillips wrote:

> Andrew -
>
> What messages do you get when you try to run the script?
> What do you mean by "...make this script work independantly"?
>
> - Sean
>



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

Date: Sat, 20 Mar 1999 10:54:59 -0500
From: KEhlarQUASH@SPAMMERtheglobe.com (KEhlar)
Subject: HELP: Script would not execute but rather "save as" when submitted on a form.
Message-Id: <MPG.115d8eda151ddae3989786@nntpd.bb.dec.com>

I have a Perl script that's supposed to execute when the "submit" button is 
pressed on a form.  It was working okay for a while then all of a sudden it no 
longer executes, instead the "Save as" window comes up.  I was making changes to 
the script when it happened which led me to believe that it has nothing to do 
with the server or the file property of the script.  Also I was able to execute 
another Perl script that was in the same directory so the server is supporting 
Perl.  It seems that I must have removed something critical in the script that 
led to this.

What I'd like to know is - is there some code that needs to be included in the 
script in order for this to not happen?  I'm VERY new at Perl and have searched 
the FAQs for an answer.  If anyone can give me a hand here I'd appreciate it.  
BTW I'm running this under Windows NT server 4.0 using ActivePerl.

Thanks!

Novey
-- 
remove QUASH SPAMMER from email address.


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

Date: 20 Mar 1999 14:13:53 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How  to receive string from cgi to HTML ?
Message-Id: <7d0af1$lu$1@gellyfish.btinternet.com>

On Tue, 16 Mar 1999 14:05:22 +0200 Galina Wasama wrote:
> This is a multi-part message in MIME format.
> --------------5C9A5CAAB30D49D576CFA5F6
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 

Please dont use MIME in newsgroup postings - at best it is annoying and
at worst it will cause your post to be ignored.  Infact in the previous
version of Tin I used it would cause the body of your post to be ignored
and show nothing.

> I have to call same PERL script from HTML.
> Is it possible to receive same date ( string ) from called script to
> HTML.
> 

Err yes it is usual for a CGI program to return some data to the browser
however I am not entirely sure what you mean here.

> Content-Type: text/x-vcard; charset=us-ascii;
<snip>
> tel;work:+358 9 862 65 762

Hmm the spammers got your phone number now too ... :)

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 11:40:18 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Need a one liner...
Message-Id: <x7k8wcazd9.fsf@home.sysarch.com>

>>>>> "AQ" == Ala Qumsieh <aqumsieh@matrox.com> writes:

  AQ> John Safrit <safrit@mindspring.com> writes:

  >> Is there a one-liner that will discard all lines except those between
  >> START and END tags?  It is easy to discard everything between them:
  >> 
  >> perl -ne 'print unless /^START$/../^END$/' file.txt
  >> 
  >> But to keep all lines between seems impossible.  Any ideas?  It must not
  >> include the tags themselves...

  AQ> Either you must be kidding, or I am missing something!
  AQ> What's wrong with:

  AQ> 	% perl -ne 'print if /^START$/../^END$/' file.txt

as he said. he wants to discard the tag lines too.

a rarely used feature of the scalar range op .. is its return value. it
returns the line number in the true range. this is actually the value
used by the surrounding conditional. as a bonus trick, the last line is
in floating notation with a trailing 'e0' this allows for a test of the
last line which matteched the ending tag.

so a common idiom i use in parsing text is

	if ( $range_line = /foo/ .. /bar/ ) {

		next if $range_line == 1 || $range_line ~= /e/ ;

		.....
	}

sometime other work has to be done at the boundaries of a range.

and here is a oneline that does it (tested):

perl -ne 'print if (/^S/../^E/) =~ /(?=^\d+$)(?!^1$)|e/'

the regex is doing both boolean tests. the first part looks ahead for
all digits and looks ahead for not a single 1, the second part just
looks for the /e/.


scalar range needs to be used more. i rarely see it mentioned in this group.

have fun kiddies,

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


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

Date: Sat, 20 Mar 1999 14:34:22 GMT
From: snowhare@devilbunnies.org (Benjamin Franz)
Subject: Re: Need Faster Approach
Message-Id: <OlOI2.15985$TD3.144283@typhoon-sf.pbi.net>

In article <1doxwbu.1scyirpj9hx3lN@p216.tc2.state.ma.tiac.com>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Larry Rosler <lr@hpl.hp.com> wrote:
>
>> How would one use either of those functions effectively to find the 
>> 75,000th item in a comma-delimited string, as requested?  Looping 
>> through 75000 index() calls to find the 75,000th comma sounds like a 
>> *very* costly procedure.
>
>How would you do it _without_ using index()?

My natural instinct was to write a regex. But it appears a regex that large
breaks perl 5.005_02 in interesting ways. The code below _doesn't_ produce
a perl error, - but generates a result that includes garbage binary data on
my box.  Kicking the the 1283 to 1300 causes a core dump.

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

print "Generating test string";
my $output = 'i0';
my $re     = '^';
for (my $count=1;$count<100000;$count++) {
	$output .= ",i$count";
}
$re .= '([^,]*,){1283}' x 2;

print "\nStarting speed run\n";
my $start = time;
my @match;
for (my $count=0;$count<100;$count++) {
	(@match) = $output =~ m/$re/o;
}
my $end = time;
my $run_time = $end - $start;
print "Took $run_time seconds. Match = @match\n";

perl -V

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.0.34, archname=i586-linux
    uname='linux ns.nihongo.org 2.0.34 #1 fri may 8 16:05:57 edt 1998 i586 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.8.1
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Jan 11 1999 19:24:18
  @INC:
    /usr/lib/perl5/5.00502/i586-linux
    /usr/lib/perl5/5.00502
    /usr/lib/perl5/site_perl/5.005/i586-linux
    /usr/lib/perl5/site_perl/5.005

-- 
Benjamin Franz


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

Date: 20 Mar 1999 15:07:14 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: not my server!
Message-Id: <7d0dj2$sd$1@gellyfish.btinternet.com>

On Thu, 18 Mar 1999 17:58:09 +0100 Anders Prior wrote:
> Hi, How do I access a file placed on another server and read its contents?
> I'm new to Perl and I would like to show a part of another page on my page
> via CGI without having to place it in my server dir.
> 

By using the excellent facilities provided by the LWP::UserAgent module ...

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 15:41:44 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl 5.00404 installation in Solaris2.6
Message-Id: <7d0fjo$u8$1@gellyfish.btinternet.com>

On 17 Mar 1999 23:07:30 GMT Wendy Lam wrote:
> ld: fatal: library -ldbm: not found
> 

You will need to get hold of the dbm library from somewhere I'm afraida
or alternatively not include it when configure asks you about the libraries.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 15:19:19 GMT
From: dragnovich@my-dejanews.com
To: sme@planetpod.com
Subject: Re: PERl and Server Side Includes
Message-Id: <7d0e9h$emk$1@nnrp1.dejanews.com>

Well, it is very easy to pass parameters from a perl script to a page

You just have to use maybe a JavaScript/Forms/Perl combination...
from a page you can pass parameters to a cgi scritp with some thing like this

<!--#exec cgi="/cgi-bin/yourscript.pl?parm1=some&parm2=other" -->
and so on...

I hope yuu can resolve your problem..!

Bye!

> I am trying to call a PERL script through a Server Side Include on an
> HTML page.  That part I have working fine.  The next step is to have the
> Server Side Include pass parameters to the script when it invokes it.
> This I have not figured out how to do.
>
> The code I'm using to run a script with no parameters is:
>
> <!--#exec cmd="helloworld.cgi"-->
>
> But I can't figure out, or locate on-line, how to pass parameters to
> this script.
>
> Any help would be greatly appreciated.
>
> thank you
>
> stewart
> sme@planetpod.com

------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com

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


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

Date: 20 Mar 1999 15:42:10 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl executable
Message-Id: <7d0fki$ub$1@gellyfish.btinternet.com>

On Wed, 17 Mar 1999 15:13:42 -0800 Swaminathan Balasubramanian wrote:
> Is there any tool to compile the perl source to Unix executable.?. Will
> it run faster than running source code directly?
> 

Yes.
No.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 11:04:33 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Please Help I'm an Idiot
Message-Id: <7d0gth$ntf$1@gaia.ns.utk.edu>

Get a copy of Lincoln Stein's Official Guide to Programming with CGI.pm,
read it, then address such questions to the
comp.infosystems.www.authoring.cgi.

---------------------------
Bob Gwynne
gwynne@utkux.utk.edu
Speech Comm
University of Tennessee, Knoxville

JAPN (Just Another Perl Newbie)

Michael Stow <thurlow@clara.co.uk> wrote in message
news:UpyI2.910$mi3.170@nnrp3.clara.net...
>I want to learn Perl for developing Web applications.
>I'm using Active Perl api509e (should I be?)
>I run Windows 98 (ditto)
>How can I get forms to run perl scripts without the browsers attempting to
>download them?
>
>Many many thanks for wasting your time.
>
>
>
>




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

Date: 20 Mar 1999 14:56:01 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: pls/help with anonymous nested data structures
Message-Id: <7d0cu1$nt$1@gellyfish.btinternet.com>

On Wed, 17 Mar 1999 18:25:49 GMT Chad M. Townsend wrote:
> 
<snip complicated data structure|>
> 
> How do I access my 'gpa'.
> 

print $my_mother{'children'}->[0]->{'education'}->[0]->{'gpa'},"\n";

I started to look at a more generalized approach but my head started to
hurt and Mrs Gellyfish came home for lunch ...

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 16:15:13 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problems with IIS3
Message-Id: <7d0hih$146$1@gellyfish.btinternet.com>

On Thu, 18 Mar 1999 09:13:51 +0100 Miguel Angel del Valle Mariotti wrote:
> Hi
> I am running a Perl application in Windows platform, but it is impossible to
> run it with IIS3, I don4t know what happens.
> The Perl version is 5.005_03, and only works with IIS4.
> 
> How  do i configure IIS3 to support Perl? Is there something special that I
> have to do in the Web Server?
> 

Yes I'm sure there is but you will want to ask the question in a group such
as:
comp.infosystems.www.servers.ms-windows

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 14:30:32 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: rand() Performance
Message-Id: <7d0be8$n6$1@gellyfish.btinternet.com>

On Tue, 16 Mar 1999 20:37:19 -0600 William H. Asquith wrote:
> I need advice or confirmation about the rand() function.
> I'm performing statistical simulations and I need a fairly
> good random number generator.  I'm lazy and don't want to port
> tested generators from Numerical Recipes in FORTRAN.  Can I
> use the rand() function and be assured that for simulations
> lengths (calls to rand()) on the order of 10**6 and statistically
> independent?

Not being a statistician I cant really give you a quantitative answer
to this however it is my understanding that the performance of rand
is dependent on the underlying libraries on your system.

On Linux and other Unix systems that support it you can use /dev/urandom
that uses a non-seeded non-sequenced method to produce random numbers -
the following is an example I posted recently that produces random words:


#!/usr/bin/perl

open(RANDOM,"/dev/urandom") || die "No random device - $!\n";

while(read(RANDOM,$_,1))
  {
     if (/\w/)
       {
        $randstring .= $_;
       }
     last if (length($randstring) == 8 );
  }
close RANDOM;

print $randstring;

As you can see /dev/urandom produces a random stream of bytes which could
however by interpreted as words (in the other sense) of whatever length you 
choose by reading say four at a time and then using unpack().

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 12:18:16 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Remove HTML codes
Message-Id: <7d03m8$gr$1@gellyfish.btinternet.com>

On Sat, 20 Mar 1999 18:04:38 +0800 Rollo Chan Ka Chun wrote:
> Sorry that I can't use the HTML::Filter. Any other method?...Thanks...
> 

Why cant you use HTML::Filter - is it because anytime you try to put the
floppy disk near your computer it runs away screaming, if you type

use HTML::Filter;

the keyboard melts and little demons carry away your monitor ?  You are
using a file system that prevents you from having directories  whose name
begin with 'H' ? What ?

If your teacher really does insist that you shouldnt use any modules to
achieve this task then I suggest that you should examine perlfaq9:

       How do I remove HTML from a string?

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 05:37:23 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Remove HTML codes
Message-Id: <3ptvc7.m42.ln@magna.metronet.com>

Rollo Chan Ka Chun (kcchan@csis.hku.hk) wrote:

: Sorry that I can't use the HTML::Filter. 


   Why not?


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


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

Date: Sat, 20 Mar 1999 05:36:48 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Remove HTML codes
Message-Id: <0otvc7.m42.ln@magna.metronet.com>

Rollo Chan Ka Chun (kcchan@csis.hku.hk) wrote:

: 	I would like to ask...how to use regular expression to remove all
: HTML codes in a file?


   Perl FAQ, part 9:

      "How do I remove HTML from a string?"


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


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

Date: Sat, 20 Mar 1999 16:41:33 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: Text Wrapping without Text::Wrap
Message-Id: <1dQI2.4181$DM5.1900@news.rdc1.ct.home.com>

Nordstrom Walt <revjack@radix.net> wrote in message
news:7d07c3$fjs$1@news1.Radix.Net...
: Surely there is an elegant way to word-wrap a string of text without
: resorting to the Text::Wrap module. I'm sure that it does a fine job,
: but it seems to me that wrapping text at, say, 70 characters would
: be a cinch. Yet, I find that I can't compose the code for it.
:
: Has anyone ever coded their own text wrap routine successfully?

Once upon a time Tim Gim Yee posted that his cat had walked across his
keyboard and came up with a subroutine to do just this.  The great thing is
that it is really easy to find in dejanews.  Just search for cat walked
across my keyboard.  It is a very nice little bit of code that lets you wrap
where you like while not splitting words, and it allows you to specify the
size of tabs.

HTH

AmD




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

Date: Sat, 20 Mar 1999 20:49:58 +1100
From: David Nillesen <dave@northnet.com.au>
Subject: Re: The truth about the Pentium III chip and ID --- **boycott info**
Message-Id: <36F36F46.5EE17633@northnet.com.au>

Quantum Leaper wrote:

> Michael Barnes wrote in message <36efc6e7.0@news.webaccess.net>...
> >Every MODEM has a MAC address also...so your friends pc is nicless, but not
> >macless
>
> Interesting is over 15 years of using modems,  300 baud to 56K modems
> (hopefully a Cable or DSL modem in about a year or so),  I have NEVER heard
> that they have a MAC address?   So what command or how do you get the MAC
> address of a modem?   Does this only apply to Mac modems or all modems? One
> other question,  why would a modem need a MAC address?

They dont need a MAC address because the computer/box you are dialing uses its.

MAC address's are useful only on the local network. A host builds up a
collection of MAC address=ip address pairs so it knows who to send packets to.
This only works for the local subnet. Your computer never needs to send its mac
address of its network. If someone wants to send you a packet from outside of
your network, they will check the ip , find its not on the local net and then
forward it to the default gateway. The gateway then examines it and forwards it
based on routing information. Even the gate way only knows the MAC address's of
the localnets it borders on. When it finally get to the incoming gateway on
your network , your gateway examines its ARP tables to find the appropriate
MAC/IP address pair.

This is done by issuing a WHOHAS request on the broadcast of the network.  Try
running tcpdump and watching the whohas traffic.  Your gateway machine, if the
MAC/IP pair is not in cache will issue a request to the local network with
something like "WHOHAS 192.168.1.1 TELL <MAC ADDRESS OF LOCAL MACHINE>" to
which the appropriate machine will respond with an answer "I HAVE 192.168.1.1
MY MAC IS xx:xx:xx:xx:xx:xx".  From then on all packets destined for
192.168.1.1 will be transferred to that MAC address.

This leads to ARP spoofong by issuing a broadcast I HAVE 192.168.1.1 without
being asked and keep issuing it frequently enough so that no host asks for it,
because it never expires in their cache.

Anyways, the point is, your MAC address should never leave your network because
it is not needed.
Routing to and from subnets is done at a higher level then MAC address's until
such time as it reaches the local subnet. type 'arp' on a unix box and check
out the tables. Only local subnet addresses will be visible.

Your modem does not need a MAC address and it would be superflous for it to
have one. When the local subnet is asked "WHOHAS <your dialup ip>" the box you
are connected to respnds with its MAC address. It recieves all packets for you
and since it knows where you live it can forward them out the appropriate
device be it PPP, MPPP or something else.

So technically you dont need every NIC to have a unique MAC address, just
enough addresses so that the probability of two cards with the same MAC address
appearing on the same network are vastly improbable.

I hope this helps (actually i hope its right too)

David Nillesen
dave@northnet.com.au



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

Date: 20 Mar 1999 14:41:36 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Very simple question
Message-Id: <7d0c30$ni$1@gellyfish.btinternet.com>

On Wed, 17 Mar 1999 08:52:02 -0800 Barry wrote:
> please answer this very simple perl question.
> this line reads a file into my perl script.
> open(FILE,"file.txt") || die;
> how do I read the file if its in a different directory? Lets say the one
> above it.
> open(FILE,"/file.txt") || die; this doesn't work.
> open(FILE,"..file.txt") || die; this doesnt work either.
> please help.
> I'm trying to test these scripts on my ISP's server if that matters.
> 

You are better off using  an absolute path to your file in most cases:

open(FILE,"/full/path/to/some/file.txt") || die "blah -$!\n";

However when running a script on some ISPs server you may find yourself
in a chroot'ed environment that might change the path - you will need to
talk to  them about that.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 20 Mar 1999 12:08:04 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Web Server Automation
Message-Id: <7d0334$gc$1@gellyfish.btinternet.com>

On Sat, 20 Mar 1999 01:19:06 -0500 John Cokos wrote:
> Is there a perl script out there that will automate virtual domain
> creation and email/pop account creation for virtual domain hosting?
> 
> Server is running RedHat 5.2, Apache, and Sendmail
> 

I would guess that there are probably hundred of such programs about - most
ISPs will use some such facility to administer their accounts.  However
the majority of these will be proprietary to the ISP and will use facilities
that almost certainly will not be available to you.

The problem breaks itself down into a number of discrete elements:

A)  Create POP accounts -
    This can often be as simple as creating a user account on the POP server
    but you might find that you are using some other software that has other
    requirements.

B)  Create DNS entries for virtual hosts.
    This simply amounts to creating the relevant CNAME records in the zone
    files for the appropriate domain ( i.e so www.bloggs.co.uk points at
    www.someisp.co.uk) and where appropriate create the relevant MX records.

C)  Setup apache virtualhost configuration.
    Create the entries in the Apache configuration files that point the
    virtual hostname to the relevant location on your web server.

All of these can be done quite easily using Perl but I would suggest that
you examine the documentation for the particular software you are using
that you will be using.

Beleive me you will feel a lot of satisfaction if you write these things
yourself and will probably endure pain and suffering if you try to alter
something that was created for someone else peculiar configuaration.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 20 Mar 1999 11:16:33 -0500
From: "John Cokos" <jcokos@ccs.net>
Subject: Re: Web Server Automation
Message-Id: <7d0hq5$9i0@dfw-ixnews8.ix.netcom.com>

I suppose the main thing I needed was a good starting point.
I've done the virtual host creation, and user adding already.

My main concern is with configuring sendmail, and all of it's
associated config files to recognize and route the virtual domains




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

Date: Sat, 20 Mar 1999 15:31:50 +0100
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: Win32::NetResource::NetSharegetInfo does not work
Message-Id: <36F3B156.C714D8CF@politik.uni-mainz.de>

Hi,

The Win32::NetResource on AvtiveStates 509 Build does not work properly.
Some functions work (i.e. NetShareAdd, NetShareDel), but others not,
i.e. NetShareGetInfo. The following script returns absolutely nothing -
not even an error. I have a clean installation just added the AdminMisc
Module (which works).

use Win32::NetResource;

$myshare = "Programme";

Win32::NetResource::NetShareGetInfo($myshare,\%share_info)
 || die "Unable to get share information\n";

foreach $i (keys %share_info) {
	print $share_info{$i},"\n";
}

exit;

TIA
-- 

Sincerely
Uwe W. Gehring

Research Assistant
****************************************************
University of Mainz - Institute of Political Science
Saarstr. 21          55099 Mainz             Germany
Tel.: +49 6131 39-5485         Fax: +49 6131 39-2996
E-Mail:                 gehring@politik.uni-mainz.de
WWW:                http://www.uni-mainz.de/~gehring
****************************************************


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

Date: Sat, 20 Mar 1999 14:37:06 GMT
From: snowhare@devilbunnies.org (Benjamin Franz)
Subject: Re: writing thumnails
Message-Id: <moOI2.15986$TD3.144362@typhoon-sf.pbi.net>

In article <7crn5a$6ov$1@nnrp1.dejanews.com>,  <horng@earthlink.net> wrote:
>Hi,
>
>I know perl can utilize the GD library to do some manipulation of gif files. 
>Is it possible to use perl to create thumnail image for a gif file?  How
>about any other format (jpg, bmp, tic, pic, etc)?  Further, i would like to
>generate the image with minimum file size.  I know there are some well-known
>software packages, eg. adobe imageready, can do that.  I am looking for some
>way to automate the entire process (creating thumnails then optimizing the
>file size) with one call of perl script.
>
>Are these all possible?  I appreciate any advices.

Sure. I wrote a script a while ago to do that.
<URL:http://www.nihongo.org/snowhare/utilities/htmlthumbnail/>

-- 
Benjamin Franz


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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