[12529] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6129 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 25 17:07:15 1999

Date: Fri, 25 Jun 99 14:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 25 Jun 1999     Volume: 8 Number: 6129

Today's topics:
    Re: Beginner's Question <edenkers@ktis.net>
    Re: Beginner's Question <rootbeer@redcat.com>
    Re: Can not write my file to the server <gellyfish@gellyfish.com>
    Re: Conveting plain-text username and password files (William Burrow)
    Re: copying files from the web (Dave Cross)
        dbm and untie error <cchandleNO@SPAMucla.edu>
        Dropping out of Win32::File jgrinwal@my-deja.com
        Dropping out of Win32::File jgrinwal@my-deja.com
    Re: FAQ 2.15: Archives of comp.lang.perl.misc <emschwar@rmi.net>
        Getting SIGALARM to break a blocked connect(), help! <pleonard@cs.vassar.edu>
    Re: HELP: Can't delete ONE stinking file with Unlink! roberthp@my-deja.com
        HELP: Fast file Concatenation kgentes@gentek.net
        how to make nested quotes? <zeng@stat.Berkeley.EDU>
        installing Tk.pm  <dthusma@netscape.net>
        Mandrake@YAPC <jcreed@cyclone.jprc.com>
        Net::SMTP - Adding a subject <kkuebler@iwaynet.net>
    Re: newbie: Grab URL into PERL? <gellyfish@gellyfish.com>
    Re: Problem with regular expression <rootbeer@redcat.com>
    Re: Question about hashes and lists <jdporter@min.net>
    Re: Replacing =?ISO-8859-1?Q?=E9?= with e etc <gellyfish@gellyfish.com>
    Re: syntax check without execution (Bart Lateur)
        timing for socket connect <dsg@nt.com>
    Re: trapping "severe warnings"? (Sean McAfee)
    Re: Unix CGI > Win/Mac <rootbeer@redcat.com>
    Re: use strict question <mayers@psi.com>
        Using Perl with an ADVFS filesystem... <feuling@gcg.com>
    Re: validating a regexp from a CGI form <macintsh@cs.bu.edu>
    Re: Why do we like Perl? (Chance Harris)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 25 Jun 1999 14:24:44 -0500
From: "Erik Denkers" <edenkers@ktis.net>
Subject: Re: Beginner's Question
Message-Id: <7l0kp5$pi3$1@dumber.ktis.net>

Thanks for quick reply John,

> One obvious benefit comes from being able to have references to
> variables that don't have names.  I can create a reference to an
> array -- an anonymous array -- like this:
>
> $arrayref = [ 9, 42, 666 ];
>

Don't think I'm dense but...

Array --- @myarray = (1,2,3)

Reference --- $myref = [1,2,3]

What is the difference, both contain same data, no?

Doesn't @myarray[1] contain the same value as $myref[1]  ???


