[12880] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 290 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 28 23:07:20 1999

Date: Wed, 28 Jul 1999 20:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 28 Jul 1999     Volume: 9 Number: 290

Today's topics:
    Re: [Summary] Korn Shell or Perl? (brian d foy)
    Re: Any Suggestions (Abigail)
    Re: Any Suggestions? (Abigail)
    Re: Can perl declare constant? (Abigail)
    Re: CGI to verify the SSN (Abigail)
    Re: Check if 2 dates are in the same week (Abigail)
    Re: Creating dynamic GIF-s from CGI-script (Abigail)
    Re: Don't want to make file that owner is "NOBODY" (Abigail)
    Re: Easy way to emulate Unix's "sort" command? (Abigail)
    Re: eval() question (Abigail)
    Re: Help!! ---Database access in perl (Abigail)
    Re: How to copy a file to another name ? (brian d foy)
    Re: How to copy a file to another name ? <factory@factory.co.kr>
        How to make a backup file ? <factory@factory.co.kr>
    Re: NEWSFLASH: Supremes rule anti-advert-ware illegal <mpersico@erols.com>
    Re: Perl Question (Steven Smolinski)
    Re: Perl Question (brian d foy)
    Re: Perl Question <bwalton@rochester.rr.com>
    Re: substitute fcntl for flock <bwalton@rochester.rr.com>
    Re: Win32::ODBC error <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 28 Jul 1999 22:22:18 -0400
From: brian@pm.org (brian d foy)
Subject: Re: [Summary] Korn Shell or Perl?
Message-Id: <brian-ya02408000R2807992222180001@news.panix.com>

In article <7no2g2$617$1@news.ml.com>, mwang@tech.cicg.ml.com (Michael Wang) posted:

 
> The ?: construct is very special case. It handles a if-else case, i.e.
> either "local" or "yp". It can not handle a bit more 
> generalization, eg, "local", "yp", "local-then-yp", and "yp-then-local",
> as shown below in Korn Shell [since it can not be in Perl w/o the limitations
> I mentioned in the summary]. 

what did you just say?  how is a basic language feature a special case?


> $j="local yp" 
> for i in $j
> do
>   if [[ $i == *local* ]]; then
>     cat /etc/passwd
>   elif [[ $i == *yp* ]]; then
>     ypcat passwd
>   fi
> done | while read k; do ...; done

here's the same thing in Perl.  how you got that monstronity that
you started with is beyond me if that's the shell code you started
with.  notice that Perl deals with one line at a time, so it uses
very little memory.  everything is done in two processes (if you
have to use yp).

notice that the program structure is close to identical.  if you
had simply translated your shell to straight Perl, you would have
never wandered so far off into the woods.

$_ = "local yp";
foreach my $i ( split )
   {
   #notice that this is exactly what tchrist said you could do
   #with the tenary operator.  in fact, this is the same
   #program he showed.  i just added the foreach() which he
   #implied.
   open FILE, $i eq 'local' ? "/etc/passwd" : "ypcat passwd |"
      or next;
   
   while( defined( my $line = <FILE> ) )
      {
      ....
      }
      
   close FILE;
   }

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: 28 Jul 1999 21:26:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Any Suggestions
Message-Id: <slrn7pvess.4oo.abigail@alexandra.delanet.com>

Steve Wagner (steven_crazyman@worldnet.att.net) wrote on MMCLVII
September MCMXCIII in <URL:news:7nnmda$eh8$1@bgtnsc01.worldnet.att.net>:
?? Sorry for the double post but the last one was the wrong script.
?? 
?? I am new to perl/cgi and have written the following code. Do you have any
?? suggestions on how to restructure the code? It works great but It doesnt
?? seem to me that I should be using the same arrays for all these different
?? functions especially since I have a ton left to do.
??                             Any suggestions would be appreciated.
?? 
?? #!/usr/bin/perl

There is no -w here.
There is no -T here.
There is no use strict;
There is no use CGI;

?? print "Content-type:text/html\n\n";
?? 
?? read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

What if the read fails? What if you read less than $ENV{CONTENT_LENGTH}?
What if $ENV{CONTENT_LENGTH} is undefined?

?? @pairs = split(/&/, $buffer);
?? foreach $pair (@pairs) {
??     ($name, $value) = split(/=/, $pair);
??     $value =~ tr/+/ /;
??     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
??     $FORM{$name} = $value;
?? }

Why no use the CGI module that already has this, and a lot more?

