View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Joe Drago > WWW-URLToys > WWW::URLToys



Annotate this POD

View/Report Bugs
Module Version: 1.28   Source  


WWW::URLToys - gather and download URLs from URLs


        use WWW::URLToys qw/:DEFAULT ut_command_loop/;
        my @utlist;
        $SIG{'INT'} = 'ut_stop_download';
        if(@ARGV > 0)
            my $initial_command = join ' ',@ARGV;


WWW::URLToys is a separation of the program URLToys into its core code (this module), and the programs that use it (urltoys and urltoysw). This module has been made available via CPAN to allow others to use URLToys commands on their Perl arrays, and to create interfaces for URLToys that far surpass those of the original creator.



        @result = ut_exec_command("make",\@somearray);

Exported by default, this command runs any single URLToys command on a list, and returns the list that the command would expect it to return.



This will execute a string of commands from any file pointer. If the file pointer is the standard input, it will prompt the user to type in commands with the URLToys command prompt.



This command will stop a download. Useful for stopping a command while inside a callback or Tk callback (if you use a GUI).



Loads a URLToys configuration from a file.



Saves the current URLToys configuration to a file.


All callbacks are set via the %ut_callback hash. Setting any of the keywords for the callbacks to a sub of your own, you override the callback and receive it instead. All of them are sent 3 variables: which callback, value1, and value2.

An example:

        sub print_text { my ($type,$text,$ignored) = @_; print $text; };
        $ut_callback{'print'} = \&print_text;

Here is a list of them:

        Callback                 Description                                  Calls by Default     Value 1                  Value 2
        print                    Called with the 'print' command              cb_tty               text to print            Ignored
        extra                    Things that can safely be ignored            cb_tty               text to print            Ignored
        help                     Syntax Help                                  cb_tty               text to print            Ignored
        error                    Error Messages                               cb_tty               text to print            Ignored
        action                   Explains the current action                  cb_ignore            Current action text      Ignored
        makeupdate               Text explaining what 'make' is doing         cb_tty               text to print            Ignored
        dlbeat                   Sent when download of unknown size gets data cb_dlbeat            Ignored                  Ignored
        dlupdate                 Text explaining what 'get' is doing          cb_tty               text to print            Ignored
        output                   Regular output Text by program               cb_tty               text to print            Ignored
        title                    Sets the title of the window                 cb_title             text for window title    Ignored
        warnuser                 BADFLUX: Returns 1 on allow, 0 on no allow   cb_warnuser          ref to array of bad cmds Ignored
        variable                 Updates a variable to the main script        cb_ignore            variable name            value of variable
        complete                 When a get or resume finishes                cb_ignore            directory that finished  Ignored
        begin                    When a get or resume starts                  cb_ignore            directory its coming to  Ignored

The return value of the callbacks are ignored except the "warnuser" one, which is to warn a user on a potentially bad flux. It's very important that this returns a 0 if the user does not wish to run the flux! You must override this if you create a GUI flux. Please see urltoysw for an example.



These are all given by the EXPORT tag "configvars", except $config_file, which is exported by default.

Undocumented ^

As of yet the actions returned by the action callback, and the variables set by the 'variable' callback are undocumented.

syntax highlighting: