[11954] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5554 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 3 21:07:38 1999

Date: Mon, 3 May 99 18:00:18 -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           Mon, 3 May 1999     Volume: 8 Number: 5554

Today's topics:
        dynamically change setuid neal@make-a-store.com
    Re: Filehandle Question (Tad McClellan)
    Re: How do i print something using perl? <swarren@slip.net>
    Re: How to implement array of structure in perl (Tad McClellan)
    Re: ISPs that offer cgi space?? (Bob Trieger)
    Re: looking at directories <enigma@turingstudio.com>
    Re: looking at directories <enigma@turingstudio.com>
    Re: looking at directories (Brandon Metcalf)
    Re: looking at directories (Larry Rosler)
    Re: looking at directories <enigma@turingstudio.com>
    Re: looking at directories <cassell@mail.cor.epa.gov>
    Re: looking at directories <cassell@mail.cor.epa.gov>
    Re: need user to be able to submit files from browser (Bob Trieger)
    Re: Newsfeed and Local Weather <flavell@mail.cern.ch>
    Re: Newsfeed and Local Weather (Sam Holden)
        Problem in calling subroutine inside another routine shaominchi@my-dejanews.com
    Re: RegExp for escape characters (Larry Rosler)
    Re: Simple question <cassell@mail.cor.epa.gov>
        simple? but evasive <memberjh@yahoo.com>
    Re: This is an EASY ONE! (Tad McClellan)
    Re: This is an EASY ONE! (Larry Rosler)
    Re: Thumbnails from JPEGs <cyberjeff@sprintmail.com>
        Who am I? What am I doing? (looking for input) <silver@silverchat.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 03 May 1999 23:43:38 GMT
From: neal@make-a-store.com
Subject: dynamically change setuid
Message-Id: <7glcb9$tpt$1@nnrp1.dejanews.com>

I want to write a program which dynamically changes the setuid based on
parameters. Kinda like cgiwrap. ie myprog.pl user=neal, myprog.pl user=joeblow

Is this possible?  I've successfull written a c wrapper to make a program
setuid -but that involves compiling and changing permissions. I want to be
able to do this on the fly.

Any ideas?

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


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

Date: Mon, 3 May 1999 13:51:52 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Filehandle Question
Message-Id: <onnkg7.jo2.ln@magna.metronet.com>

Steve Ball (steve@berlingske.dk) wrote:
: I am 6 hours into learning Perl, having fun - and have a question, not
: answered by my reference tome (Ellie Quigley, Perl by Example)


   Well, at least is scores 3 Camels at

      http://www.perl.com/perl/critiques/index.html

   Though it says it is Perl 4 only.

   If that is still true, then its value is greatly reduced as
   lots of things have happened in the several years since
   Perl 4 was superceded...



   But do not despair!

   You have over a thousand "pages" of documentation that is *WAY*
   better than _any_ book (even better than the one with Larry Wall
   as an author).

      1) it doesn't go out of date, updated each time that the
         perl compiler/interpreter is updated.

      2) you are not at the mercy of an Indexer. You can do your
         _own_ word searching in it.

      3) it is free!

   Sound pretty good?

   It is  :-)



   I am referring, of course, to the standard Perl documentation
   that is shipped with every perl distribution.

   Find out where they are on your system and use them!


: I have a perl script (surprise), runs with command line (still to get to the
: ARGV part! ;-) ).

: myscript.pl steve.file

: Summarized code:

: ---------

: #This line was here initially, but didn't work
: #open (MYFILE, "myfile.txt") || die "Error $1\n";

: while (<>){
:     ...

:     open (MYFILE, "myfile.txt") || die "Error $1\n";
                                                 ^
                                                 ^

   You have a typo there. Is that in the book?

   That should be an exclamation point (!), not a one.


:     while (<MYFILE>){
:         ($a,$b)=split(' ');


   Unfortunate choice of variable names there.

   Those are the only two of Perl's special variables that are
   not upper case or punctuation symbols.

   It probably is not effecting you here, but I cannot bring myself
   to use them apart from their intended use (sorting).


:         ...
:     }
:    ...
: }

: -------------

: My first attempt had the filehandle open(MYFILE, "myfile.txt") before the
: while(<>) as commented out... however, the scalars $a and $b only went
: through the "myfile.txt" file on just the first iteration of the while
: loop... being blank thereafter.


   I dunno what that could be.

   Should work fine with it before the loop...