> And since references are scalars, you can put them wherever you
> can put a number or a string (almost), such as the value of an
> array element, or the value of a hash entry.  Consider:
>
> $things[5] = [ 9, 42, 666 ];
>
> Then you have (as you'll discover by printing),
>
> $things[5][0] = 9;
> $things[5][1] = 42;
> $things[5][2] = 666;
>
> In short, references are what make complex data structures in Perl
> possible.  Read prelref, perllol and perldsc for more info.
>

I think I understand about complex data structures, just not 100%,
maybe after start writing some code with this need I will understand
better, maybe I've just got some unlearning to do.

Erik




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

Date: Fri, 25 Jun 1999 13:50:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Beginner's Question
Message-Id: <Pine.GSO.4.02A.9906251347470.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Erik Denkers wrote:

> Array --- @myarray = (1,2,3)
> 
> Reference --- $myref = [1,2,3]
> 
> What is the difference, both contain same data, no?
> 
> Doesn't @myarray[1] contain the same value as $myref[1]  ???

No - and the first is a bad way to write $myarray[1]. 

    $myarray[1]		# element of array @myarray

    $myref->[1]		# element of array @$myref

Without the arrow, you'd be accessing a different array. See
the perlref manpage for more information. Enjoy!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 24 Jun 1999 20:00:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can not write my file to the server
Message-Id: <7ku2pd$er$1@gellyfish.btinternet.com>

On Thu, 24 Jun 1999 16:14:42 GMT Jim Ray wrote:
> I am converting my UNIX perl scripts over to NT and I am having some
> problems.
> 
> Right now the following code will create a file on the server.  Under UNIX,
> no problem, under NT big problem.
> 
> Here's the code...
> 
>    open(DATA, ">>$dataname");
> 

You really should be checking that the open succeeded - if you print out
the value of $! on failure you will get a better idea of what has
happened.

If you are having difficulty with trapping some failure condition in 
some CGI program then you might find some help in perlfaq9.

>    foreach $argsa(@Save)
>    {
>       print DATA ("$argsa\n");
>     }
>    close DATA;
> 
> NT will not create the file.  I am running under IIS4 and have made sure the
> everyone account allows writing the file and also that the NT rights for
> every is set to FULL.
> 
> Still the file does not get created.  I am I missing something here?
> 

You probably need to specify an absolute pathname to your file as there
is no guarantee that your idea of the current directory is the same as
your script when it is run.

/J\
-- 
Jonathan Stowe <jns@gellyfish.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: 25 Jun 1999 20:39:27 GMT
From: aa126@DELETE.fan.nb.ca (William Burrow)
Subject: Re: Conveting plain-text username and password files
Message-Id: <slrn7n7q5s.hir.aa126@fan1.fan.nb.ca>

On Fri, 25 Jun 1999 17:14:39 +0000,
Kerry J. Cox <kjcox@vii.com> wrote:
>    I'm assisting in helping some users go from plain-text username and
>password files to Linux.  Currently, all the users on this sytem (over
>1000) have their login names and passwords in a simple flat-file
>format.  I need to provide some way to enter all these users onto a
>Linux system without doing it by hand.
>    Does anyone know of a simple script that would go through a flat
>file database and would then enter all the usernames and passwords onto
>a Linux system?  It would be RedHat 6.0.

Just indicate how the flat file database is setup (a few ``fake''
samples might assist), and undoubtedly somebody will come up with a
quick script to do it.

>    Thanks.  Please email me as well as I don't always have the time to
>check these newsgroups.

Please take the time to check, just use the search or scoring facility
of your reader to find the subject line.

-- 
William Burrow  --  New Brunswick, Canada             o
Copyright 1999 William Burrow                     ~  /\
                                                ~  ()>()


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

Date: Fri, 25 Jun 1999 19:56:45 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: copying files from the web
Message-Id: <3773deca.5935064@news.demon.co.uk>

On Fri, 25 Jun 1999 11:54:38 -0700, marlon
<marlon@soda.CSUA.Berkeley.EDU> wrote:

>given a URL like www.domain.com/foo.gif how do I copy the file 
>to a local dir. I know how to create requests with LWP and
>parse line by line but this doesn't seem like the wrong thing
>for a gif. Also FILE::Copy looks usefull but how do I tell it that the
>source is a URL?		Thanks!

File::Copy is no good to you. It doesn't understand URLs.

You need LWP::Simple and the function in there called 'getstore'.

hth,

Dave....

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


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

Date: Fri, 25 Jun 1999 12:40:11 -0700
From: "Chris Chandler" <cchandleNO@SPAMucla.edu>
Subject: dbm and untie error
Message-Id: <7l0mfs$a76$1@carroll.library.ucla.edu>

I am trying to migrate an application from an old Digital
Unix machine which blew up to a Linux Redhat 5.2. Since the old machine
is dead as a doornail I'm not sure which version of Perl it had.

Anyway, the app works ok except for this little section:

--
94   while (($res = dbmopen (%s, "$dbdir/services", 0400)) == 0 &&
95           $! == $EAGAIN) {} ;
96   %services = %s ;
97   dbmclose (%s) ;
--


(which is actually repeated more or less in several parts of the code)

When the file runs I get this error:

"untie attempted while 1 inner references
still exist at ./dumpservices line 97"

I suspect my problem is related to either the version of Perl that I'm
running or, the differences in version/type of DB between the old
machine and the new Linux (well, Red Hat 5.2) machine I'm porting it to.

Any ideas?

Thanks in advance,

cc



>---------------------------------------------<
<  Chris Chandler                             >
<  Programmer Analyst                         >
<  Dept. of Information Studies, UCLA         >
<  310-825-2159     cchandle@ucla.edu         >
>---------------------------------------------<
< "When an opponent comes forward,            >
<  move in and greet him;                     >
<  if he wants to pull back,                  >
<  send him on his way."                      >
<                            -O-Sensei        >
>---------------------------------------------<





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

Date: Fri, 25 Jun 1999 19:05:52 GMT
From: jgrinwal@my-deja.com
Subject: Dropping out of Win32::File
Message-Id: <7l0ju6$cnh$1@nnrp1.deja.com>

I have a directory cleanup script that needs to check the Attributes of
a file before deleting it.  The script runs as an NT service with as a
user account that is given full access to the directories and files it
needs to check during cleanup.

It worked originally, but at one point we accidentally changed some
directory and file access permissions, so the account running the
script could not access the directories.  When we changed them back,
the script stopped working.  "perl -d" shows that the program appears
to drop out inside the Win32::File module:
---------------------------------------------------------------
 ...
main::(cleanup.pl:94):        foreach $file (glob("$filemask")) {
  DB<1>
main::(cleanup.pl:95):           if ( -f $file ) {
  DB<1>
main::(cleanup.pl:96):              unless (Win32::File::GetAttributes
($file, $Attributes)) {
  DB<1> print $Attributes
32
  DB<2> print $file
anfax.log.990416
  DB<3>s
main::(cleanup.pl:101):             print LOG "$file:  ";
  DB<3>
main::(cleanup.pl:102):             if ($Attributes & HIDDEN) {
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:60):
60:         my($constname);
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:61):
61:         ($constname = $AUTOLOAD) =~ s/.*:://;
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:63):
63:         $!=0;
  DB<3> print $!

  DB<4>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:64):
64:         my $val = constant($constname, @_ ? $_[0] : 0);
  DB<4>
Usage: Win32::File::constant(name) at d:/Perl/lib/Win32/File.pm line
64, <IN> ch
unk 30.
        Win32::File::AUTOLOAD() called at cleanup.pl line 102
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<4>

 ...
---------------------------------------------------------------


Does anyone have any idea as to what is happening?


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


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

Date: Fri, 25 Jun 1999 19:06:33 GMT
From: jgrinwal@my-deja.com
Subject: Dropping out of Win32::File
Message-Id: <7l0jvg$cnt$1@nnrp1.deja.com>

I have a directory cleanup script that needs to check the Attributes of
a file before deleting it.  The script runs as an NT service with as a
user account that is given full access to the directories and files it
needs to check during cleanup.

It worked originally, but at one point we accidentally changed some
directory and file access permissions, so the account running the
script could not access the directories.  When we changed them back,
the script stopped working.  "perl -d" shows that the program appears
to drop out inside the Win32::File module:
---------------------------------------------------------------
 ...
main::(cleanup.pl:94):        foreach $file (glob("$filemask")) {
  DB<1>
main::(cleanup.pl:95):           if ( -f $file ) {
  DB<1>
main::(cleanup.pl:96):              unless (Win32::File::GetAttributes
($file, $Attributes)) {
  DB<1> print $Attributes
32
  DB<2> print $file
anfax.log.990416
  DB<3>s
main::(cleanup.pl:101):             print LOG "$file:  ";
  DB<3>
main::(cleanup.pl:102):             if ($Attributes & HIDDEN) {
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:60):
60:         my($constname);
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:61):
61:         ($constname = $AUTOLOAD) =~ s/.*:://;
  DB<3>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:63):
63:         $!=0;
  DB<3> print $!

  DB<4>
Win32::File::AUTOLOAD(d:/Perl/lib/Win32/File.pm:64):
64:         my $val = constant($constname, @_ ? $_[0] : 0);
  DB<4>
Usage: Win32::File::constant(name) at d:/Perl/lib/Win32/File.pm line
64, <IN> ch
unk 30.
        Win32::File::AUTOLOAD() called at cleanup.pl line 102
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<4>

 ...
---------------------------------------------------------------


Does anyone have any idea as to what is happening?


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


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

Date: 25 Jun 1999 14:02:53 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: FAQ 2.15: Archives of comp.lang.perl.misc
Message-Id: <xkfvhcckpzm.fsf@valdemar.col.hp.com>

Tom Christiansen <perlfaq-suggestions@perl.com> writes:
>     Have you tried Deja News or Alta Vista? Those are the best
                     ^^^^^^^^^
                     "Deja.com"

>     archives. Just look up "*perl*" as a newsgroup.
> 
>         http://www.dejanews.com/dnquery.xp?QRY=&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=terse&showsort=date&maxhits=25&subjects=&groups=*perl*&authors=&fromdate=&todate=

$givenURL =~ s/dejanews/deja/;

And at least as it was a few minutes ago, not only did I get
comp.lang.perl.misc, but also han.comp.lang.java.

-=Eric


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

Date: 25 Jun 1999 15:19:25 -0400
From: Peter Leonard <pleonard@cs.vassar.edu>
Subject: Getting SIGALARM to break a blocked connect(), help!
Message-Id: <rxzp1ohyv6.fsf@cs.vassar.edu>


I've been kicking around a problem here that I'm getting nowhere on.

Simply, I have a script that makes a bunch of HTTP requests to various
servers.  Results are handled in 'parallel' using select().  The
problem is that the initial connect() calls are done in a serial
fashion, and if one blocks because the target server is bogged or
dead, everything hangs.

I was trying to wrap the connect() code in a SIGALARM, but I can't
seem to get it to work.  Here's the code block:

    local $SIG{ALRM} = "print STDDERR 'SIGALARM on $site\n'";

		  < Lots of irrelevant perl here, dedicated to setting up the socket > 
    
    #set alarm
    alarm 1;
    $proto = getprotobyname('tcp');
    unless(socket(S, AF_INET, SOCK_STREAM, $proto)){
		  return undef;
    }
    unless(connect(S, $sa)){
		  return undef;
    }

    alarm 0;
		  
		  < more irrelevant perl >

  What I was hoping for was that if it got stuck in connect(), the
alarm would go off, and it would simply continue on it's merry way on
to the 'more irrelevant perl' code block, and further error handling
would handle the failure gracefully.  What's happening is that it
still blocks, and doesn't come out.

  HELP!

  Thanks,

		  --peter

		  
-- 
-------------
Peter Leonard, '97			pleonard@cs.vassar.edu
Computer Science			http://www.cs.vassar.edu/~pleonard
"This won't hurt a bit....CRACK!   YEEEEEEEOOOOOWWWW!!!"


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

Date: Fri, 25 Jun 1999 19:39:59 GMT
From: roberthp@my-deja.com
Subject: Re: HELP: Can't delete ONE stinking file with Unlink!
Message-Id: <7l0lud$dii$1@nnrp1.deja.com>

I think I'm in the right directory....  What confuses me about this is
why I can open and get a directory listing but can't do the deletion of
a file I'm listing as resident in the directory; you're probably right
about the chdir, but it still confuses me (I'm new at this Perl
thing....).

Speaking of documentation, I have about 6 books on Perl and not one of
them says explicitly that I have to chdir to a directory in order to
delete a file from it, unless I completely missed it (Programming Perl,
Perl Cookbook, Learning Perl for Win32, Perl for Win32 - Standard
Extensions, Perl Black Book, and Perl for Dummies).  Maybe I should
read the last one again!


Anyway, thanks for the response.  I'll try the chdir before the unlink.

Robert

In article <wWhc3.955$Fw1.9451@nsw.nnrp.telstra.net>,
  mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <7ks5bt$p8s$1@nnrp1.deja.com>,
> 	roberthp@my-deja.com writes:
>
> > opendir(Desktop,"C:/WINNT/Profiles/All Users/Desktop") ||
> > 	die "Opendir: $!";
> > while ($name = readdir(Desktop)) {
> > 	print "$name\n";
> > }
> > unlink("Acrobat Reader 4.0.lnk") ||   (<-Dies here without unlink)
> > 	die "Unlink: $!";
>
> Are you in the right directory?
>
> # perldoc -f opendir
> # perldoc -f readdir
> [snip]
> If you're planning to filetest the return values out of a
> C<readdir()>, you'd better prepend the directory in question.
> Otherwise, because we didn't C<chdir()> there, it would have been
> testing the wrong file.
> [snip]
>
> I am sure that you of course read the documentation, but simply missed
> that point.
>
> Martien
> --
> Martien Verbruggen                  |
> Interactive Media Division          | The world is complex;
sendmail.cf
> Commercial Dynamics Pty. Ltd.       | reflects this.
> NSW, Australia                      |
>


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


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

Date: Fri, 25 Jun 1999 19:19:04 GMT
From: kgentes@gentek.net
Subject: HELP: Fast file Concatenation
Message-Id: <7l0kmr$d2c$1@nnrp1.deja.com>

I am writing a network crawling program that
gathers data and prepares it for parsing by
another program.  I searched through Perl books
and this newsgroup to find the fastest way to
concatenate files, but didn't find any information
on performance of the various methods.  I ran some
of them on my local machine, but didn't see
much difference.  The problem is, when this
program goes into Beta it will be running on
different hardware (still NT though) and with
WAY more data to be working with.  I tried
increasing the file sizes of my test data,
and the number of files, but because it does
some preparsing, I have to go through a long
process to make "real" test data (argg...)

Anyhow, here are the methods I found.

Method 1-
   perl -pe1 file1 file2 file3 >one_file
(found this on this newsgroup, as a post,
and btw, how do I execute this from within
a Perl script..)

#!/usr/bin/perl

#

$filename1 = "alndata0.txt";

$filename2 = "alndata1.txt";

$filename3 = "alndata2.txt";

$filename_out = ">bigdaddy.txt";

# Method 2-

print scalar(localtime) . "\n";

local $/ = undef; #

open(FILE1, "<$filename1");

$slurp1 = <FILE1>;

close(FILE1);

open(FILE2, "<$filename2");

$slurp2 = <FILE2>;

close(FILE2);

open(FILE3, "<$filename3");

$slurp3 = <FILE3>;

close(FILE3);

open(FILEBIG, $filename_out);

print FILEBIG $slurp1, $slurp2, $slurp3;

close(FILEBIG);

# Method 3-

print scalar(localtime) . "\n";

open(FILE1, "<$filename1");

open(FILE2, "<$filename2");

open(FILE3, "<$filename3");

my $slurp1 = do { local $/; <FILE1> };

my $slurp2 = do { local $/; <FILE2> };

my $slurp3 = do { local $/; <FILE3> };

open(FILEBIG, $filename_out);

print FILEBIG $slurp1, $slurp2, $slurp3;

close(FILEBIG);

close(FILE1);

close(FILE2);

close(FILE3);

# Method 4 -

print scalar(localtime) . "\n";

my $slurp1 = `type $filename1`;

my $slurp2 = `type $filename2`;

my $slurp3 = `type $filename3`;

open(FILEBIG, $filename_out);

print FILEBIG $slurp1, $slurp2, $slurp3;

close(FILEBIG);

# Method 5 -

print scalar(localtime) . "\n";

open(FILE1, "<$filename1");

open(FILE2, "<$filename2");

open(FILE3, "<$filename3");

open(FILEBIG, $filename_out);

print FILEBIG <FILE1>, <FILE2>, <FILE3> ;

close(FILE1);

close(FILE2);

close(FILE3);

close(FILEBIG);

#completed

print scalar(localtime) . "\n";

exit;

Can someone who knows NT and Perl (and
understands the performance of these things),
tell me which is the quickest?  I am going
to be concatenating 3 files at a time into a
single file.  Each file is about 20k (obviously
making a single 60k file from each group
of three).  I will need to process about 20
concatenations per second to stay up with
the data on a maxxed out system.  That is why
I need to get the fastest method possible.
It is working fine in my testing, but until
I get to the "big test" with real data, I
won't know which method is fastest.

thanks for any help

Kim


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


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

Date: Fri, 25 Jun 1999 13:05:56 -0700
From: Bin Zeng <zeng@stat.Berkeley.EDU>
Subject: how to make nested quotes?
Message-Id: <Pine.SOL.4.10.9906251257570.10988-100000@witch.Berkeley.EDU>

In perl we can make quote by calling qq, e.g.
qq?whatever here is?
is equivalent to 
"whatever here is"

What I need is a nested quote, i.e. I what this works:
qq? whatever qq# here # is?

I hope you know what I want but the above doesn't work. (I know I can use
the double quotes "" but I can't use them for some other reasons so I need
something else.) Any idea?

Z.



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

Date: Fri, 25 Jun 1999 19:51:13 GMT
From: Darrin Husmann <dthusma@netscape.net>
Subject: installing Tk.pm 
Message-Id: <3773E075.26157037@netscape.net>

attempting to install perl Tk.pm onto my HP-UX 10.20 system.
I complete perl Makefile.PL
However, when I try to then run "make", it returns:

(ROOT:cx884007-c:/usr/apps/Tk800.014)--->make
        cd pTk && make
        cc -c -I..  -I. -Ibitmaps        -DVERSION=\"800.014\"
-DXS_VERSION=\"800.014\"  -I/opt/perl5/lib/5.00503/PA-RISC1.1/CORE
-Wall -Wno-implicit-int -Wno-comment -Wno-unused
-D__USE_FIXED_PROTOTYPES__ Xlib_f.c
In file included from tkPort.h:39,
                 from Xlib_f.c:1:
tkUnixPort.h:93: X11/cursorfont.h: No such file or directory
tkUnixPort.h:94: X11/keysym.h: No such file or directory
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
(ROOT:cx884007-c:/usr/apps/Tk800.014)--->

I realize I am probably missing some libraries here.  Could someone
point me in the direction of what I need to do to get this installed?



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

Date: 25 Jun 1999 15:12:11 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Mandrake@YAPC
Message-Id: <a17losqelw.fsf@cyclone.jprc.com>

Overall, the talk was great, including all the eye-candy
rambling before the official beginning. Nice to see (literally) 
hemophiliac-edge E and Perl/Gtk. Terribly sexy stuff.

However, did anyone notice menion of any real
advantage of Gtk.pm over Tk.pm, other than Gtk's
theming abilities and the assuredly more advanced
state of Gtk's HTML widget (possibly prounouned 'Mozilla')?

Mandrake raved about the wonderful win it is to get into
Gtk and find a load of ready-made composite widgets --
which it certainly is -- but there are, in Tk, 
(several different) file display widgets, panes, 
notebooks, and hierarchical trees, too, corresponding to the
Gtk versions demoed during the talk. I took away a general
feeling of "Boy, UI toolkits are great, aren't they?" but
nothing specific to Gtk's way of doing it.

The code he presented for the battery monitor looked
like it had to take several method calls on an object
to do what usually takes just one method call with a big hash
in Tk - admittedly, not fundamentally harder, but it seems more
cluttered, and possibly somewhat slower, with method call
overhead. (Probably irrelevant, actually)

I'm actually looking for some excuse to look seriously into
moving over to Gtk.pm if it's worth it, but unable to find one.
Any ideas?

---Jason


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

Date: Fri, 25 Jun 1999 15:21:21 -0400
From: "Kevin Kuebler" <kkuebler@iwaynet.net>
Subject: Net::SMTP - Adding a subject
Message-Id: <7l0kr6$8s8$1@news.iwaynet.net>

Hi,

I just downloaded and installed the Net::SMTP module. After reviewing the
documentation I created a test script and sent myself an email - worked
great. The only problem is that I can't find any docs on how to include the
subject line. Does anyone know the syntax for this?

Also when I run the script I get back an error msg to stdout that says:
"The system cannot find the path specified"
The email gets sent just fine, so I don't understand why I'm getting the
error. I'm not printing this msg out in the script and I've determined that
it's coming from somewhere in this block of code:

    #Setup the SMTP params
  my $smtp_host = 'mailhost';
  my $from = 'foo@bar.com;
  my $to = 'fooy@bar.com';

  #Create the smtp object
  my $smtp = Net::SMTP->new($smtp_host, Timeout => 30)
      or die "Can't connect to $smtp_host.\n";
  #Send the mail
  $smtp->mail($from) or die "mail: @{[$smtp->message]}\n";
  $smtp->to($to) or die "to: @{[$smtp->message]}\n";
  $smtp->data();
  $smtp->datasend($Msg);
  $smtp->dataend;
  $smtp->quit;

This example was taken from the Programming With Perl Modules book in the
Win32 PRK. If anyone can answer either of these questions I'd really
appreciate it.

Thanks,
Kevin Kuebler

WinNT 4 (SP4)
ActivePerl (Build 516)
Latest version of the libnet modules




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

Date: 24 Jun 1999 20:50:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie: Grab URL into PERL?
Message-Id: <7ku5m5$f3$1@gellyfish.btinternet.com>

On Wed, 23 Jun 1999 20:05:48 GMT R. Moose wrote:
> Please forgive me if this post is in the wrong area or seems a bit
> trivial....
> 
> My problem is:
> 
> I want to grab the calling URL and parse it inside of PERL.
> 
> For example, the page at http://www.xxx.yyy/books/bn/perl/index.shtml calls
> a PERL script.  The script should be able to get the entire URL in and then
> parse it into separate, um, subdirectories and variables like...
> 
>     MainURL = http://www.xxx.yyy/books/bn/perl/index.shtml
>     FirstDir = books
>     SecondDir = bn
>     ThirdDir = perl
>     PageName = index.shtml
>     WebSite = www.xxx.yyy
> 

I would advise you to read the following about the CGI:

The CGI Specification : <http://hoohoo.ncsa.uiuc.edu/cgi/>

The CGI FAQ           : <http://www.webthing.com/tutorials/cgifaq.html>

In these you will learn how to discover the URL of the referring page -
it has nothing in particular to do with Perl.  You will also find there
is a function in the module CGI.pm that will help you in this - you will
have CGI.pm if you anything remotely like a recent distribution of Perl.
You will be able to read about this in the modules fine documentation.

To split the path up as you have described you will porobably want to
use a relgular expression of some sort - regular expressions are described
in the perlre manpage that is part of the Perl distribution.

/J\
-- 
Jonathan Stowe <jns@gellyfish.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: Fri, 25 Jun 1999 13:58:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem with regular expression
Message-Id: <Pine.GSO.4.02A.9906251354540.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Michael Wahl wrote:

> I search for a regexp which will match any string which does not
> contain 'Paper'.

	!/Paper/		# one way
	/^(?!.*?Paper)/		# another way, if you can't negate

Enjoy!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 19:05:34 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Question about hashes and lists
Message-Id: <7l0jtk$cn8$1@nnrp1.deja.com>

In article <37733f03.79107039@24.0.3.71>,
  richj@home.com (Joan Richards) wrote:
> I'm trying to do some stuff with hashes of lists.  i am able to easily
> create the hash of lists.  but, i can't seem to delete an entry.  i am
> creating an entry into the hash by doing - push @{ $hash{$list} },
> $parm;  and then i try to delete an entry from the list by doing -
> delete $hash{$list}{parm}.  however, this doesn't seem to remove the
> entry from the list.

It depends on what you really want to do, and it kinda sounds like
you're not sure.  If you do

	push @{ $hash{$key} }, $val;

then $hash{$key} must be a reference to an array.

So there are two things you might want to do:
1. remove the value, $val, from that array, @{$hash{$key}}.
2. remove from the hash, the entry with that array, i.e. $hash{$key}.

The second one is easier:

	delete $hash{$key};

But if it's option (1) you want, then you'll have to know where
the item is in the array.  If it's still the last element (as
it was right after you pushed it), you can simply pop it off:

	pop @{ $hash{$key} };

Otherwise, you could use splice to remove it from the array; but
to do that you'll need to know its index.

Tip: don't call hashes or arrays "lists"; that only confuses things.
And remember that delete() only deletes entries from a hash; it
has no use with arrays.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


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


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

Date: 24 Jun 1999 20:11:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Replacing =?ISO-8859-1?Q?=E9?= with e etc
Message-Id: <7ku3e2$ev$1@gellyfish.btinternet.com>

On Thu, 24 Jun 1999 18:57:44 GMT Philip 'Yes, that's my address' Newton wrote:
> On Thu, 24 Jun 1999 07:54:21 -0700, lr@hpl.hp.com (Larry Rosler)
> wrote:
> 
>>> does anybody know of perl code to replace all characters with accents (e.g.
>>> i, s, h etc) with the standard a-z chars
>>
>>It is a one-liner.
>>
>>perldoc -f tr 
> 
> What exactly to put in the tr depends, of course, on the character set
> you are using (PC437? Latin-1? Unicode? EBCDIC? etc.)
> 

But it strikes me that if he can type it (and he obviously can as it shows
up fine here :) then he can type it into the left hand side of the tr
cant he ?  Of course the problem will arise if the character set that
he is translating cant be displayed by the tools available ....


/J\
-- 
Jonathan Stowe <jns@gellyfish.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: Fri, 25 Jun 1999 19:53:57 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: syntax check without execution
Message-Id: <3775de2c.3907803@news.skynet.be>

Larry Rosler wrote:

> Greg Bartels <gbartels@xli.com> says...
>> is there a way to syntax check a file with perl code in it without
>> actually executing it. is there a hook into 'eval' or something
>> that would let me do this?
>
>perl -c file

Actually, I think he ment "from within a Perl script". Urm... Maybe
something like this?

	if(`$^X -c $file 2>&1` =~ "syntax OK") { ... }

(not on a PC though... not unless "2>&1" works.)

	Bart.


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

Date: Fri, 25 Jun 1999 15:32:56 -0400
From: Dave Greenberg <dsg@nt.com>
Subject: timing for socket connect
Message-Id: <3773D968.A2CD2EBE@nt.com>

Hi,

Does anyone know if there is a way to change the timeout for the connect
function call? I've looked through socket.h (unix) and all the man pages
and have not found a way.

More important, if my connect times out, but the web server invoking my
perl script times out waiting for a response first, how can I handle
this elegantly?

Thanks,
Dave



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

Date: Fri, 25 Jun 1999 19:11:54 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: trapping "severe warnings"?
Message-Id: <_vQc3.233$kb5.4545@news.itd.umich.edu>

In article <3773CA82.F1C9B614@buffalo.edu>,
Andrew S Gianni  <agianni@acsu.buffalo.edu> wrote:
>I'm writing a cgi app that tries to do an require on a few files. The
>requires are wrapped in an eval{} and it catches problems, but whenever
>I get a "severe warning" it always just spits it out.

