[26585] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8717 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 28 18:05:38 2005

Date: Mon, 28 Nov 2005 15:05:08 -0800 (PST)
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, 28 Nov 2005     Volume: 10 Number: 8717

Today's topics:
    Re: CGI file upload missing from STDIN <noreply@gunnar.cc>
    Re: CGI file upload missing from STDIN <nospam@thanksanyway.org>
    Re: CGI file upload missing from STDIN <nospam@thanksanyway.org>
    Re: CGI file upload missing from STDIN <noreply@gunnar.cc>
        Matching escaped delimiter chars <witold.rugowski@hp.com>
    Re: Matching escaped delimiter chars <sherm@dot-app.org>
        placing results from google in an array <nospam@home.com>
        string and hash [quite long] <h2so4@biggest-pc.reg>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 28 Nov 2005 20:30:43 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI file upload missing from STDIN
Message-Id: <3v1475F13cr84U1@individual.net>

Mark wrote:
> I am beginning to experiment with HTML forms and CGI.
> I have an HTML form that uploads a file using the
> multipart/form-data encoding and the POST method.
> The form target is a simple Perl script which opens a file and
> writes out the data that it received via STDIN.
> 
> The output file shows all the various inputs from my
> HTML form, except for the file stream. Any idea
> why the file isn't showing up?
> 
> Of course, I will use the CGI module for any
> serious work.

Try the CPAN module CGI::UploadEasy. Among other things, it helps you 
detect common mistakes in connection with file uploads.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 28 Nov 2005 11:30:55 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: CGI file upload missing from STDIN
Message-Id: <FJSdna5yaup0xxbeRVn-pA@w-link.net>

Ok, I was editing my sample code for posting purposes,
and I discovered that the file input statement preceded my
opening FORM tag. Problem solved (buggy HTML form.)

Having a bunch of people telling me to look at my code
again was, in fact helpful. Thank you!

-Mark




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

Date: Mon, 28 Nov 2005 11:34:08 -0800
From: "Mark" <nospam@thanksanyway.org>
Subject: Re: CGI file upload missing from STDIN
Message-Id: <KMadneRlfaM3xhbeRVn-tg@w-link.net>

"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote:
>
> Try the CPAN module CGI::UploadEasy. Among other things, it helps you 
> detect common mistakes in connection with file uploads.

Good suggestion, thanks. Yes, I will definitely use the CGI:: module
if I proceed with this. So far I just wanted to do something educational
(which it was), and produce a quick proof-of-concept for a client.

-Mark




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

Date: Mon, 28 Nov 2005 20:41:32 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI file upload missing from STDIN
Message-Id: <3v14reF13bljiU1@individual.net>

Mark wrote:
> Gunnar Hjalmarsson wrote:
>>Try the CPAN module CGI::UploadEasy. Among other things, it helps you 
>>detect common mistakes in connection with file uploads.
> 
> Good suggestion, thanks. Yes, I will definitely use the CGI:: module
> if I proceed with this.

Well, CGI::UploadEasy isn't part of "the" CGI:: module (assuming you are 
referring to Lincoln Stein's modules). But it does make use of CGI.pm 
for parsing the upload request.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 28 Nov 2005 21:21:09 +0100
From: Witold Rugowski <witold.rugowski@hp.com>
Subject: Matching escaped delimiter chars
Message-Id: <438b66b5$1@usenet01.boi.hp.com>

Hi!
I want to match with regexp substring, which is delimited by, let's say ". It is trivial, but I don't know how to match escaped quotes with \. OK, example will be better ;-))

Let's take string such:
AAAAAAA "blah blah \" blah blah" BBBBBB

How to match all what is in between quotes, not counting escaped quote. In this case it should match to:
blah blah \" blah blah

How it can be done????

Best regards,
Witold Rugowski


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

Date: Mon, 28 Nov 2005 15:52:52 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: Matching escaped delimiter chars
Message-Id: <m2y8384hqz.fsf@Sherm-Pendleys-Computer.local>

Witold Rugowski <witold.rugowski@hp.com> writes:

> Let's take string such:
> AAAAAAA "blah blah \" blah blah" BBBBBB
>
> How to match all what is in between quotes, not counting escaped quote.
> In this case it should match to:
> blah blah \" blah blah
>
> How it can be done????

A very simplistic way of doing that would be to use a zero-width look-behind,
so that the end of the match is (in English) "a quote character that's not
immediately preceded by a backslash." In Perl:

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my $string = 'AAAAAAA "blah blah \" blah blah" BBBBBB';
    
    if ($string =~ /\"(.*)(?<!\\)\"/) {
        print $1, "\n";
    }

As I said though, that's a pretty simplistic way of doing it. It works for
the specific example given, but may not work with real-world data. It does
not handle, for example, the case where the string you're interested in ends
in a backslash which is escaped - i.e. blah\\".

The special cases and "what if" scenarios like the above can get out of hand
rather quickly. For production use, I'd use something like the Text::Balanced
module on CPAN, or even a full-blown parser using Parse::RecDescent.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Mon, 28 Nov 2005 20:57:57 GMT
From: "Nospam" <nospam@home.com>
Subject: placing results from google in an array
Message-Id: <pbKif.5906$uR.40@newsfe7-gui.ntli.net>

Bear with me I am a perl beginner, I am trying to place the results of
google into an array so far the relevant code is:

$agent->get(my $url =
'http://www.google.co.uk/search?hl=en&safe=off&q=inurl%3Afootball++%22fixtur
es%22&meta=');

  my @urls = $agent->find_all_links( url_regex=> qr/viewtopic/);
@urls = map { $_->[0]}@urls;

foreach my $url (@urls)

however on printing out this array, all it prints out is the the $url
repeatedly, it seems that $url is the only url that is placed in the array,
what functions would I need to move the results into the array, an example
would be greatly appreciated.




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

Date: Mon, 28 Nov 2005 21:22:08 GMT
From: No_name <h2so4@biggest-pc.reg>
Subject: string and hash [quite long]
Message-Id: <4yKif.11287$S6.190070@twister2.libero.it>

Hi at hall, I am a beginner and I've got this problem: translate a string,
runtime generated by lsdvd program, into an hash. The string is similar at
this:
our %lsdvd = (
  device => '/dev/dvd',
  title => 'DVDVOLUME',
  vmg_id => 'DVDVIDEO-VMG',
  provider_id => '',
  track => [
    {
      ix => 1,
      length => 5309.090,
      vts_id => 'DVDVIDEO-VTS',
    },
    {
      ix => 2,
      length => 22.050,
      vts_id => 'DVDVIDEO-VTS',
    },
    {
      ix => 3,
      length => 63.060,
      vts_id => 'DVDVIDEO-VTS',
    },
    {
      ix => 4,
      length => 181.280,
      vts_id => 'DVDVIDEO-VTS',
    },
    {
      ix => 5,
      length => 181.280,
      vts_id => 'DVDVIDEO-VTS',
    },
  ],
  longest_track => 1,
);
There is a way?

P.S. sorry for my poor English


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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.

#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 V10 Issue 8717
***************************************


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