: I solved the problem by moving the open(MYFILE, "myfile.txt") line to inside
: the while(<>), thus opening for each iteration of while(<>).


   Yucky. Slow.

   You also go back to reading the first line every time you reopen it...


: My question is: why does the MYFILE 'close'... and if so, is the above
: implementation - reopening MYFILE for each iteration of the while loop -
: correct? It just seems clumsy.


   I dunno.

   Maybe if you gave us the real code, along with some data,
   we would be able to see what you are talking about...


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


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

Date: Mon, 03 May 1999 23:01:51 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: How do i print something using perl?
Message-Id: <zVpX2.1155$MQ1.1336@news.rdc1.sfba.home.com>

Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote in
message news:372D544D.70D5E20B@gmx.net...
> Stephen Warren wrote:
> > Well, I had a CPC [...]
>Which one? I had a 464 with green monitor and tape drive...

I (my parents!) managed a 6128, together with standard 3" internal drive,
colour monitor, plus external 3 1/2" drive and with the aid of a HW mod, an
external 5 1/4" too! I just wish you could've got Perl for CP/M:-)





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

Date: Mon, 3 May 1999 13:31:46 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to implement array of structure in perl
Message-Id: <2imkg7.jo2.ln@magna.metronet.com>

icyt@my-dejanews.com wrote:

: I need to create a person information array in PERL.  If we implemented in C
: language will be something like this:
:  --------------------------------------
:     struct person {
:         char name[16];
:         char sex;
:         short age;
:      };

:      struct person pTable[10];

:      /* access pTable */
:      index =5;
:      pTable[index].age = 40;

:  -----------------------------------

: How should I define pTable in PERL and how to access data in the table ?  


   There is much help awaiting on your hard disk.

   You should have a look at 

      perlref.pod - Perl references and nested data structures

      perldsc.pod - Perl Data Structures Cookbook

: I
: know I need to do HASH and I need a list, but I don't know how to glue it
: together.

: Can I get help with a sample code ?  Thanks,


   OK.


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

my @pTable;   # declare an array, we don't need no stinkin' size limits

my $index = 5;

$pTable[$index]{age} = 40;  # autovivification is Too Cool!

print "somebody is $pTable[$index]{age} years old\n";
---------------


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


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

Date: Mon, 03 May 1999 23:58:14 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: ISPs that offer cgi space??
Message-Id: <7glcf1$51l$1@oak.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
"Mike Flaherty" <mflaherty2@earthlink.net> wrote:
>I haven't looked yet but this seems like to best place to start.

Far from it!   What gave you the idea that it was even a place to 
consider posting this?


Perl is a programming language.  The web is a place to find nekkid 
pictures.  The 2 have nothing to do with each other.



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

Date: Mon, 03 May 1999 15:56:57 -0700
From: "Alex Black" <enigma@turingstudio.com>
Subject: Re: looking at directories
Message-Id: <372e28ac$0$200@nntp1.ba.best.com>

yeah, thanks. I'll take that into account.
*hrm*

next:

here's the code I'm working with:

###################################################
#!/usr/bin/perl

@data;
&read_input;

opendir (CURRENTDIR, "$data{'dir'}") || die ("Can't open that dir.\n");
@filenames = readdir(CURRENTDIR);
closedir(CURRENTDIR);
@filenames = grep(!/^\.\.?$/,readdir(CURRENTDIR));

$totalfiles = $#filenames;

$pageback = ($data{'page'}-1);
$pageforward = ($data{'page'}+1);

if ($pageback == 0) {
$pageback = $totalfiles;
}
if ($pageforward == $totalfiles+1) {
$pageforward = 1;
}

if ($data{'page'} ne "" && $data{'dir'} ne "") {


&print_HTMLheader;
print "<html>";
print "<head>";
print "<title>hello<\/title>";
print "<body>";
print "<img src=\"$data{'page'}.jpg\">";
print "<p>";
print "<a href=\"?page=$pageback&dir=.%2F\">&lt; &lt; Back<\/a>";
print "&nbsp;&nbsp;&nbsp;";
print "<a href=\"?page=$pageforward&dir=.%2F\">Next &gt; &gt;<\/a>";
print "<p>$totalfiles";
print "<p>$#filenames";
print "<p>@filenames";
print "<\/body>";
print "<\/html>";

exit (0);
}

else {
&print_HTMLheader;
&send_failure;
}
###################################################

well, this works fine, except $totalfiles, etc returns "-1"

this is a bummer :(

any ideas...?

_a





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

Date: Mon, 03 May 1999 16:01:52 -0700
From: "Alex Black" <enigma@turingstudio.com>
Subject: Re: looking at directories
Message-Id: <372e29d3$0$215@nntp1.ba.best.com>

No documentation found for 'readdir'

and my box won't accept -f...

:o)

_a


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

Date: Mon, 03 May 1999 23:36:42 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: looking at directories
Message-Id: <372e3282.2349253558@paperboy.corpeast.baynetworks.com>

On Mon, 03 May 1999 15:56:57 -0700, "Alex Black"
<enigma@turingstudio.com> wrote:

>yeah, thanks. I'll take that into account.
>*hrm*
>
>next:
>
>here's the code I'm working with:
>
>###################################################
>#!/usr/bin/perl
>
>@data;
>&read_input;
>
>opendir (CURRENTDIR, "$data{'dir'}") || die ("Can't open that dir.\n");
>@filenames = readdir(CURRENTDIR);
>closedir(CURRENTDIR);
>@filenames = grep(!/^\.\.?$/,readdir(CURRENTDIR));

You're doing a readdir() after you closedir().  This should look like

opendir (CURRENTDIR, "$data{'dir'}") || die ("Can't open thatdir.\n");
@filenames = grep(!/^\.\.?$/,readdir(CURRENTDIR));
closedir(CURRENTDIR);

Brandon


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

Date: Mon, 3 May 1999 16:53:56 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: looking at directories
Message-Id: <MPG.1197d6eb275baac59899ac@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <372e28ac$0$200@nntp1.ba.best.com> on Mon, 03 May 1999 
15:56:57 -0700, Alex Black <enigma@turingstudio.com> says...
 ...
> #!/usr/bin/perl

No '-w' and 'use strict;'  Oh, well...

> @data;

What is that line supposed to do?

> &read_input;
> 
> opendir (CURRENTDIR, "$data{'dir'}") || die ("Can't open that dir.\n");

  opendir CURRENTDIR, $data{dir} or
    die "Can't open '$data{dir}'. $!\n";

> @filenames = readdir(CURRENTDIR);
> closedir(CURRENTDIR);
> @filenames = grep(!/^\.\.?$/,readdir(CURRENTDIR));
> 
> $totalfiles = $#filenames;

<SNIP> of CGI code and all...

> well, this works fine, except $totalfiles, etc returns "-1"
> 
> this is a bummer :(
> 
> any ideas...?

Yes.

Working backwards, $#filenames is not the number of filenames in 
@filenames.  It is one less (the index of the last element).  The number 
of filenames is scalar(@filenames).  So the array is empty.

That is because you have read the directory twice, the second time after 
it has been closed.

<SNIP> sound of hand hitting forehead  :-)

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


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

Date: Mon, 03 May 1999 17:03:55 -0700
From: "Alex Black" <enigma@turingstudio.com>
Subject: Re: looking at directories
Message-Id: <372e385d$0$216@nntp1.ba.best.com>

> <SNIP> sound of hand hitting forehead  :-)
doh, and yes that is the exact sound :P :)

found it soon after I posted, and got absorbed making the other little
detail things work... but I've got a functional script now which works just
beautifully :)

thanks all,

_a


--
Alex Black, Head Monkey
enigma@turingstudio.com

The Turing Studio, Inc.
http://www.turingstudio.com


----------
In article <372e20a3$0$218@nntp1.ba.best.com>, "Alex Black"
<enigma@turingstudio.com> wrote:


> hi everyone,
>
> I've been looking around for info on how to access the filesystem with perl,
> specifically I need to get the number of files in a directory.
>
> haven't been able to find a thing :)
>
> anyone out there have a url they can send me or a code snippet?
>
> tia,
>
> _a


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

Date: Mon, 03 May 1999 17:14:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: looking at directories
Message-Id: <372E3BF9.E6B683F9@mail.cor.epa.gov>

Alex Black wrote:
> 
> yeah, thanks. I'll take that into account.
> *hrm*

Sorry.  How could I know you had this code?  My
PSI::ESP module is still alpha.  See how much better
you do when you post the code...