?? $mailprog = '/usr/sbin/sendmail';
?? $recipient = 'crazyman@cgi101.com';
?? 
?? if ($FORM{'fname'} eq "" or $FORM{'lname'} eq "" or $FORM{'email'} eq "" or
?? $FORM{'address'} eq "" or $FORM{'state'} eq "" or $FORM{'city'} eq "" or
?? $FORM{'zip'} eq "") {
??     &dienice("Please fill out the fields for your First Name, Last Name,
?? E-mail, Adrress, State, City and Zip Code.");
?? }

Who says these fields will be "" if not filled out?
You don't initialize %FORM....

?? else {
??  open (MAIL, "|$mailprog -t") or &dienice("Can't access $mailprog!\n");
??  print MAIL "To: $recipient\n";
??  print MAIL "Reply-to: $FORM{'email'} ($FORM{'name'})\n";
??  print MAIL "Subject: Thank You for Registering\n\n";
?? 
??  foreach $key (keys(%FORM)) {
??  print MAIL "$key = $FORM{$key}\n";
??  }
??  foreach $key (sort(keys %ENV)) {
??         print MAIL "$key = $ENV{$key}\n";
??  }
?? }
?? 
?? close(MAIL);

What if the close fails? The open generally succeeds, as that's just opening
the pipe. But, if for instance sendmail isn't available, the close will fail.

?? open(OUTF,">>outdata.txt") or &dienice("Couldn't open outdata.txt for
?? writing. Please notify webmaster\@cgi101.com.");

Don't you want to know *why* it failed? And why rely on the user to notify
you?

?? print OUTF "$FORM{'fname'}|$FORM{'lname'}|$FORM{'email'}\n";

What if any of the fields contain one or more '|'s or newlines?

?? close(OUTF);
?? 
?? mkdir ($FORM{'fname'},0777) or &dienice("Couldn't Make directory. Please
?? notify crazyman\@cgi101.com.");

You just do an mkdir, solely based on the input of a form? What if 
$FORM{fname} starts with a '/'? What if it starts with '../..', or
has some '../' elsewhere in it? And why rely on the user to notify
you? Why ignore the reason the mkdir fails?

?? chdir($FORM{'fname'});

What if the chdir fails?

?? open(OUTFILE2,">index.html") or &dienice("Couldn't open
?? $FORM{'fname'}index.html for writing. Please notify crazyman\@cgi101.com.");
?? print OUTFILE2 "<html><head><title>Test</title></head><body>";
?? print OUTFILE2 "<center>Test $FORM{'fname'}<center>";
?? close(OUTFILE2);

What if $FORM{fname} contains HTML tags?

?? print "<html><head><title>Form Output</title></head><body>"; print
?? "<center><h1>Thank You The Following Info Was
?? Sent:</h1></center><br><br>\n";

How about using here documents?

?? foreach $key (sort(keys(%FORM))) {
??    print "<h3><center>$key = $FORM{$key}</h3></center><br>";
?? }

Those aren't header types, are they? If so, where's the text where this
is a header of?

?? print "<br><center>Click <A HREF=\"index.html\">Here</A>To Return To Our
?? Home Page</center>";
?? print "</body></html>";

Click? Click? With, for instance, lynx?

?? sub dienice {
??     ($errmsg) = @_;
??     print "<h2>Error</h2>\n";
??     print "$errmsg<p>\n";
??     print "</body></html>\n";
??     exit;
?? }

Each HTML document needs a TITLE attribute. This function doesn't
generate one. Besides, sending an 200 OK response in case of an *error*
isn't very appropriate.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:29:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Any Suggestions?
Message-Id: <slrn7pvf3p.4oo.abigail@alexandra.delanet.com>

revjack (revjack@radix.net) wrote on MMCLVII September MCMXCIII in
<URL:news:7nntsf$kd1$1@news1.Radix.Net>:
~~ 
~~ It's funny - while looking for something else on the perl.com "Perl and
~~ CGI FAQ" a few minutes ago, I noticed this:
~~ 
~~ 
~~     Q2.1: Should I use the Perl CGI modules to code all 
~~     my CGI scripts? Isn't it easier to do it myself?
~~ 
~~     It really depends on what you are trying to do. The 
~~     CGI modules should generally be used for heavy-duty 
~~     CGI scripts. For simple scripts, its is far easier 
~~     and quicker to roll your own or use CGI Lite (current 
~~     version is v1.62). If you really want, you can even 
~~     use the old Perl 4 cgi-lib.pl library. 
~~ 
~~ 
~~ "easier and quicker to roll your own". Hm.


If you know what you are doing, yes. If you don't, stick to CGI.pm.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:39:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Can perl declare constant?
Message-Id: <slrn7pvfl9.4oo.abigail@alexandra.delanet.com>

Carfield Yim (c8133594@comp.polyu.edu.hk) wrote on MMCLVII September
MCMXCIII in <URL:news:7nmdv4$gtm$1@nnrp1.deja.com>:
,, Can perl declare unchangable varible like constant in C?? How??


You can do everything in Perl using ties.


package The::Unchangeable::Variable;

sub TIESCALAR {bless \(my $x = $_ [1]) => $_ [0]}
sub FETCH     {${+shift}}
sub STORE     {require Carp;
               Carp::croak ("Trying to change an unchangeable variable " .
                            "makes your program stop");}

__END__


Typical usage:

    tie my $foo => 'The::Unchangeable::Variable' => 17;
    print "\$foo == $foo\n";
    $foo++;   # Will die here.



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:40:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CGI to verify the SSN
Message-Id: <slrn7pvfod.4oo.abigail@alexandra.delanet.com>

wmichaeln@my-deja.com (wmichaeln@my-deja.com) wrote on MMCLVII September
MCMXCIII in <URL:news:7nnma1$bq3$1@nnrp1.deja.com>:
== Hello,
== I need to write the CGI script to verify
== the SSN ( Social Security Number ).
== Does anyone know how to do that ?


I would suggest people send in a copy of their SSN card, that
makes verifying easier.



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:45:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Check if 2 dates are in the same week
Message-Id: <slrn7pvg1g.4oo.abigail@alexandra.delanet.com>

Victor Eijkhout (eijkhout@prancer.cs.utk.edu) wrote on MMCLI September
MCMXCIII in <URL:news:omg12gqrja.fsf@prancer.cs.utk.edu>:
%% David Cassell <cassell@mail.cor.epa.gov> writes:
%% 
%% > skyfaye@my-deja.com wrote:
%% > > 
%% > > I did check the FAQ before posting but no help.
%% > 
%% > But you apparently failed to notice the references to Date::Calc
%% > and Date::Manip .  If you download 
%% 
%% Download from where? What is CPAN?


Did you know there's a FAQ that has "What is CPAN" as part of the heading?



Abigail
-- 
Expected response: What is a FAQ?


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:47:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Creating dynamic GIF-s from CGI-script
Message-Id: <slrn7pvg59.4oo.abigail@alexandra.delanet.com>

brian d foy (brian@pm.org) wrote on MMCLVII September MCMXCIII in
<URL:news:brian-ya02408000R2807991002440001@news.panix.com>:
// In article <7nn0m4$bip$1@news1.relarn.ru>, "Pip" <pip@extech.msk.su> posted:
// 
// > Is there any templates/simple examples how to creat GIF images
// > from (for example) CGI-script WITHOUT any modules?
// > I agree make it "pixel by pixel" :) Main goal: NO MODULES needed.
// 
// creating a GIF is not a simple thing.  you could do it with no modules,
// but your code is likely to be thousands of lines long.


Nah.

Just open pipes to the appropriate tools from the netpbm package :)



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:54:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Don't want to make file that owner is "NOBODY"
Message-Id: <slrn7pvghe.4oo.abigail@alexandra.delanet.com>

vlad@doom.net (vlad@doom.net) wrote on MMCLVII September MCMXCIII in
<URL:news:7nnghj$cs3$1@news.servint.com>:
,, >> The only way around this that I know of is installing the suexec module for Apache
,, >> (if Apache is the web server you are using of course)
,, >> Check out http://www.apache.org/docs/suexec.html for more details on suexec
,, 
,, > No it's not, use chmod.
,, 
,, Nice smart ass response... But if you read the subject is says:
,, Subject: Don't want to make file that owner is "NOBODY" 
,, 
,, So can you acommplish that with chmod?  No.

It's very simple. Don't run something that creates files with uid NOBODY.

,, The data files are owned or need to be owned by a valid user.
,, 
,, If the data files need to be created/modified by a program/script
,, that is spawned by the web server, then that program will run under 
,, user: nobody, and therefore won't be able to modify a file owned by the 
,, valid user (i.e. the user the files are owned by), unless of course the 
,, file is mode 0666 or at least 0606.
,, 
,, But now, what stops another user on the same system from writing his own
,, program/script that he can call via a web browser that runs under user:nobody
,, as well, and can view/modify any data files owned by nobody or that are world
,, writeable.


Think about. Suppose you find a way that a normal user has a file, that
doesn't have permission xx6, yet your script can modify it anyway. Then
any other user on the same system can write a script that modifies said
file; all they need to do is the same as you did.

If you don't trust the users that have access to the same things you have,
don't do your business there. Go elsewhere.



Abigail
-- 
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:56:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <slrn7pvgmp.4oo.abigail@alexandra.delanet.com>

Jim Hutchison (jimhutchison@metronet.ca) wrote on MMCLVII September
MCMXCIII in <URL:news:379f4d63.80856505@news1.cal.metronet.ca>:
?? Newbie question here...
?? 
?? I'd like to sort a four-column table on a specific field.  Perl's sort
?? is only for a simple list...

If you look at the right angle, a table *is* a list. Trust me, UNIX sort
is treating your file as a one-dimensional list to sort.

?? Any ideas?

Uhm, how about RTFFAQ?


BTW, there was not need to put "Newbie question here" at the beginning of
the post. Just the fact you ask something that's a FAQ clearly indicates
you're a newbie. One of the lesser newbies.



Abigail
-- 
perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 21:59:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: eval() question
Message-Id: <slrn7pvgrl.4oo.abigail@alexandra.delanet.com>

Marshall Culpepper (marshalc@americasm01.nt.com) wrote on MMCLVII
September MCMXCIII in <URL:news:379F475E.4898C37C@americasm01.nt.com>:
^^ hi...i have this code working but I'm definately sure there's another
^^ cleaner way to do this...here's the deal:
^^ I have a user input a variable...lets say $input, now i want the value
^^ of $input to be the name of a variable i need to use..so lets say i have
^^ the variables $a, $b, and $c..this is the way i did it:
^^ $input=$ARGV[0];          # This would be either a,b, or c
^^ my($a,$b,$c)=('a','b','c'); # Define
^^ eval("return \$$input");    # This works but what happens if they
^^ accidentaly enter an incorrect value?


Then you get an error. I fail to understand why you want to do this though.
Did you read the FAQ on this subject?



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Jul 1999 22:02:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Help!! ---Database access in perl
Message-Id: <slrn7pvh0b.4oo.abigail@alexandra.delanet.com>

andrewfase@my-deja.com (andrewfase@my-deja.com) wrote on MMCLVII
September MCMXCIII in <URL:news:7nncp0$4v3$1@nnrp1.deja.com>:
~~ I need some help please!!
~~ 
~~ I am designing a site for a computer company, and they want a online
~~ database of all there stock
~~ 
~~ The problem is that the table has 30000+ entries!!

And that's a problem because of?

~~ i was going to use Sprite to access it, but i am thinking the database
~~ is just to big for it.

Did you try? I've never used Sprite, but why should Sprite have a problem?

~~ Can anyone tell me what i could use??? and where to find tutorial's to
~~ use it (maybe MySql ???)

Perhaps. But us MySql compatible with the format of their database?
What database do they have?

~~ One last thing it has to be free!!!!!

The site you are making is free, right?


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 28 Jul 1999 22:37:48 -0400
From: brian@pm.org (brian d foy)
Subject: Re: How to copy a file to another name ?
Message-Id: <brian-ya02408000R2807992237480001@news.panix.com>

In article <7no1ur$dad$1@news1.kornet.net>, "Yeong Mo/Director Hana co." <factory@factory.co.kr> posted:

> How to copy a file to another name  in same directory ?

File::Copy

> Now, I want to copy this file to bbb.txt through loading perl script from
> web.
> and give the new file chmod 777 permission.

you don't really want to do that, do you?  then anyone can read and write
that file.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Thu, 29 Jul 1999 11:42:41 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: Re: How to copy a file to another name ?
Message-Id: <7noeh8$5m2$1@news1.kornet.net>

What is this ?

File::Copy

>> How to copy a file to another name  in same directory ?
>
>File::Copy
>
>> Now, I want to copy this file to bbb.txt through loading perl script from
>> web.
>> and give the new file chmod 777 permission.
>
>you don't really want to do that, do you?  then anyone can read and write
>that file.
>
>--
>brian d foy
>CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
>Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>




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

Date: Thu, 29 Jul 1999 11:49:15 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: How to make a backup file ?
Message-Id: <7noetf$6hh$1@news1.kornet.net>

Hi,

There is a file named aaa.txt

Let's think there are directories information in aaa.txt file as following;
01 | directory-a |.................
02 | directory-b |.................
This directory fields are changed when I load other script.

Before aaa.txt file is changed, I want to have a backup file.

Finally, I want to compare two files of new aaa.txt and backup file, and
delete the old directory from my server which is not still there in new
aaa.txt file.

If someone has a solution for this, please let me know.

Thanks in advance.




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

Date: Wed, 28 Jul 1999 22:59:09 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: NEWSFLASH: Supremes rule anti-advert-ware illegal
Message-Id: <379FC37D.87162F94@erols.com>

Hmmm. It's awfully hot out for April 1st.


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

Date: 29 Jul 1999 02:03:15 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Perl Question
Message-Id: <slrn7pv9cg.rh.sjs@frisco.gulch.com>

kaz@eudoramail.com <kaz@eudoramail.com> wrote:
=Please someone tell me the difference between ".*" and ".*?"

I found a discussion about it in perlre (the regular expression manpage) 
by searching for the chartacters: *?

This is a fun game: read the question, then try to find the answer myself
in the online docs.  I wondered why all the old timers keep coming back
for more; now I know they just made a game of it. :)

Steve


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

Date: Wed, 28 Jul 1999 22:25:38 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Perl Question
Message-Id: <brian-ya02408000R2807992225380001@news.panix.com>

In article <7noa5j$omv$1@nnrp1.deja.com>, kaz@eudoramail.com posted:

> Please someone tell me the difference between ".*" and ".*?"

 .* finds the longest match possible.

 .*? finds the shortest match (for that portion) that will satisfy 
the entire regex.  

see the non-greedy quantifier stuff in the docs.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Wed, 28 Jul 1999 22:03:30 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl Question
Message-Id: <379FB672.8EB76C10@rochester.rr.com>

 ...

> Please someone tell me the difference between ".*" and ".*?"

 ...
 .* matches the longest possible string it can, given that it starts
matching at the first place it can

 .*? matches the shortest possible string it can, given that it starts
matching at the first place it can

See perlre for documentation.

As a standalone pattern, neither of these is very useful -- .* matches
everything in the string, and .*? matches a null.  For a better example,
consider use inside of patterns:

$s='blah<one>blah<two>blah<three>blah';
$s=~/(<.*>)/;
print "greedy matches $1\n";
$s=~/(<.*?>)/;
print "stingy matches $1\n";

This prints:

H:\Bob\junk>perl junk16.pl
greedy matches <one>blah<two>blah<three>
stingy matches <one>

And, of course, recognize that .* is merely an example of <reatom>*,
where <reatom> is any regular expression atom; and likewise for .*? and
<reatom>*? -- and also that the ? can also modify the +, ?, and {}
quantifiers to also make them "stingy" rather than "greedy".



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

Date: Wed, 28 Jul 1999 22:07:48 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: substitute fcntl for flock
Message-Id: <379FB774.F2E9E6AA@rochester.rr.com>

 ...

> My isp doesn`t support flock but does support fcntl, anyone know how
> to insert fcntl into a perl script and is it a good substitute for
> flock functions.

 ...
fcntl should be an excellent, perhaps preferable, substitute on many
OS's.  You don't say which OS you are dealing with.  With fcntl, you
will need to fill in some OS-specific information to get the behavior
you want.  On some OS's, fcntl is the key to locking files for network
access (not punny?).



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

Date: Wed, 28 Jul 1999 22:33:51 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Win32::ODBC error
Message-Id: <379FBD8F.9D65A288@rochester.rr.com>

 ...

> I am having a few problems with INSERT INTO using Win32::ODBC. I am running
> ...

> <ERROR>
> sql statement: "INSERT INTO topic (Date, Summary) VALUES ($date,
> '$subject')"
> Error: "-3502[Microsoft][ODBC MS Access 97 Driver] Syntax error in INSERT
> INTO statement.10"
> </ERROR>
>

You have an Access reserved SQL word above (date).  Since you are dealing with
Access, you can get rid of the syntax error by calling it [date] -- yes, in
square brackets.  Or better yet, don't use reserved words as column names.
Note that other databases may have a different list of reserved words, and/or
may have alternate methods of quoting them.   You've got to read your
database's docs.

> My question is: What the heck is wrong with the syntax??? From everything I
> have read regarding SQL and ODBC, the syntax is correct.

Read your database's docs.  From Access help:

"The following list includes all words reserved by the Microsoft Jet database
engine for use in SQL statements....

<very long list that includes "date">

>

 ...
Also, since this has nothing to do with Perl, you might have better luck on a
database newsgroup for questions like this :-).



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 290
*************************************


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