I faced a similar problem recently.  To catch warnings you need to create a
pseudo-signal handler for them.  For instance:

my $warn = "";
local $SIG{__WARN__} = sub { $warn .= $_[0] };
eval { dangerous_code() };
# ...take action based on $warn, $@, or both

See the description of %SIG in the perlvar man page for details.

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: Fri, 25 Jun 1999 13:46:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Unix CGI > Win/Mac
Message-Id: <Pine.GSO.4.02A.9906251335130.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Thomas Fischer wrote:

> I want my cgi to output an HTML containing a form/textarea with some
> plain text in it. The perl script knows the user's platform and now I
> want to convert the linefeeds in the text for the textarea to the
> platform specific format:
> 
> \n -> \r\n   for win
> \n -> \r   for mac
> 
> all my attempts fail. How can this be done??

The answer is the same even if your program isn't a Perl program, so you
should probably be asking this in a newsgroup about CGI programming or
something similar. But I'll tell you that HTML (including forms and their
data) doesn't care which platform it's on. Just use \n wherever you want a
newline, and everything should work. If (much to my surprise) you find
that it doesn't work, you should check with the docs, FAQs, and newsgroups
about HTML (or maybe about browsers) for more information. Do you know
where to find those?

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 16:17:30 -0400
From: "Mayer, Shane" <mayers@psi.com>
Subject: Re: use strict question
Message-Id: <3773E3DA.DE339B73@psi.com>



Mike Machado wrote:

> I am trying to use a scalar as a subroutine name while I have use strict
> on and I keep getting the error:
>
> Can't use string ("mysub") as a subroutine ref while "strict refs" in
> use at testing.pl line 5
>

I think the trick you are looking for is...

use strict;

my $sub = "mysub";

eval($sub);

sub mysub {
   print "eval is great for dynamic functionality";
}


Shane Mayer




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

Date: Fri, 25 Jun 1999 14:29:34 -0500
From: Lindsay Feuling <feuling@gcg.com>
Subject: Using Perl with an ADVFS filesystem...
Message-Id: <3773D89E.7A940065@gcg.com>

Hola.

I am wondering if anyone in Perl-land has used their Perl code for
file I/O on the Digital UNIX (Tru64, <-- insert newest OS name here)
advfs (Advanced File System, great name, huh?) filesystem. And, if so,
were there any problems with file I/O?

Muchas gracias.
feuling@gcg.com




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

Date: 25 Jun 1999 20:46:29 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: validating a regexp from a CGI form
Message-Id: <7l0pr5$a4l$1@news1.bu.edu>

Tom Phoenix <rootbeer@redcat.com> wrote:
>> Is there a reason you've got the empty string and =~ in there?

> Yes. :-)

 ...and that would be...?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: 25 Jun 1999 20:39:54 GMT