> next:
> 
> here's the code I'm working with:
> 
> ###################################################
> #!/usr/bin/perl

No -w on the end of the line.  Naughty, naughty!
It would have helped, too.

 
> @data;

huh????  You don't have an array @data anywhere, just a
hash %data, so I have no idea what this is doing.

> &read_input;
> 
> opendir (CURRENTDIR, "$data{'dir'}") || die ("Can't open that dir.\n");
> @filenames = readdir(CURRENTDIR);
> closedir(CURRENTDIR);
> @filenames = grep(!/^\.\.?$/,readdir(CURRENTDIR));

Oops.  You're re-reading the dir *after* you closed the
dirhandle.  Guess what you get.  Nada.
 
> $totalfiles = $#filenames;

So this fails.  BTW, the prefered way to do this is to
use @filenames in scalar context:
   $totalfiles = @filenames;
And since the array goes from 0 to n-1, $#filenames
is off by 1 from what you expect.
 
> [snip of a bunch of other code]
>
> well, this works fine, except $totalfiles, etc returns "-1"

I believe that.
 
> this is a bummer :(

I believe that too.
 
> any ideas...?

Yep.  See above.  Moving the readdir inside the
opendir-closedir pair ought to help.  And that -w flag
always helps.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Mon, 03 May 1999 17:19:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: looking at directories
Message-Id: <372E3D28.C1610817@mail.cor.epa.gov>

Alex Black wrote:
> 
> No documentation found for 'readdir'

Well, if you can't use perldoc, then you need to:
[1] use the manpages (man perlfunc); 
or
[2] use the HTML on-line docs if you have 'em; 
or
[3] use grep on the pod documentation if you have that tool;
or
[4] upgrade 

> and my box won't accept -f...

Then you definitely need to upgrade.. or pester your ISP to do so.
What do you get when you type:
    perl -v

The latest [stable] version of Perl is 5.005_03.  The latest
experimental version has a higher number.  If your version is
below 5.004_04, you ought to upgrade instantly.  Earlier versions
have known security flaws.  Of course, the latest version is
perfect.  :-)

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Tue, 04 May 1999 00:01:23 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: need user to be able to submit files from browser
Message-Id: <7glcku$51l$2@oak.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
"Matt Baker" <matt@betcha.net> wrote:
>how is this done?  I know netscape has an ftp feature built into the browser
>but I need a script (or maybe its just an html thing) that will allow
>retrieval of a file(specified by the user) from the users machine.

I betcha posted to the wrong newsgroup. Netscape is not written in perl.



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

Date: Tue, 4 May 1999 00:38:26 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newsfeed and Local Weather
Message-Id: <Pine.HPP.3.95a.990504003413.7302A-100000@hpplus01.cern.ch>

On Mon, 3 May 1999, Larry Rosler wrote:

> > Sorry, can't agree with that.  Joking aside: the SGML/HTML way would be
> > to wrap sentences in a pair of opening/closing sentence tags.  Whether
> > the rendering involved two spaces or not would be entirely a
> > presentation issue.  Remember, some renderings aren't visual anyway. 
> 
> Well, we've drifted far from Perl, 

Yes, sorry about that...

> I've never heard of a sentence tag in HTML. 

Oh, there isn't one. That's why I said that "the way _would_ be".

> What HTML tage were you referring to?

A purely hypothetical one, but entirely in the spirit of the design.

Sorry, my mistake for not expressing it more clearly.

-- 

        "...in order to have the least helplessly submissive experience"
                                    - Todd Fahrner




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

Date: 4 May 1999 00:40:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Newsfeed and Local Weather
Message-Id: <slrn7isggm.rbt.sholden@pgrad.cs.usyd.edu.au>

On Mon, 03 May 1999 21:11:44 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>Larry Rosler wrote:
>
>>nobodyuses&nbsp;&nbsp;toseparate
>>sentencesinanycasebuttheyshould
>
>No they shouldn't. Or do you think that wrapping whould only occur
>between words of the same sentence, and not between two sentences?

Obviously they would use "&nbsp;&nbsp; " but Larry removed all the
spaces from his post...

-- 
Sam

compiling kernels is what I do most, so they do tend to stick to the
cache ;)	--Linus Torvalds


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

Date: Mon, 03 May 1999 23:40:39 GMT
From: shaominchi@my-dejanews.com
Subject: Problem in calling subroutine inside another routine
Message-Id: <7glc5m$tod$1@nnrp1.dejanews.com>

