Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Re: Re: HowTo build and distribute a PPMed module for Win32

by idnopheq (Chaplain)
on Sep 20, 2001 at 04:13 UTC ( #113506=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: HowTo build and distribute a PPMed module for Win32
in thread HowTo build and distribute a PPMed module for Win32

IIRC, this bit of magic is done via XML::Simple and a simple looking for ppd files fuzzily matching the file name based on the search criteria and the listed repositories. I'm on a Win95 box <sympathy is appreciated> w/o anything remotely perlish installed, so I cannot show the output of my PPM.

I would not, however, deny that the modules I have or the site is w/o flaws. If it is, lemme know. I claim to be no expert, tho I play one on TV.

Oh! You know what! I have "multi-threaded" in the ppd files, which I dunno if the Siemen's port compiles as such. Thus, you may not see it! Hmmmmm ... Try grabbing the ppd and tar.gz and edit the ppd file - removing the line w/ "multi-threaded" on it ... wonder if it will search that way ( using the --location path or URL in the search command ) ...

UPDATE: I have heard a while back that ActiveState was ditching SOAP in PPM, but I see now that that is incorrect. SOAP is used in the search capability, so no I head out and find how to set up the SOAP server piece ... MY BAD!

Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

  • Comment on Re: Re: Re: Re: HowTo build and distribute a PPMed module for Win32

Replies are listed 'Best First'.
($code or die) Re: Repository code (HowTo build and distribute a PPMed module for Win32)
by $code or die (Deacon) on Sep 25, 2001 at 18:39 UTC
    Right, I have been re-reading and understand how the search command works.

    When you do search Module-Name, it run's the function list_available(). This function returns a list of .ppd files in the repository. It does it differently depending on what type of repository it is, e.g.: file://, UNC, SOAP, or http://. We're interested in the last bit of the function concerning http.

    If the repository is an http:// repository (not soap), then it calls the function read_href() which returns the text on the page. list_available() expects either a directory listing (Apache or IIS format) or a default.prk format file - ActiveState's Visual Package Manager that's part of the Perl Dev Kit.

    For the search to work properly (without implimenting a SOAP interface or .prk) your repository must return something that resembles a directory listing, which parses.

    Thankfully, keeps the "libwww-perl/" part of the user agent. So we can write a small script that will return a directory listing for ppm and a nicely formatted page for regular browsers. This is a small working example of what to do:
    use strict; use CGI qw( :all ); my $user_agent = user_agent(); my $html_redirection = ''; if ($user_agent =~ m#libwww-perl/#) { # it's a perl bot - probably ppm, so return a # compatible directory listing print_dir_listing(); } else { # it's probably a regular browser, redirect... print redirect(-uri => $html_redirection); } sub print_dir_listing { # Get the current directory, (cwd doesn't necessarily work in IIS) (my $cwd = $0) =~ s[\\][/]g; $cwd =~ s[/([^/]*)$][]; print header({-type => "text/plain"}); opendir FOLDER, $cwd or die "I don't have permission $!"; print a({-href => $_}, $_ ), "\n" for grep { /\.ppd$/ } readdir FO +LDER; closedir FOLDER; }
    Save this to or something and make sure it's the default document. Then change $html_redirection variable to the URL where you want your actual users to go to and you're set. You can of course do something more dynamic for the actual users page, such as parse the XML in the PPD files to give user's full information on the modules (version, description, author etc) without having to edit an html file every time you change a package or add a new one. I leave that as an exercise for the reader :)

    Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://113506]
and nobody stirs...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2017-10-21 23:29 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (271 votes). Check out past polls.