From: chance@avalanche.globeset.com (Chance Harris)
Subject: Re: Why do we like Perl?
Message-Id: <7l0peq$91k$1@onion.globeset.com>

Kartik Subbarao (subbarao@computer.org) wrote:
: I'd like to get some input from fellow Perl fans on this question.

I'm a total Perl newbie. I guess I am a fan now. I didn't like
it til I used it though.

What I didn't like about it (and still don't):

Seems to get used for wrong things by people who like it.
Something starts out as a perl prototype (seems perfect for 
that!).But then three years later its a big glob of brittle 
perl crap, that just doesn't freakin work, and can't be fixed
either. This can't be blamed completely on the language, but 
perl and the people who love it seem to encourage it.

Unneeded redundancy. I might get my head bit off for this.
If there are two really different ways of doing the same thing,
thats fine. Language support that amounts to nothing but
syntactic sugar for 50 ways to _express_ doing the "real" same thing 
doesn't accomplish anything except allowing people to write obtuse 
code, and make me waste my time learning lots of syntax for stuff
I already understand and have syntax for. This is a vague criticism,
I know, so don't take it personally anybody out there.

Why, on balance, I like it now:

I found "use strict". Without that I wouldn't have made it
past 20 minutes of perl experimentation. having $a = foo
get assigned to the string "foo" means the compiler just
ain't doing its job, IMO.

I needed to write a cross platform client server pair. With
perl I didn't have to figure out how and why NT managed to
screw up sockets, I didn't have to use MS-developer studio.
It just worked, even though I was relatively clueless about
perl. That alone is worth its weight in gold.

Feature set. Rich. Kicks ass. And Works. 



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

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

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