When I call func1() inside func2(), PERL complained.
Can any one tell me why I got the following errors ?

Thanks,

shaomin
#==========    Error message when try to run the program    ==========

#   Prototype mismatch: sub main::func1 ($$) vs () at t2.pl line 19.
#   Too many arguments for main::func1 at t2.pl line 27, near "$type )"
#   Execution of t2.pl aborted due to compilation errors.

#!/usr/local/bin/perl -w

$p1 = 1;
$p2 = 2;
$aa = func1($p1, $p2);
print $aa;
func2();

sub func1() {
   local (@f1)=@_;

   foreach $x (@f1) {
     print $x, ", ";
   }
   print "\n";
   return 1;
}

sub func2() {
    my ($ff, $type, $name);

    $ff = 200;
    $type = 20;

   $ret = func1( $ff, $type );  ###  this is the complained line
    print "<2>\n";
}


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


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

Date: Mon, 3 May 1999 17:46:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: RegExp for escape characters
Message-Id: <MPG.1197e3433a28da509899af@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7ghuik$30p$1@nnrp1.dejanews.com> on Sun, 02 May 1999 
16:30:12 GMT, swistow@my-dejanews.com <swistow@my-dejanews.com> says...
> > However I want to increase functionality by allowing escape characters such
> > that
> >
> > ${foo}    => bar
> > \${foo}   => ${foo}
> > \\${foo}  => \bar
> > \\\${foo} => \${foo}
> >
> > and any arbitary '\'s not followed by ${foo} will remain the same
> >
> > \\\ some stuff ${foo} => \\\ some stuff bar

<BIG SNIP> of code attempt.

> If anyone can think of a nicer way of doing it then I'd be really grateful.

The following is basically a one-liner!  It is sketchy, but I think 
you'll get the point.

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

my $foo = 'bar';  # And as many other definitions...

$_ = ' ZZZ some stuff ${foo} Z${foo} ZZ${foo} ZZZ${foo} ZZZ ${baz}';
tr/Z/\\/;  # So we don't go bonkers counting backslashes in the input.

s{(\\*)(\${[a-z]+})}
    { "\\" x (length($1) / 2) . (!(length($1) % 2) &&
        do { no strict 'vars'; eval $2 } || $2) }eg;
print "$_\n";
__END__

Output:

 \\\ some stuff bar ${foo} \bar \${foo} \\\ ${baz}

The "no strict 'vars';" stuff could be improved.  For example, one might 
keep one's own hash of variable names and test for 'exists':

my %vars;
$vars{foo} = 'bar';

s{(\\*)(\${([a-z]+)})}
    { "\\" x (length($1) / 2) . (!(length($1) % 2) &&
        exists $vars{$3} ? $vars{$3} : $2) }eg;

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


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

Date: Mon, 03 May 1999 17:25:21 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Simple question
Message-Id: <372E3E71.D9D8C505@mail.cor.epa.gov>

Netguy wrote:
> 
> How to get something like LWP::Simple get() or like that work in
> (uh) Windows95?

Actually, that works pretty well.  If you have a modern version
of ActiveState Perl, you have on-line docs for it which give 
example code.  You just need that connection to the net, and you're
set.  And with a modern version of ActiveState, you can download
[with a connection first] using the ppm program which came along on 
the install.  The on-line HTML docs tell you how to use ppm also.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Mon, 3 May 1999 19:22:15 -0400
From: "Jane H." <memberjh@yahoo.com>
Subject: simple? but evasive
Message-Id: <7glb03$4uh@sjx-ixn1.ix.netcom.com>

Problem:

How do I get Perl to list  the 1st column's data  ($URL) as well ?

___________________
Given:
I am using DBI DBD  to interface with an Access database.

The query generates 2 columns of data which are clearly visible in Access.
However, when I iterate through the results with Perl, I only get one column
of data, Field3.

______________________
ACTUAL CODE AND RESULTS

__________SQL
SELECT First(URL) AS FirstOfURLs, Field3
FROM TableJH
WHERE (((Field2)="2b"))
GROUP BY Field3
HAVING (((Field3) Is Not Null));

___________RESULT IN ACCESS
Result in Access:

FirstOfURLs              Field3
   url.com                    data3

______________PERL CODE

while ($URL, $Field2=$SqlStatement->fetchrow())
          {

                 print "$URL : $Field2\n"

           }
_____________PERL RESULT
                     : data3



The URL field (url.com)  is not returned.


Thanks in advance :o)







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

Date: Mon, 3 May 1999 13:07:22 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: This is an EASY ONE!
Message-Id: <a4lkg7.jo2.ln@magna.metronet.com>

Eric Gafner (ericg@novointeractive.com) wrote:
: I think there is an easy way to do this, 
:  but can't find it on the web or in "Programming Perl".


   You seem to have ignored the *most authoritative* resource
   of all!!

   Namely the standard Perl docs that are shipped with perl.

   This should be the *first place* you look for help with
   Perl problems.

   Before the web.

   Before books.

   Before posting  :-)


:  All I want to do is use a scalar as a regular 
:  expression. That way I can search a line of text
:  to see if it contains the string value of the scalar.

:  I know there are probably other ways to do this, 
:  but I am a newbie and want to learn this trick.


   It isn't a trick, it is a normal thing.

   'perlop.pod' describes Perl's operators. You want to see
   the pattern matching operator (=item m/PATTERN/cgimosx),
   where it gives an example of exactly what you are requesting:

--------------
    # poor man's grep
    $arg = shift;
    while (<>) {
        print if /$arg/o;       # compile only once
    }
--------------


   [ though in modern perls you might also use the qr//
     quoting operator instead...
   ]


:  Please Reply to: chucil@yahoo.com

   There are headers for doing that.

   If you just supply them, then replies will go there without
   any special action required by the respondent...


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


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

Date: Mon, 3 May 1999 16:43:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: This is an EASY ONE!
Message-Id: <MPG.1197d462e89f77599899ab@nntp.hpl.hp.com>

In article <linberg-0305991546010001@ltl1.literacy.upenn.edu> on Mon, 03 

May 1999 15:46:01 -0400, Steve Linberg <linberg@literacy.upenn.edu> 
says...
+ In article <372DF3BC.3B59E1D7@novointeractive.com>, Eric Gafner
+ <ericg@novointeractive.com> wrote:
+ 
+ > I think there is an easy way to do this, 
+ >  but can't find it on the web or in "Programming Perl".
+ 
+ You didn't look very hard, then.
+ 
+ >  All I want to do is use a scalar as a regular 
+ >  expression. That way I can search a line of text
+ >  to see if it contains the string value of the scalar.
+ 
+ It is very easy to do this, and it is well-documented.  You should get 
+ in the habit of doing this kind of thing yourself.  Questions like
+ this that are about the basic fundamentals of a language are usually
+ answered in hundreds of easily-accessible locations.
+ 
+ To help you on your way, I will tell you (though others will 
undoubtedly
+ spill the beans for you) that the answer you seek lies in Programming
+ Perl, 2nd edition, somewhere between pages 57 and 76.  If you haven't
+ read through all of that, carefully and line-by-line, you should, and
+ you'll ind out lots more than just the answer to this one very basic
+ question.

Reading that is good advice in general.  However, you have aimed the 
responder in the wrong direction for this problem.

Though he thinks he wants to use a regular expression, it is far more 
likely that he should use the index() function (if for no other reason 
than to avoid failing on inadvertant regex metacharacters in the search 
string).  Instead of pointing to the description of pattern matching in 
the Blue Camel (to which book others may not have access -- gasp :-), I 
prefer to offer:

perldoc -f index

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


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

Date: Mon, 03 May 1999 20:30:44 -0400
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: Thumbnails from JPEGs
Message-Id: <372E3FB4.AEC2DC41@sprintmail.com>


--------------121BB80109B1527D50663E33
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> I'm looking for a Perl module/Script that will output a smaller
> thumbnail
> from a full sized JPEG. I've look at CPAN and in the graphics section
> at www.perl.com but can't seem to find anything.

  I believe that the ImageMagick module (sp?) will do what you need...

Jeff

--------------121BB80109B1527D50663E33
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<blockquote TYPE=CITE>I'm looking for a Perl module/Script that will output
a smaller
<br>thumbnail
<br>from a full sized JPEG. I've look at CPAN and in the graphics section
<br>at www.perl.com but can't seem to find anything.</blockquote>
<b>&nbsp;</b> I believe that the ImageMagick module (sp?) will do what
you need...
<p>Jeff</html>

--------------121BB80109B1527D50663E33--




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

Date: Mon, 03 May 1999 18:47:06 -0500
From: silver <silver@silverchat.com>
Subject: Who am I? What am I doing? (looking for input)
Message-Id: <372E357A.93F923D7@silverchat.com>

This is a "misc" group, afterall, so I thought I'd contribute to the
noise by pre-announcing some
stuff I was working on and was going to discuss "later", in case I'm
being redundant or if you have any suggestions or comments,
encouragement or discouragement.

so this is what I sent to "modules@perl.org" this afternoon, which
probably went into a lot
more detail than they wanted to know :) Much of it says "I will discuss
this stuff in the future",
but I guess I got impatient...



name:                       silver Harloe
email address:              silver@silverchat.com
homepage if you have one:   http://www.silverchat.com/~silver
preferred user-ID on CPAN:  SILVER (naturally :) )

  (yes, that is my real name. yes, it is lowercase on the court
documents.
   but I guess I don't care if you feel some great compelling need to
   capitalize it. I just hate to look at it that way).
  (web page currently boring, will be updated)

description of planned contributions:
  I'm in the process of developing a web page/series of papers/book on
  "Object Oriented Design" in Perl, with a focus on use of Design
Patterns
  (as in the book) and UML, and discussing issues like interface
inheritance,
  object persistence, and style.

  One of the first things I've developed towards that end 
  is a pseudo-generic object "decorator" which subsumes another object
and 
  traces its method calls, and watches its attributes. This is handy for 
  (a) people who don't have their perl compiled with debug info, (b)
producing
  debugging info in the context of your program (one of my subclasses
puts the
  debug trace in a Tk window). but mostly its there as an example of a
use
  of the Decorator pattern.

  So far the modules I have are:
    Decorator::TraceLog    (considering rename TraceToLog)
    Decorator::TraceLogTie (used internally by TraceLog, ties its hash
so
                            attribute references can be watched, as well
                            as immediately stored in the 'real' object)
    Decorator::TraceTkText (subclass of TraceLog, puts debugging info
                            in a Tk::Text window (or subclass thereof),
                            caches the trace info until the Text window
is
                            made)
  I even included documentation on how to do a totally evil trick with
  overriding bless() to auto-decorate your objects without them knowing
it.

  When the modules are closer to releasable status, I'll dicuss them on
  comp.lang.perl.misc and anywhere else you recommend (right now I have
no
  idea where else to discuss them), and I'll do a DLSI and brief desc
when
  I have a better handle on whether or not I should even bother to
release
  these.

  One of things I'm _also_ working on is a "perl super index", which
would
  theoretically index into all the o'reilly books, all the issues of
TPJ,
  the Effective Perl Programming book, all the FAQs and pods, and
possibly
  CPAN. What I'm developing right now is an input format which is easy
to
  type and still powerful... then I'll index a few score pages, plus a
few
  more each day, and encourage other people to contribute some typing
time,
  and hopefully in a few months we'll have a good place to look up where
to
  find all references and usage-examples of various things Perl.
  Once I have the format nailed, it'll be trivial to write a perl script
to
  convert that to html, and then I'll type in a lot to prove that I'm
not
  asking people to do anything I'm not willing to do more of, and then
post
  about the index and solicit contributions :)

  In the backburner I have ideas to develop "Win32 look and feel"
widgets
  for Tk, because I like the menus and drop boxes and especially the
 
multiple-column-where-each-column-is-resizable-and-some-columns-are-hidden-
 
off-screen-and-you-can-drag-and-drop-your-columns-to-different-places-and-
  sort-by-any-column-just-by-clicking-on-it display, which probably has
a
  more concise name, which, say, netscape messenger uses for your
mail/news
  index...
  
  I'm developing a totally-OO Tk Tetris (inspired by Advanced Perl
  Programming, but ultimately not reusing ANY code or design) to
illustrate
  some ideas on UI encapsulation, and other Design Patterns like
strategy and
  flyweight, and, of course, so I could learn to write Tk. 
  I doubt I'd contribute that to CPAN, of course.

  come to think of it, I can't say I'd have that much to contribute to
CPAN,
  per se, but at least _some_ stuff, so that's what I'd like a 
  developer handle/directory. thanks :)

--silver Harloe--
  "I am the soul of honor, kindness, mercy, and goodness.
     Trust me in all things."


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

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

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